• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Pixelated_Nate
      Hello all!
      I'm currently designing a 2D, Puzzle/Action RPG, in a similar vein to Legend of Zelda: Link to The Past, in Unity and require a Programmer partner in which to work with me.
      The project, yet to be titled, will feature:
      A semi-open world, represented through pixel art, in which the player traverses to enter dungeons and advance the story. A handful of side-quests that require memorizing details and using puzzle-mechanics. A fast-paced, melee combat system that will include dodging, blocking and utilizing four different attack types that can be switched on the fly. A simple inventory of "Key Items" to be used in order to advance the story. Day & Night system and Weather Effects, with weather effecting combat.  A very simple Dialogue System to convey information via colored text. Saving/Loading via exporting and importing a physical save file. Majority of the project is already planned out, with plans to release commercially and splitting the profits equally among the two of us. 
      I would request that the applicant is able to work semi-independently, following an outline, and that they have experience in both C# programming  *and* putting those scripts to use inside Unity, whilst I will be creating the Art, Music/SFX and doing Level Design (Though if you are also comfortable in assisting me with these, I wouldn't be opposed.).
      Work will be shared in either Github or Unity Collab (Applicants preference), with communication done via Discord. 
      For more information and to apply, please contact me at nathan.jenkins1012@gmail.com
      Thanks for reading! 
    • By Just4lol
      I'm looking for my dream teammate(s) to help me work on my Unity game. I still dont know where Im going with that project but I want to make a good final product that I would be able to sell or publish it for free on Steam.  Here a video of the prototype (The only thing I dint made is the skybox) https://www.youtube.com/watch?v=y2Otmt9jRkc
      My discord : Just4lol#46982
      I want somone at least as competent as me : 
      - I want somone with at least one year of experience in Unity (already worked with scriptable object and know oop).
      - Already worked with shaders or can do editors tools is a plus.
      - Can do 3d models in Blender or can do 2d art for the ui or particles effects.
      - Can make soundtracks or sound effects a bonus.
      Im a french Canadian so mind my english I will do my best to edit any errors I see. 
    • By Damnwing0405
      I am looking for talents to form a team of making a strategy base action game. Talents I am currently looking for are : -
      (I) Unity programmer (mobile)
      (II) Game designer
      (III) 3d Artist
      (IV) SFX Artist
      The attachment is some game concept for the game. All the concept will be turn into 3d or card form. The game will be strategy game where the players can form their own team and control the units in the battle field real time to fight against each others.  If you are interested to know more details please pm me or send an email to damnwing0405@gmail.com

    • By bsudheer
      Leap Leap Leap! is a fast-paced, endless running game where you leap from rooftop to rooftop in a computer simulated world.

      This is a free run game and get excited by this fabulous computer simulated world of skyscrapers and surreal colors in parallax effect. On your way, collect cubes and revival points as many as you can to make a long run.

      Features of Leap Leap Leap:
      -Option of two themes: Black or White.
      -Simple one touch gameplay.
      -Attractive art.
      -Effective use of parallax.
      To Download the game:
      Playstore: https://play.google.com/store/apps/details?id=com.avakaigames.leap
      Appstore: https://itunes.apple.com/us/app/leap-leap-leap/id683764406?mt=8

    • By BillyGD

      Play Flick Football 3D @ https://gamejolt.com/games/flickfootball3d/326078
      Check out our Facebook page @ https://www.facebook.com/FlickFootball3D/
      Flick Football 3D is a turn based football game inspired by the table top classic 'Subbuteo'.
      The game is currently in very early Alpha development. There is still a lot to be done before the first proper release but I have decided to release this playable version to get as much feedback as possible.
      The only game mode currently available in this release is the 'Practice Mode' which gives you control of both teams. Either play against yourself to get used to how the game works or play against friends and family on the same computer!
      Planned Future Features Include:
      -Take control of your own custom team in the single player campaign.
      -Play in online leagues and tournaments against other players in the multiplayer mode.
      -Fully customisable stadiums to make you stand out from the rest of the players.
      -Improve your players stats and skills by playing matches and setting up training sessions.
      Flick Football 3D is available for Windows, Mac and Browser.
      Thank you for viewing my game, all feedback is greatly appreciated. I can be contacted at; BillyGDev@outlook.com
      'Flick Football 3D' is also the development name for the game and I haven't yet decided what the full release will be called, so if you have any ideas please drop me a message!
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Handling collision data in a (very large) node-based open world

This topic is 913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What I'm trying to achieve with this thread is a discussion regarding managing collision data in an "unbounded" dynamically loaded (and/or generated) world (that is, the game world is not really intended to be "unbounded", but can be much much larger than either single or double precision floating point would allow). I have currently no intention of taking advantage of an unbounded world, but I like the concept and frankly this is a pretty neat little general design problem. Since information on this topic is scant, I'd like to share what I've thought of so far and hope that people can point out issues with my reasoning and offer other ideas, or perhaps provide links to prior R'n'D that I may have missed.


Some background: I had to rehash my scene graph code recently, so naturally I went a wee bit too far for what I presently need and implemented a hashed node system. Despite added complexity, what I have in place now is far more extensible and more easily maintained than the messy linear solution I had before. I'd like to point out that I've added an aside at the very end of this post, in which I'm pointing out that I'm aware of the fact that I'm completely overthinking here. However, as noted above, that doesn't stop this from being a fun little exercise.


