Grids

Published August 16, 2007
Advertisement
Got a loose grid system working now to cull the collision detection tests needed. As well as the advice here, I found the N Tutorials quite helpful.

At the moment, everything is still brute force checking against the map polygons, but only checking against each other if they are in the same or adjacent zones on the map.

I've also stopped trying to render anything that is off screen. Direct3D's clipping seems hard to beat manually, but by doing a simple vector-vector distance check before calling the rendering routine, I save doing all the manual transformation and rotation. Don't tell anyone I'm doing this manually though, as they'll probably shout at me.

With all the new optimisations in place, I had a thousand planets spread over an 8000x8000 pixel area all colliding with the map, the ship and each other with no drop in framerate. Win!

Obviously if they are more densely clustered, the framerate suffers, but I don't really see a solution to that. Since the game is doing frame-rate-independant movement, the worse that can happen is that the animation goes a bit choppy.

Might look into using the Direct3D transformations rather than my own (using sinf(), cosf() et al) to see if they are any quicker. I guess they probably are since I assume they are done on the graphics card.
Previous Entry Good news
Next Entry Polygons
0 likes 4 comments

Comments

jjd
RE dealing with clustering. Grids work well when the objects are evenly distributed in space. Neighbourhood lists work well for clustered objects. However, I seriously doubt it is worth the effort of using them for what you want to achieve. In any case, I have some experience using them, so if you do decide to try them out give me a yell.
August 17, 2007 07:38 AM
OrangyTang
Those vector levels look really cool. I'm in the middle of writing a vector-based level editor myself - for some reason theres about a billion tile-based map editors but no vector based ones - so I'll be keeping an eye on yours to pinch ideas. [grin]
August 17, 2007 11:27 AM
Aardvajk
Quote:Original post by OrangyTang
Those vector levels look really cool. I'm in the middle of writing a vector-based level editor myself - for some reason theres about a billion tile-based map editors but no vector based ones - so I'll be keeping an eye on yours to pinch ideas. [grin]


Gets weirder [smile].

Everyone round here seems to have independantly started writing polygon/vector based level editors and games at the same time. HopeDagger, SirSapo, Programmer16, me and now OrangyTang.

Mine is going to slow a lot now. See latest journal entry.
August 17, 2007 12:45 PM
OrangyTang
Freaky, I didn't know that, it'll be interesting to see how they all develop. I suspect everyone will end up with a completely different focus and feature set. [grin]
August 20, 2007 07:10 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement