## Physics tutorial

Michael
Unregistered

Post: #1
Hello all. The seveal threads here on game physics made me start thinking that what this site really needs is a physics tutorial... I've put together a simulator which models the sort of physics that would be used in several different genres:

Platform games
Cannon / projectile games
Space games (EV, etc)
Billiards / pool table
etc.

The simulator (still rather rough around the edges) can be downloaded from:

http://www.stolaf.edu/people/zahniser/physics.sit

My questions are:

1) are there other sorts of physics that this should model?
2) can anyone suggest your "favorite" algorithm to do collision, etc.?
3) Does this program run natively under Mac OS X? I build it from a "Carbon Toolbox" Codewarrior project, but I'm not sure if that automatically means it will run in OS X or not... I'm woefully ignorant of all things Carbon.
4) Any other feedback?
Member
Posts: 201
Joined: 2002.06
Post: #2
It runs natively, but runs incorrectly. It doesn't stop loading/booting/whateveryouwanttocallit. It shows a window but shows an "animation" that starts in the upper left corner regardless of the window's position. There are three colored calls. If you click and drag below and to the right of one of the balls, the other two disappear while the one does show some physics by itself. I had to force quit to get out of it.
ededed
Unregistered

Post: #3
Thats nice, quite fun too, I like the way you can change the gravitational constant. Are you drawing then doing collision or the other way round? You should do collision then graphics routines.

You might want to add stationary thick lines to your applet so ball can roll down hills. Check if the radius of the circle + the thickness of the line is less than the perpendicular distance from the center of the circle to the line. It's fun to thow a ball down a hill and have it roll over the next hill then cause a collision on the other side...

This website has a formula for that http://www.astronomy.swin.edu.au/~pbourk...pointline/
Member
Posts: 469
Joined: 2002.10
Post: #4
my favorite collision algorithm is predictive parametrization. just requires a lot of solving with the old TI-89 :

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
ellrx
Unregistered

Post: #5
Hey, does anyone just have a site or list or plain document with formulas and and subtitles/comments.

Its all i want/need

ellrx.yahoo.com
AJ Infinity
Unregistered

Post: #6
Yeah. It's a PDF by John E. Laird. I have it on my computer. Michael, the physics demo worked only s;ightly OK on Mac OS X v10.1. I understood it, but not immediately. geezusfreek, are you on Jaguar?

Oh yeah. The reason I was asking so much about game physics is because I have a game physics science project to do for my high school science course. I'm doing a 2D sim in Flash. Actually, I haven't done the sim yet but I'm preparing to do the research paper.
ellrx
Unregistered

Post: #7
If you could send i to me i would greatly appreciate it...
Member
Posts: 201
Joined: 2002.06
Post: #8
Yea, I'm on Jaguar.
Michael
Unregistered

Post: #9
If I were to just post the source code for this tutorial and let anyone who wanted to contribute to it do so, would there be other people here who could help out? I purposefully designed the various classes to be extensible and easy to understand, and I'm guessing that a physics tutorial made by several people working together would be a whole lot better than something any one of us could design...

(Sadly, I don't have access to the code at the moment, but I can post it as soon as I get back to school after Thanksgiving.)
henryj
Unregistered

Post: #10
Sound like a damn fine idea.
AJ Infinity
Unregistered

Post: #11
geezusfreek, either the app worked fine on 10.1 or it worked the same way on 10.1 as it did on Jag. Or, I'm just really patient:-). ellrx, I emailed the PDF to you.
Member
Posts: 469
Joined: 2002.10
Post: #12
So it's not just me who has assloads of compiling problems from missing headers to missing system resources? Seems like tons of stuff compiled fine on my 10.1 system and then when I try on 10.2, everything goes to hell. Further investigation led me to all kinds of headers and system includes that apple grandfathered in 10.1. Heck I even have problems with a lot of the stuff from developer.apple sample code. It bothers me so... I guess my biggest gripe would be how they jenked up the HID manager. My SNES9X won't recognize my gamepad anymore!

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Darkgold
Unregistered

Post: #13
Hey AJ
Could you email me that pdf too?
E-Mail Me :-)
Michael
Unregistered

Post: #14
OK, I've got the code that I've written so far commented and posted at the following url (as a Codewarrior project):

http://www.stolaf.edu/people/zahniser/phys.sit

Could some of you physics-inclined types take a look at that code, suggest some functions to add, etc.?
Member
Posts: 156
Joined: 2002.11
Post: #15
...so, it would be nice if you could post another version for Project Builder as well.

Time is running out!