Some specifics: each location transform in world space stores a hashed node ID and corresponding node space coordinates as an offset from the node's origin. I chose not to normalize the node space coordinates. GetNodeIDFromCoordinates() and GetNodeCoordinatesFromID() convert between the node index/ID and xy/xyz coordinates in whatever spatial domain the game happens to need. Since currently NODEID is a simple int32 value, this can neatly store something like a 65000x1x65000 node world where each node can have a size of whatever floating point precision IVector3D happens to be using.

struct IWorldTransform {
  IVector3D vPosition;

In addition, each player (or rather, each human controllable character) implements what I'm calling its own "view", which extends from -n to +n nodes in each direction around the screen space portion of the world that is centered on it. The center of the screen determines the center node of the view. The required n depends on various factors, such as screen resolution and camera zoom.


A view is kind of an extended view frustum, for lack of a better term (as described in this fairly old document: The Continous World Of Dungeon Siege (link to a PDF file)), which completely encapsulates what's currently visible on screen and is always aligned to node boundaries. For instance, in my current single player game the player's view corresponds to the entire simulated game world.


Rendering stuff like this is trivial since the transformation (what ever space it is being done in) is calculated once every time a view is updated and actual vertex transformation is performed on the GPU anyway, after setting up the model view matrix using a generic TransformWorld(currentView) call. However, when it comes to managing collision data, there are several solutions I've thought of. And none are really perfect.


My ideas on collision so far:


Actually all of these are viable for what I need at the moment, but since my head is already in this, I'd like to take the discussion a bit further. You know, for fun.


Method 1: store no transformed collision data at all, only extents of bounding volumes for each object/mesh in view space (as explained above). No distinction is made between static and dynamic objects. Whenever collision needs to be tested, all collision hulls belonging to objects whose bounding volumes intersect the sweep are translated into view space and collision is performed as usual. This is the simplest method, yet allows for both temporal and spatial coherence optimizations. The thing about it is that it would work wonders for player-only scenarios, but as soon as there is a remotely significant number of projectiles or some such random crap added to the game world, the computational cost has the potential to skyrocket. Things get even more complicated when multiple disjoint emitters of dynamic objects (urr, players and mobs for the most part, that is) are involved.


Method 2: store continuously updated collision data for static objects in view space, maintain dynamic objects on an as-needed basis, as in Method 1. While this takes care of static collision data most of the part, it still means that essentially all collision data for the entire loaded world needs to be updated every time the player crosses a node boundary. Some prediction can be made to precache this data when the player approaches the edge of a node, but node corners still present a problem, since a total of three additional copies of the precached world need to be created, leading to potential gameplay lag or load peaks. In particular, fast-moving objects can really screw up performance when emitted near a node boundary. It also reeks of the likelihood that after multiple back-and-forth adjustments, floating point precision issues start to kick in and stuff like cracks start appearing between adjacent objects.


Method 3: store static collision data in node space (eg relative to an anchor in each node, which in my case is the origin at the top left corner). This allows easy caching, since no collision data need to be updated after its initial load. However it still incurs a penalty similar to Method 1 when the player or another dynamic object crosses a node boundary. For most cases this will be trivial, but doing a sweep test (even if it's just raycasting) for a projectile that travels very fast or instantaneously requires all collision data that is not stored in the node the object originates from to be dynamically transformed. With this method, handling dynamic objects in general is complicated, since as they cross from one node to another, their transform resets, making spatial and temporal coherence schemes more difficult to implement.


Of course these are all just ideas. I don't have an up and running game world to test them on, so whatever performance issues and optimizations I'm desperately trying to think of, may well be moot with real data.


That being said, that's not the end of the story, though.




Where it gets complicated is when dealing with multiple "views" - eg multiple players or several human-controllable entities that can separate from one another. The biggest impact is the memory footprint: Method 1 would scale linearly, since only one copy of the collision data exists for each static and dynamic object; Method 2 would be the worst, since in a naive approach (n * 2 + 1) x (n * 2 + 1) nodes worth of data need to be maintained P times, for each human-controllable entity; Method 3 would, again, be the most practical, since with some caching it would be fairly memory efficient and would require infrequent collision volume adjustment (although when the need arises, it needs to be performed in real time and cannot really be precalculated).


To me Method 3 is the clear winner here, but I find myself reluctant to actually implement it before doing some more digging. Maybe there's a Method 4 that I haven't thought of. In any case, I'd like to learn more about how collision is handled (that is, how collision data is stored and handled) in open world games. I've never traversed far enough, but for instance 7 Days To Die is a Unity-based dynamically generated open world game, which should eventually start to suffer from precision issues. Minecraft needs to handle a similar case, although its data set is far more simple. World Of Warcraft at least feels like it's either running on double precision or uses some kind of spatial partitioning similar to this, although my research turned up nothing. The same goes for Skyrim and Just Cause, or the estimated 39000 km2 world size of Guild Wars. Not to mention space sims that need to handle stuff on interplanetary or intergalactic scales (although I have no experience with any of those offering continuous collision detection, much less on a detailed scale). So yeah - weight in! :)


An aside: for all intents and purposes most collision in general is performed on unoriented volumes - either static meshes or simple generic volumes, such as AABBs and spheres that never rotate. For all these, adjustment from the origin to the object space that needs testing is nothing more than a bunch of floating point additions, which at the end of the day is not all that expensive. Conversely, dynamic objects that can rotate, need to be updated in real time anyway, which makes any spatial hashing of those largely moot. I have currently rolled my own collision code, but since it's fairly outdated, I want to leave room for a hopefully painless transition to Bullet at some point. However, I have no experience with Bullet, so with that particular API in mind, perhaps one of the above methods is better suited for real time performance than another. Some feedback on this would be nice as well.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement