First demo

Published August 14, 2007
Advertisement


I'm posting up a demo now more as a proof of concept and for some ideas feedback.

Demo is HERE.

[EDIT - updated demo to frame-rate-independant version with lots more globes]
[EDIT - updated demo - teh globes has now spinzzz]

Left and right to turn, up and down to move forwards/backwards. And since I'm always asked about this, press Alt+F4 to quit!

You can play pool shots with the planets. That is all at the present time.

Apologies for the appalling graphics. Hopefully these will improve with time.

[EDIT] These polygon intersection tests are expensive. Thought the project was sunk until it occurred to me to generate minimum axis aligned bounding boxes for all of the map blocks at startup, and a AABB for each object after it had been rotated, and then do a simple bounding box intersect test first for each pair and skip the more complex polygon intersection test if it failed:



That's 100 globes and the ship all bouncing off each other and the map walls with no drop in frame rate on my fairly low end PC (2.3ish Gig single core) with an onboard graphics card.

To be honest, it was really good fun sorting that out. I'm used to finding limits that I can't really do anything about since graphics fillrate and so on have always presented problems long before anything I could actually optimise on previous projects.

Still some improvements can be made. I'm convinced that my boundbox intersect test is non-optimal, I only need to regenerate boundboxes for objects whose rotation has changed since last frame and I'm sure that there must be a way to divide the map up into regions to reduce the number of checks needed.
Previous Entry No screenshots
Next Entry Good news
0 likes 8 comments

Comments

Gaheris
I can has respawnz with teh space bar!!1

Nice, but a bit hard to maneuver at full speed. :-D
August 14, 2007 07:56 AM
Aardvajk
Quote:Original post by Gaheris
I can has respawnz with teh space bar!!1


Well spotted. You win today's teh Roxor award.

Quote:Original post by Gaheris
Nice, but a bit hard to maneuver at full speed. :-D


Yeah, I'm not too happy with the main ship control either. Needs a bit of tweaking.

Thanks for the comments.
August 14, 2007 10:16 AM
jjd
You aren't doing pair-wise tests among all of the objects are you?
August 14, 2007 10:30 AM
Aardvajk
Quote:Original post by jjd
You aren't doing pair-wise tests among all of the objects are you?


Um, well, yeah (ducks head in embarassment).

I appreciate that this gets ridiculously expensive very quickly, but I can't think of a way round it.

My problem with moving everything, then doing a single run through to check for collisions is that when I find a collision that way, and seperate the two offending items, one or both of them in their new positions could now potentially intersect an object that has already been tested in this run through.

I don't understand how to get round this. If you can suggest anything, it would be appreciated.
August 14, 2007 10:37 AM
diablo_tk
Cant try it out right now but the screenshots remind me of the bouns levels from Sonic.
August 14, 2007 11:22 AM
Drilian
So, for Mop of Destiny, I had divided the world up into zones (basically just a grid system, each level was M x N grid squares (the grid square size was designed so that the largest boss would be able to fit within one square so that no single entity would EVER be in more than 4 squares at once) ) and used circles to determine which grid square(s) a given enemy (or player) was/were touching. Then I only had to do collision tests versus the enemies in that particular set of squares.

And they started as aabb vs. aabb tests before becoming full poly vs. poly tests (using a ton of line/line intersections plus two point-in-poly tests to check whether an object (say, one of the little bullets that some of the creatures spit) was completely contained within another (poor Mr. Scroggins) ).

That may help narrow down the collision tests, but I don't have a solution off of the top of my head for the bouncing/movement issue. It wasn't really a problem in my game :)
August 14, 2007 11:50 AM
Aardvajk
Yeah, this zones idea seems quite practical.

I'm wondering about having a grid of vectors of pointers to objects, then after each object's new position is updated, adding a pointer to the object to the relevant vector.

Collision tests can then just test against all the objects contained in the vectors of the relevant squares.
August 14, 2007 01:18 PM
benryves
Great work (tried it last night). [grin]
August 15, 2007 04:17 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement