• entries
    743
  • comments
    1924
  • views
    580070

Grids

Sign in to follow this  
Aardvajk

88 views

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.
Sign in to follow this  


4 Comments


Recommended Comments

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.

Share this comment


Link to comment
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]

Share this comment


Link to comment
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.

Share this comment


Link to comment
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]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now