Large objects in a uniform grid

Started by
1 comment, last by zqf 12 years, 4 months ago
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?
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.
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

This topic is closed to new replies.

Advertisement