• entries
  • comments
  • views

First demo

Sign in to follow this  


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


Recommended Comments

Original post by Gaheris
I can has respawnz with teh space bar!!1

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

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.

Share this comment

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

Share this comment

Link to comment
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 :)

Share this comment

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

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