PDA

View Full Version : Newton2D physics engine



Luuk van Venrooij
12-08-2010, 10:43 PM
He all,

Here is a little project I have been working on on vacation.

Inspired by this thread:

http://www.pascalgamedevelopment.com/forum/index.php?topic=6096.0

Using this tutorial:

http://www.gamedev.net/reference/programming/features/verletPhys/

A little 2D physics engine. Its verlet based and is the interface is modelled after the newton game dynamics physics engine.

Currently features:
- Collision and collision responce between Convex bodies
- Applying forces to the bodies.
- A sandbox to play arround in:)

Planned Feature:
- Optimise collision by adding a quadtree
- Add raycasts
- Add saving and loading of the world state
- Add collision callbacks
- Add materials with friction
- Add springs
- Add joints
- Add collision catagories
- Add support for MacOS, Linux and mayby android?
- Add optimised particles using spheres. Could also be used for fluids
- Extend the sandbox with new features
- Create a simple multiplatform game using sdl

Here is a little movie of the sandbox:
http://www.youtube.com/watch?v=bw0k-YniJEU

And of course the download:
http://www.genesisdevice.net/Newton2D-0.2.zip

See the readme for more instructions on how to use the sandbox.

Grz,

Luuk

Hadron Games
13-08-2010, 01:15 AM
Sweet!

WILL
13-08-2010, 06:21 AM
Very cool. :)

chronozphere
16-08-2010, 01:15 PM
Freaking awesome. I'm going to look into those sources. :yes:

Luuk van Venrooij
16-08-2010, 06:49 PM
Thanx guys :)

Just released a new version 0.21. Did some major cleanup in the source and made and improved speed a little bit.

The 0.3 release will add joints and optimised spherical collisions for particle systems etc.

Download the 0.21 releas here:
http://www.genesisdevice.net/Newton2D-0.21.zip

Hadron Games
17-08-2010, 12:33 PM
I've been talking to Luuk about Newton2D, and I'm planning on integrating it as the core physic subsystem in HGE. Luuk is doing a great job with it and I'm blown away at the power and simplicity of the interface. Hopefully by release 0.2.0 or 0.3.0 of HGE I can get basic physics integrated.

Luuk your planned feature set looks good. I'm especially needing Collision callbacks and joints at the moment.

Good work my friend, good work. I encourage everyone to give it a try, it's shaping up to be a great little physic engine written in our favorite language. 8)

paul_nicholls
17-08-2010, 10:30 PM
Very nice Luuk!

Awesome...keep up the great work as always :)

cheers,
Paul

Hadron Games
17-08-2010, 11:00 PM
@Luuk
I'm trying to better understand the timing in N2D. In HGE I'm using frame-based timing and trying to see how to use it with N2D.

In HGE, there is a ElapsedTime value that controls the object speeds. It's value is based on the desired simulation rate that when multiplied aginst the objects speed will keep them moving at/near the desired simulation rate. It will not be the same value that is passed to Newton2DUpdate. I think I will need to convert it to a value that this routine expects.

Can you explain a bit how your timing works so I can get a better idea how to convert my timing value to what N2D will be expecting.

Thanks.

Vinzvega
18-08-2010, 07:25 PM
Hi Luuk !

Nice work ! Althought the sandbox is flickering on my computer (If I m alone, it's time for me to change my beast), I look the source : very elegant and very short for compare to the duty made !

Nice work really !
Your vacation seems to be rainy :)

Did you work always on your 3D engine ? I look sometimes to your site with hope :)
the beautiful grass enabled lands of the first GenesisEngine miss me :)

hope read you soon !

virtual
21-08-2010, 08:33 AM
great work , thnx for sharing

i'd like to know if the operator overloads such as + * / would increase vector math performance !!

User137
21-08-2010, 09:14 AM
Operator overloading is just a different way to program, it can't effect performance.