Jump to content
  • Advertisement
Sign in to follow this  
zqf

Large objects in a uniform grid

This topic is 2544 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

I've fairly successfully created a Grid structure of linked lists for object vs object interaction, which I expanded up to include Ray vs Object and Ray vs Tile Intersection. But I'd like to have larger objects.

Quadtrees are rather beyond my understanding at the moment (and trees in general), so I was considering two alternatives:

> Additional larger Grids. At the moment the grid is 32x32 which matches the Tile grid, so a second grid of 64x64 and perhaps a third at 128x128 would cover a large set of object sizes. My main issue with extra grids however is how to handle Ray querys vs two or perhaps three grids at a time, as well as the general code of checking up and down the list.

> A parent/Child system where large objects are divided into smaller children, and these children sit in the Grid, moving with their parent and calling them if they collide with something.
This technique would presumably have a lot of overhead if a huge object is moving around, as it has to remove and insert many children, but on the other hand it could handle almost any size, particularly giant obects which would be used rarely anyway (for example, huge bosses). And handling of Ray queries would barely change.


I'm more inclined to go with the second option but perhaps I'm missing something bad about the group of little objects idea.

Thoughts/suggestions?

Share this post


Link to post
Share on other sites
Advertisement


> A parent/Child system where large objects are divided into smaller children, and these children sit in the Grid, moving with their parent and calling them if they collide with something.
This technique would presumably have a lot of overhead if a huge object is moving around, as it has to remove and insert many children, but on the other hand it could handle almost any size, particularly giant obects which would be used rarely anyway (for example, huge bosses). And handling of Ray queries would barely change.



This idea is pretty close to a tree anyway. What you would probably want to do, though, is put bosses higher up in the tree and traverse the tree from the top. If you put the boss in the parent, you should't need to put it in the children.

Share this post


Link to post
Share on other sites
put bosses higher up in the tree and traverse the tree from the top[/quote]

I can see how that works for object vs object, but how would that work for Ray tracing? The Ray is moving through the lowest grid so needs to find any solid objects on that layer

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!