SDL-Demos (mostly for developers) - (24. March 2007)

In order to help Delphi and pascal developers getting started with the Newton Game Dynamics Engine I wrote some demos that come with full source code so you can see how different things can be achieved when using Newton.

The demos use the Simple Direct Medialayer so that, when using a cross-platform pascal compiler, you can use Newton with all operating systems that are supported by Newton itself (currently Windows, Linux and Mac) .

What you need to compile and run them :

  • A compatible pascal compiler, tested with Free Pascal 2.0.0 and Delphi
  • The Newton headers.  Choose the headers depending on which version of the demo you want to compile. The demos that use 2.00 work with the beta headers.
  • Pascal translation of the SDL-headers, called JEDI SDL
  • Newton’s shared library for your operating system, included in the Newton SDK, placed somewhere where the application can find it
  • SDL’s shared library for your operating system, placed somewhere where the application can find it
Newton SDL 01 01 – Basic Demo
This is as basic as it can get. If you want to get into the usage of Newton, take a look at this demo. It shows how to create some spinning boxes and also shows you how correct physics timing is done using “accumulative timeslicing”.

zip Source (Newton 1.53) (2331 Downloads)
zip Source (Newton 2.0) (199 Downloads)
Newton SDL 02 02 – Joints Demo
This demo shows off all different joint types that Newton has to offer : Ball and Socket, Hinge, Slider, Corkscrew and the universal joint. It also shows how to use newton’s raycast-functions to grab and influence bodies. Also shows how to display debug lines for physics.

zip Source (Newton 1.53) (1527 Downloads)
zip Source (Newton 2.0) (119 Downloads)
Newton SDL 03 03 – Vehicle Demo
This demo shows how to use the vehicle container in Newton. It isn’t looking pretty, but the source is fully documented and it should be easy to get vehicles to run in your own applications.

zip Source (Newton 1.53) (1512 Downloads)

No Newton 2.00 source yet. Vehicle functions are missing from current NGD 2.xx beta!

Newton SDL 04 04 – Buoyancy Demo
This demonstration shows you how to implement fluids (and similar things) that bodies are immersed in using newton’s buoyancy features.

zip Source (Newton 1.53) (1175 Downloads)
zip Source (Newton 2.0) (101 Downloads)
Newton SDL 05 05 – Ragdoll Demo
This demo shows the usage of NGD’s RagDoll-container to create humanoid ragdolls that bend and twist like real corpses do. The demo let’s you drop them down on an environment and also let’s you grab and throw them around with your mouse.

zip Source (Newton 1.53) (1923 Downloads)

No Newton 2.00 source yet. Ragdoll functions are still subject to change in NGD 2.xx beta!

Newton SDL 06 06 – Character Controller
When pepople think of physics engines like NGD, they first think about throwing objects around. But that’s not the only thing such a physics engine can be used for. Modern FPS-games need to have robust collisions with realistic movement and collision reaction. This is usually a hard thing to code, but Newton can easily be used to implement such a character controller. This demo shows how to do this and let’s you run around in a small FPS environment where you can even interact with some dynamic objects.

zip Source (Newton 1.53) (2047 Downloads)

No Newton 2.00. Newton now has a built-in character controller!

RSS feed | Trackback URI

11 Comments »

Comment by Stefan Nagel
2007-05-05 21:06:15

great and solid code! (much better than ode:)
and… easy 2 use!
keep it on sascha!!

 
Comment by mrBrown
2007-05-24 19:58:48

Nice work!
The second example (Joints demo) produces an acces-violation when I press the left mouse button. Both the shipped .exe and .exe I compiled using Delphi 7 give this error. Newest stable versions of all required .dll’s in use (just started with newton :-) ).

 
Comment by Sascha Willems
2007-05-31 12:57:22

There seems to be a conflict between the demo and the most recent newton.dll (the one used while writing the demos was an older one) as I also could reproduce this. I’ll see what causes this and update the joints demo.

 
Comment by Matthew
2007-09-28 11:45:00

hey Sascha
did you write these programs in C++ and make it compatable with many compilers? or did you write them in delphi?

 
Comment by Sascha Willems
2007-09-28 14:13:29

I wrote them with Delphi, so they’re pascal. I also tested them with FPC, so they work with the most widely used pascal compilers. No C/C++ involved in there, everything on this page is either written with Delphi or Free Pascal.

 
Comment by Matthew
2007-09-29 09:04:07

ok thanks and good job, all of this stuff is pretty impresive :)
keep it up

 
Comment by Matthew
2007-09-29 09:13:04

oh and 1 more thing, do you know of any tutorial anywhere that teaches how to do the code in delphi, because im quite fluent in delphi but have no idea what is happening when newtonphysics comes into play. did you teach yourself?

 
Comment by Xander
2007-12-20 19:05:36

Hi Sascha,

I took a look at the source of your Joints Demo and found the function (procedure in Delphi :-) ) PhysicsApplyPickForce.

Could you please explain how this proc does what it does?

Thank you very much,

Xander

Comment by Sascha Willems
2007-12-22 15:09:00

That procedure is nothing special. It applies a (non-limited) spring-force between the attachment point on the body (that’s the point where you grab the body) and the viewer’s position. If you need more information, refer to the newton forum, there are plenty of threads on how to apply spring forces (basically it’s just “Fs = -k*x”).

 
 
Comment by corpsman
2009-08-19 07:22:23

Hi Sascha,

i tried to compile your “01 – Basic Demo” but it seems to be in the old Newton version.

I now use Linux, and have to use Newton2.0

could you please, update this “demo” so that i can see what is necessary to get things under nweton2.0 done ?

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

All content and images are copyright© 2001-2010 by Sascha Willems
4 online / 399918 total Powered by WordPress
Impressum