• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

BUnzaga

Members
  • Content count

    330
  • Joined

  • Last visited

Community Reputation

267 Neutral

About BUnzaga

  • Rank
    Member
  1. Well I went with what I posted above, only instead of handling the callback during the collision iteration, I handle it afterward, because removing the rigidbody in the middle of iterating them was causing the browser to lock up   Here is what I ended up with for those of you who are interested in Ammo.js and this topic.  Please, if someone knows a better way, let me know.   Demo: https://goote.ch/d3a10e52808241ada183928d966fadd8.project (webGL).   Code: for(var key in AmmoUtil.collision){ if(AmmoUtil.collision.hasOwnProperty(key)){ AmmoUtil.collision[key].separated ++; } } var dp = this.dispatcher; for(var i = 0, ilen = dp.getNumManifolds(); i < ilen; i++){ var manifold = dp.getManifoldByIndexInternal(i); var num_contacts = manifold.getNumContacts(); if(num_contacts === 0){ continue; } var bodyA = AmmoUtil.rigidBodies[manifold.getBody0()]; var bodyB = AmmoUtil.rigidBodies[manifold.getBody1()]; for (var j = 0; j < num_contacts; j++){ var pt = manifold.getContactPoint(j); if(pt.getDistance() < 0.0){ var colID = bodyA.entity.id+"_"+bodyB.entity.id; if(AmmoUtil.collision[colID] === undefined){ pt.getPositionWorldOnA(pvec); pt.getPositionWorldOnB(pvec2); var normalOnB = pt.get_m_normalWorldOnB(); var pointOnA = new goo.Vector3(pvec.x(), pvec.y(), pvec.z()); var pointOnB = new goo.Vector3(pvec2.x(), pvec2.y(), pvec2.z()); var normalOnB = new goo.Vector3(normalOnB.x(), normalOnB.y(), normalOnB.z()); var info = { first:true, entityA:bodyA.entity, entityB:bodyB.entity, dataA:{other:bodyB.entity, pointA:pointOnA, pointB:pointOnB, normal:normalOnB}, dataB:{other:bodyA.entity, pointA:pointOnB, pointB:pointOnA, normal:normalOnB}}; AmmoUtil.collision[colID] = info; } AmmoUtil.collision[colID].separated = 0; break; } } } for(var key in AmmoUtil.collision){ if(AmmoUtil.collision.hasOwnProperty(key)){ if(true === AmmoUtil.collision[key].first){ AmmoUtil.collision[key].first = false; var entA = AmmoUtil.collision[key].entityA; if(entA){ var rbc = entA.getComponent('RigidBodyComponent'); if(rbc){ if(rbc.collisionBegin){ rbc.collisionBegin(AmmoUtil.collision[key].dataA); } } } var entB = AmmoUtil.collision[key].entityB; if(entB){ var rbc = entB.getComponent('RigidBodyComponent'); if(rbc){ if(rbc.collisionBegin){ rbc.collisionBegin(AmmoUtil.collision[key].dataB); } } } } else{ if(AmmoUtil.collision[key].separated > 1){ var entA = AmmoUtil.collision[key].entityA; var entB = AmmoUtil.collision[key].entityB; if(entA){ var rbc = entA.getComponent("RigidBodyComponent"); if(rbc){ if(rbc.collisionEnd){ rbc.collisionEnd(entB); } } } if(entB){ var rbc = entB.getComponent("RigidBodyComponent"); if(rbc){ if(rbc.collisionEnd){ rbc.collisionEnd(entA); } } } delete AmmoUtil.collision[key]; } } } }
  2. I'm using Ammo.js with the Goo webGL engine, and I'm working on trying to get triggers implemented, but I'm having some struggle finding a 'good' way to handle collision separation.   Here is a jsFiddle which shows how to handle collision starting:   http://jsfiddle.net/ajd7vd1o/   I'm also planning to implement a 'callback' type thing like this:   http://gamedev.stackexchange.com/questions/22442/how-get-collision-callback-of-two-specific-objects-using-bullet-physics   So when one object collides with another, it will pass in some collision info.   The problem I am having, is figuring out a good way to handle the separation, when the two previously colliding objects are no longer colliding.   Supposedly, there are gContactProcessed and gContactDestroyed callbacks which I could tap into, but I don't think these are currently possible.   http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Collision_Callbacks_and_Triggers   So I'm reaching out, before I start from scratch creating my own functionality, to see how other people have handled this.   Here is my main idea:   1. Have a map of collisions. 2. At the start of each pass, set a boolean value for all current collisions to false. 3. The fist time a collision is added to the map, trigger the onCollisionBegin callback, with the data from the collision. 4. During the collision check, if two objects are still colliding, set their boolean value to true. 5. For each collision in the map, if their boolean value is still false, trigger the onCollisionEnd callback and remove it from the map.   Does something like this seem good?  Are there any current implementations of Ammo.js with collision separation mechanics that I can look at?   Thank you in advance!
  3.   I currently have implemented the first suggestion, but would like more information on how I would go about doing your second suggestion properly.  I don't expect you guys to do the work for me, but just a keyword or two to look up in google would be highly appreciated.   So in my demo, I have 'previous', 'current', and 'rendered'(a better word would be interpolated).  In your second idea, I would use the interpolated position AFTER the physics calculation, not DURING it.  I like how that sounds.  Something like...      while (accumulated >= TIC) {   interpolated = oldPos = newPos   newPos += TIC * Velocity   accumulated -= TIC  }  ticLeft = accumulated / TIC  smooth = 1.0 - ticLeft  interpolated = (newPos * ticLeft) + (oldPos * smooth) // handle the wrap around logic here? // if interpolated > screen extents, set interpolated & oldPos & newPos to the teleported position?
  4. Hey thank you for the reply Paradigm Shifter.  Yes I wanted a similar effect, such as in Asteroids, only I don't need it to show the remaining ship as it wraps.  Just a simple...  if > screen width, put back to 0.  The problem is that due to the interpolation, you can actually SEE the re-positioning, rather than it just appearing instantly on the other side.   In my fixed update, it just checks...   if arrowPos.x > screen width, set it to 0.  If arrowPos.x < 0 set it to screen width.   I am new to using an interpolation such as this, so I haven't had to deal with this sort of behavior before.   When the ship gets to the screen width, do I set ALL of them to 0?  Current Position, Previous Position, and Rendered(interpolated) Position?
  5. I've been working on a personal 2d HTML5 Canvas engine, and I am trying to implement Glenn Fiedlers fixed time step algorithm: http://gafferongames.com/game-physics/fix-your-timestep/   I have read through these other examples of how Box2D did it: http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d http://blog.allanbishop.com/box-2d-2-1a-tutorial-part-10-fixed-time-step/   The problem I am having is that objects don't wrap around the edges of the screen properly.   For example, if I have a scrolling background, and the position gets to greater than 800, and I want to wrap it back around to 0, you can see it visually moving there, rather than instantly appearing.   I am thinking, perhaps i don't know the proper way to implement this awesome algorithm.   Here is a basic pseudo code of what I am doing...   function update(){   // code to determine time passed, etc    while (accumulated >= TIC) {   resetSmooth();   fixedUpdate( TIC );   accumulated -= TIC;  }  ticLeft = accumulated / TIC;  render(ticLeft) }   function resetSmooth(){  renderPos = oldPos = currentPos; }   function fixedUpdate( dt ){  oldPos = currentPos;  currentPos += velocity; }   function render (ticLeft){  smooth = 1.0 - ticLeft;  renderPos = (currentPos * ticLeft) + (oldPos * smooth) }   The smoothing is awesome, but it is just the wrap around warping that I need help figuring out.  Also, in my collision detection  and what not, do I use currentPos, oldPos, or renderPos ?   Thank you for any help, and here is a quick demo of what I am talking about:   http://www.buff.bunzaga.com   It works in IE 10.0.4, Moz 20.0.1, and Chrome 26.0.1410.64 m
  6. I have a grid of nodes, which contain a list of neighbor nodes.  I wanted to create a FindPath function, with a Start position and a Goal position (both 3d Vectors, using X and Z, UP is 0).  I can easily get the nearest node to start, and the nearest node to goal, but I wanted to also make sure these nodes are in the direction the unit would be travelling.   For example, I don't want the unit to go AWAY from the goal, and then back track toward the goal, because the 'nearest' node to him was behind him.  I'll supply a picture to make more sense.     So in this picture, you can see the 'nearest' nodes to start and goal are where the red X's are.  Start is where the spider is located, and goal is where the black arrow is pointing.  You can see, the nearest start node, is actually in the other direction of the goal, where the yellow circled one is in the direction of the goal, even though it is further than the 'nearest' one.  The same goes for the nearest goal node.   I may be making this harder than it needs to be, but I can't seem to figure out the proper maths involved to get the nodes circled in yellow as 'start' and 'goal' nodes.   Here are the things I know:   startVector goalVector distanceFromStartToGoal   I need to use this information, while iterating throughout the list of nodes to determine:   startNode goalNode   While iterating, I can figure out:   nodeDistanceToGoal nodeDistanceToStart   So using all this information, I need to determine nearest node to startVector and the nearest node to goalVector, which are also in the direction from start to goal.   Any ideas?
  7. Thank you for the feedback guys.   I did want to do something like a rogue-like, so I'll check it out for sure.
  8. The game is meant to be developed for portable tablets, specifically the Android.  It is an RPG dungeon crawler style game, using 'rogue' like dungeon generation.   I am debating between two control schemes for mobile devices. 1. Taps and Swipes: Game mechanics, such as movement, attacks, etc would all be handled through tapping and swiping the screen. 2. DPad + Buttons: Movement and actions would be performed using a DPad icon in the lower left corner, and 2-4 buttons on the lower right corner.   The second opinion I am interested in is for overall gameplay. 1. Turn Based: The user would be able to move around the level freely, until combat begins, at which time combat would go into a turn based mode.  The enemies would have a turn to move and attack, then the user would have a turn to move and attack.  Initiative would be random. 2. Real Time Action: The user would be able to move freely around the level, combat would be handled in real time.  Basically, the user would enter a room and start hacking and slashing.   I would appreciate any feedback about these topics.  The engine I will be using is Unity3d.  Thank you in advance.
  9. Thanks slicer4ever, that is a good idea about setting them to null for error checking.
  10. In [b]Javascript[/b], if I know a variable type, but not necessarily the value, is it better on memory or run-time performance to instantiate it with a 'dummy' value, or is it better to just leave it undefined, and then only instantiate it when it is first needed? For example... var array1; var number1; var string1; /* vs */ var array2 = []; var number2 = 0.0; var string2 = ""; // later in code... function onInit(){ array1=[1,2,3]; array2=[1,2,3]; number1 = 3.142; number2 = 2.718; string1 = "Hello"; string2 = "World"; } Is it best to fill the variable with a dummy 'type' or just leave it 'undefined' ?
  11. slmgc, From what you are describing, it sounds like you are putting your actions into a queue or list of some sort, is that safe to assume? Then when you 'remove' or cancel the action, it removes only the one associated to that set or index. It is an interesting approach, it sort of turns duplicate actions into unique actions via your indexing (set) system. Thank you for sharing that with me.
  12. You had it right the first time nobodynews, it looks like the integer approach will be what I'll go with. Daaark, you hit the nail on the head with your example. Say I do have both a pen and a mouse attached (for some crazy reason). I want to be able to take either a pen movement or a mouse movement, and apply both to the same action, but when one stops, and the other does not, I need a way to determine that: 1. The pen stopped. 2. The mouse is still moving. 3. Reflect this within the game. By using nobodynews example, it would go something like... 1. Start moving mouse along the positive x axis, the mouse_px event will be triggered with a '1' value passed in (just as an example). 2. The px_axis_int will be incremented by +1. 3. Start moving pen or finger also along the positive x axis, the pen_px or finger_px event will be triggered with a '1' value passed in. 4. The px_axis_int will be incremented by +1 for the pen and or finger. Since all three of these actions 'mouse_px', 'pen_px', and 'finger_px' are tied to the same event... uh... 'move_right', lets say... dVal.x = 1.0 So now the character starts moving along the x axis. Now say I stop moving the mouse, I'll have to set px_axis_int -=1, then check if (px_axis_int == 0){dVal.x = 0.0}. I would do this for each input assigned to this action. Unless someone has a better way to accomplish this? Of course these are just obscure examples, but I just like to cover all my bases... Most people wouldn't assign 'W', 'Up Arrow', 'Right Mouse Button', 'Joystick Button 8', all to the same action, and use them interchangeably, but 'what if'? I just want a system that works for whatever the user wants to end up doing...
  13. I am trying to put together a thorough input system, and I can't seem to work it through in my head (or in code). Say for example, I want to use x number of keys, or mouse button(s) or joystick button(s) to perform a single continuous action, for example 'running forward'. I can handle gathering the input, and I can handle associating the event with an action, but what I can't figure out, is the best way to cross-check for the current state of the 'other' inputs. For discussion sake, lets say a key event would be something like... 'key_space', 'mouse_1', 'joy_1', followed by the appropriate data, such as 'true', 'false', .0121, etc. So say I bound 'key_w', 'key_up', as well as 'mouse_2' to the action 'forward'. So now if I press either of those keys, or the right mouse button, the 'forward' action will happen, meaning, the player will run 'forward'. So now say I press all three, this works fine, because they all do the same function. But what happens when I let go of the right mouse button? In code, it would send through a 'mouse_2' event with the data 'false', which should cause the player to stop moving forward, unfortunately, both key_w, and key_up, are still down... Is there any way to tackle something like this? Where I could have (n) number of inputs to handle a single thing like this? I know if I have a finite number of options, I could just check for the state of the keys when the 'up' event occurs... if(false == keys_w){/*stop*/}else{/*keep going*/} I thought of using an integer for this, but that just seems sloppy... Like if I press key_w, held_amt++, if I press key_up, held_amt++, if I press mouse_2, held_amt++. Then when I release one of them, I do held_amt--, check if it is equal to zero, and then if it is, stop running... I don't know, this just seems very sloppy to me. On top of this, say I pressed forward, then back, then a different forward key. I would want it to respond properly to the currently held down keys, all of which could be reassigned and the amounts of them could be 1 to n. Please help if you can! [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] By the way, I have already read through [url="http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games/"]http://www.gamedev.n...stem-for-games/[/url] which was informative and helpful, but it doesn't cover my issue. I have also tried looking up anything I can find in google, as well as on these boards, but most of them have to do with the lower level logic of how to just get multiple sources of input, rather than the higher functionality of how to orchestrate it. EDIT: The only other method I was thinking of was polling the state of each potential input onUpdate, but I wanted use a callback system instead, onKeyChange... onKeyUp / onKeyDown type of thing.
  14. [quote name='BeerNutts' timestamp='1349122894' post='4985858'] If I were doing this, I would have a Towers XML file which defines the towers with image/animations, cost, upgrade costs, and weapon type(s). I would then have a separate weapons xml file which defines all the weapons a tower can use, what it's upgrades do, the image/animation, etc.. In code, I would have Tower be an component of a Tower entity,and also contain a Weapon Component, which defines the weapon it uses. When it's time for the tower to fire, it generates a new entity which is defined by the weapon. [/quote] Brilliant, I hadn't thought of doing it that way. Thank you all for responding, by reading through these responses, I am starting to see the 'bigger picture'. ddn, I like that way of thinking: instance vs composition. I really do feel like the data driven way of doing things fits in well with my own mentality, and like PaloDeQueso said, I'll just have to stop thinking about it, and start working with it for it to truly become natural. Any other advice or insight is welcome!
  15. I have been programming for a few years now, self taught for the most part, and have been able to understand quite a bit on my own, but I am having a hard time wrapping my brain around a 'proper' data driven architecture for game development. For a while now, I have been sort of moving in a data driven direction, subconsciously, but have only now recognized it for what it is, and would like to learn more about it, and take full advantage of using a data driven approach. For example, say I am doing a tower defense game... From what I understand about the data driven approach, I would essentially have an array of entity ID's, which other tables would reference for the individual 'data' pertaining to each entity. I would then have methods which I would use to manipulate this data (separate from any 'Object')... What I don't understand... is what about the finer details? Like say I have a Poison Tower, which does AoE damage per tic. Then I have a basic Pea Shooter, which shoots a strait bullet at the 'oldest' creep x times per second. Finally lets say there is a Snare Tower, which will slow down creeps within a set radius around the tower. So obviously there is common 'data' between these towers, such as x/y position, active/inactive, radius of influence, price to purchase, price for upgrades, etc. This 'common' data could all be managed using the same methods, but what about the more uncommon information? Do I create a separate method for each individual tower type, or do I use a switch to determine the type, and handle the 'special conditions' within the main method? From an OOP approach, I would create a base Tower Object, and derive each new tower type from the parent, using overloaded functions, or adding additional functions if needed. To be more specific... When every tower is created, the user needs to decide on the X, Y position, probably with a mouse or finger. Every tower needs this, so it would go in the generic 'tower creation system'. When the user buys an upgrade, the data can be taken from the table, and it is the same for every tower. On the other hand, when it comes time to scan the oldest enemies in the towers radius of influence, and then deciding on if it should shoot a bullet, apply a poison, or reduce speed... is this handled by the same system, or should I create a separate system for each TYPE? What about in games where there are SEVERAL different types of enemies... Does each enemy type need its own 'system', or do I just make one big system, and use a switch to manipulate the data appropriately? I really like the data driven approach, and like I said, every time I would write individual onHoverBegin, onHoverEnd, onClick, etc for each button in my UI, I would always tell myself... "There has to be a better way for this". Now I realize a data driven system is exactly what I was looking for, now I just need a bit of help understanding it on a 'personal' level. Thank you in advance. Yes, I have used google, as well as the search field on this website, but if you can find something I missed, I am more than happy to check it out!