Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Bouncer

2D rigid body physics

This topic is 5339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here is my 2D rb physics engine I've been working on... Now I'm just kind of testing it to see is it fast enough for game use... [EDIT] Somebody brought this thread back to life the old links were dead... so here's an updated demo www.kotiposti.net/naama/IR3_TEST.zip Milk is for babies [edited by - bouncer on May 29, 2003 4:14:29 AM] [edited by - Bouncer on December 5, 2003 10:38:16 PM]

Share this post


Link to post
Share on other sites
Advertisement
My God! Very nice work!
I ran the stress test, and i must admit that i am very impressed! The simulation is very stable, and doesn''t slow down much when the number of objects increase.

Btw, can you give any hints about what methods you are using?
Is your method possible to expand to 3d?

Share this post


Link to post
Share on other sites
Simulation is based on Thomas Jakobbsen''s article "Advanced character physics". Objects are made from constrained particles and a mesh is attached to them. Verlet integration is used. Collision detection for now is sphere to sphere and sphere to line.

This is basicly the same kind of system as used in Hitman. So this kind of system is usable in 3D also.

Share this post


Link to post
Share on other sites
Did you have to do a lot of "kludges" or hacks to get it this stable, i've read the postmortem of hitman, and they talked about how they had to make lots of tweaks and hacks to get it looking realistic.
Have you tried to stop the spherical objects to stop oscillating with friction or something?
What type of game are you planning to use it for?

Im guessing that you're not using bruteforce O(n^2) collision detection.. so what kind of algorithm do you use?

(sorry for all the questions... ;-) )

[edited by - emptyhead on May 29, 2003 7:11:28 AM]

Share this post


Link to post
Share on other sites
>Did you have to do a lot of "kludges" or hacks to get it this ;>stable, i''ve read the postmortem of hitman, and they talked >about how they had to make lots of tweaks and hacks to get it >looking realistic.

- not much hacks... but there are some problems with verlet as you propably know. Friction is one of them... which I got working pretty nice with some hacking. Elasticity is more difficult issue.. I mean controlling bouncing. If you want very realistic physics then this system is not very good. But for my purpose I just need fast and good looking system. The stability with verlet is very good... with enough iterations you never get any twitching or shaking with objects... they behave very nicely.


>Have you tried to stop the spherical objects to stop oscillating >with friction or something?

The oscillation is there for purpose... it just makes them look nicer... because the balls don''t actually roll because they are single particles.


>What type of game are you planning to use it for?

I''m using it for a very cool 2D multiplayer "deathmatch" game (side view)... not a lot can be said because I''m still working on the engine.


Im guessing that you''re not using bruteforce O(n^2) collision detection.. so what kind of algorithm do you use?

Sorted bounding boxes and sweep''n prune(modified even faster)

Share this post


Link to post
Share on other sites
You''re using a fixed timestep, and interpolating between positions for every rendered frame, right? Does that mean that you''ll have to actually store three positions:
P(t), P(t+1), P(t+2)
and use P(t) and P(t+1) to interpolate and render, and P(t+2) for the result of the "next" physics update... Or is there some clever way to avoid it, without calculating everything at once?


Share this post


Link to post
Share on other sites
Truly, truly amazing. I got about half a screen of objects, turned off gravity, blasted them about with the big wheel, then turned gravity back on. The effect of the big wheel coming back down and smashing into the smaller objects was awesome.

I have to say that I think the system would be OK for real-time apps. I ran it on a college machine (I'm supposed to be revising ), and, although it's a low-spec machine, it still ran at 40 fps with half a screen of objects. I expected it to slow down big time when I did the above-described simulation, but to my suprise, the framerate only dropped by 1 fps. Excellent work, and I'm going to look out for that article you mentioned...



Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You're Already Here | The Best Film Reviews ]


[edited by - iNsAn1tY on May 29, 2003 10:20:06 AM]

Share this post


Link to post
Share on other sites
Y'know, thinking about it, your 2D physics system there would actually make a rather impressive screensaver. Perhaps if you half-filled the screen with objects, programmed the big wheel to move around randomly (maybe bounce off the sides of the screen, or something), and turned gravity on and off at random intervals? Something to put on instead of SETI for a while



Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You're Already Here | The Best Film Reviews ]


[edited by - iNsAn1tY on May 29, 2003 11:37:16 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!