Kevin Vance - LJ sure is quiet. It's like everyone picks up and goes somewhere on…

Entries | Archive | Friends | Friends' Friends | User Info

05:51 pm

Friday, September 14th, 2001
Previous Entry Share Next Entry
LJ sure is quiet. It's like everyone picks up and goes somewhere on friday nights or something :P

Did some more spacegame stuff. Wrote some notes on how collisions should work. If I had my old physics notes, I wouldn't have had to :P Realized that spacegame wasn't actually calculating velocity, so now it does. I even added a starfield in the background so you can tell how fast you're going. Position still isn't calculated, though :)

I'm beginning to ph33r collision detection. Especially in spacegame where ships are rendered as textures on squares that OGL rotates as necessary. Hopefully I'll find some answers by poking around in the Chromium source.
Link )Reply )

Comments
[User Picture]From: techpimp
2001-09-14 06:20 pm (UTC)

I assume your world is 2D.

Try just making a circular bounding box.

In SubSpace, they got away with it because the ships were generally round-shaped, and it just worked.

If your ships are going to be very crazy-shaped, well... you might try 2 or even 3 bounding boxes (again, circular in shape, just chose three points & three diameters that cover things well).

KISS
(Reply) (Thread)
[User Picture]From: kvance
2001-09-14 06:34 pm (UTC)
I'll have to try it. My ships aren't drawn yet (except for the crappy example one), so it could work.
(Reply) (Parent) (Thread)
[User Picture]From: axiem
2001-09-14 08:39 pm (UTC)
...why not just calculate position then d/dx (or dt or any variable) for velocity and acceleration?
(Reply) (Thread)
[User Picture]From: kvance
2001-09-14 08:56 pm (UTC)
Because acceleration is constant for a given ship? I don't understand what you mean.

Some pseudocode:

start loop {
calculate (things);
time = how long we were calculating things;
if player is thrusting {
player.velocity += player.acceleration*time;
}
player.position += player.velocity*time;
}

How are you suggesting it should be done?
(Reply) (Parent) (Thread)
[User Picture]From: axiem
2001-09-14 09:01 pm (UTC)

Re:

your way seems better. I'm not thinking in terms of computing, I'm thinking in terms of physics/mathematics. My mistake.
(Reply) (Parent) (Thread)
[User Picture]From: kvance
2001-09-14 09:23 pm (UTC)
Ah. Yeah, I've never had to use calculus in programming anything yet...
(Reply) (Parent) (Thread)
[User Picture]From: jzig
2001-09-14 11:17 pm (UTC)
I actually got halfway through a physics engine for the equivalent of spacegame (Death Squadron whoo!), and i would recommend circular bounding boxes. They're easy to check, too. Save the radius as the square of the value you want, then find the square of hte distance. Compare values. That way, no square roots involved. I wrote up some hackish code for automatic zooming of game field, and there are stars and the beginning of a working particle system :P Anyway, search for deaths on sourceforge. (It's written in clanlib, which is sorta like sdl)
(Reply) (Thread)