PDA

View Full Version : Blitz: Easy Car Physics?


diordna
2004.12.04, 08:13 AM
I'm writing a 2D game that involves the player's care and maybe 3-8 other cars. I need them to drive like real cars, without making my head explode. I couldn't follow the sites on the links page. Any help?

Remember, high school sophomore here. Haven't had an insane amount of math.

ThemsAllTook
2004.12.04, 11:20 AM
This page looks good: http://home.planet.nl/~monstrous/tutcar.html

- Alex Diener

Nick
2004.12.04, 12:19 PM
diordna, I tried using that website but it was hard for me to code out what needed to be in there, so if you do figure it out, could you perhaps let me see how you did it? It would help me out a lot.

diordna
2004.12.04, 12:51 PM
Yeah, that's one of the pages that lost me, sorry Alex. I might just hack something together.

phydeaux
2004.12.05, 12:51 PM
Depending on what you're going for, you can probably fake 2D car physics by just having spaceship physics combined with a continual reduction in velocity (that is, you have two keys to rotate the car left and right, and one key to speed the car up, like a spaceship, but the car would continually be slowing down.) You could add a slight bit more realism to this model by continually changing the velocity of the car to the direction the wheel is pointing.

diordna
2004.12.05, 01:57 PM
Okey dokey, without any help from those pages and using only 86 lines of BlitzMax code, I have come up with this:

http://diordna.macintoshdevelopers.net/FlocksEntry.sit

The question here is not whether or not it's realistic, it's whether or not it's realistic enough to work *for a game.* Don't nitpick please :)

Shivers
2004.12.05, 02:10 PM
while it isn't "realistic" persay (but then...what is realistic?;)), it does have a nice arcadish feel. You need to add in some friction so the car won't keep moving at the same speed forever.

diordna
2004.12.05, 02:23 PM
Huh, looks to me like somehow my post got moved down...anyway...

In case I didn't already say this for newcomers...ASDW/Space. WS control speed, space brakes.

I really don't like the hold-to-accelerate-let-go-to-slow-down because then you have to keep tapping it. I really like this right now because you can control how fast you go, and the faster you go the less control you have. I'd like to have both, but that would require me having some sort of gas pedal device which, unlike keyboard keys, has more than just an on/off state.

Any thoughts on how to do both?

ERaZer
2004.12.05, 02:33 PM
Instead of controlling your speed in a similair way of Elite, I would use an accelerate button. The longer you hold it, the faster it goes, I think it will feel much more like a car then.

Steven
2004.12.05, 02:49 PM
Definitely go for the acceleration/friction. But it does feel pretty nice, with the whole swinging back end thing.