# Simple grid good structure?

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

## Recommended Posts

Hi!

I have a little 3D game world with a 45 Degree bird eye view camera (kinda like the SNES Zelda games: http://nocjoz.de/blog/wp-content/uploads/alinktothepast.jpg ). But my worls if fully 3D.

The world is relatively small (maybe 10 screens) and I have a lot of picking (the user can select trees, stones etc).
Actually I wanted to use a simple 2D Grid for collision detection and an AABB quadtree for culling. But the more I think about it, the more I tend to use the 2D grid for everything (collision, culling and picking). Since I need it for collision I have it anyway and picking can also be done in the 2D grid (all I need to do is checking which cells are intersected by the picking ray. Kinda like bresenham I guess).

Do you think its a good idea for my game to skip the AABB quadtree all together and use a 2D grid for all tasks (frustum culling, picking and collision)? If yes: Do you know an algorithm/paper that describes how I can detect the cells my ray is intersection? How could I do frustum culling with my grid in a good way? I thought about projecting the corner points of the camera frustum into the grid and then determine which cells are intersected by the 2D frustum. Good/bad idea?

##### Share on other sites
It's not an unreasonable approach at all.

" How could I do frustum culling with my grid in a good way? I thought about projecting the corner points of the camera frustum into the grid and then determine which cells are intersected by the 2D frustum. Good/bad idea?"

Depends on your camera angle; it may select a lot of cells in the distance. But generally, doesn't seem like a bad plan.

One of the crucial decisions is what size to make your grid. Too big and you'll have too much stuff within the squares to sort out. Too small and you spend too much time doing those frustum/square intersection tests. This is the problem that a full quadtree is designed to solve. If you can get a good compromise between those sizes for your particular application, no reason why it won't be a good solution.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634112
• Total Posts
3015580
×