The Newton engine is now Open source with a zlib license.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: The Newton engine is now Open source with a zlib license

Postby PJani » Tue Feb 15, 2011 3:48 pm

Julio Jerez wrote:what is contact multisampling?


in old newton 1.53 the vehicle tires had real traction(grip), but now in newton 2.xx the CustomMultiBodyVehicle tires just dont have the real grip(vehicle doesnt handle well, steering is bad, etc...), and once while a go you explained me something about contacts but my memory bled away.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: The Newton engine is now Open source with a zlib license

Postby Julio Jerez » Tue Feb 15, 2011 3:54 pm

Oh I see, well teh vehicle joint on 1.53 is in teh code, but I would not work on that.

since the engine is open source now I no longer have to put so much time in Bugm and cross plaform mombojumbo.
I can work more in getting many of teh feature that I had negleted, lke the car, the player controller,
the destruction, the soft bodies, the cloth, and few more things that I have in mind.
I will try to work on that, but thsi tiem I am wrokin then out in the editor so that they can be usable as a file format
and every one can use it, not just the people who are more experienced programmers.

yes you are right and subsampling of the contacts lead to much better physics vehavior of the tire,
In fact that was teh best secret of the vehicle joint in 1.53
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: The Newton engine is now Open source with a zlib license

Postby PJani » Tue Feb 15, 2011 4:09 pm

i cant wait for vehicle contact multisampling :P
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: The Newton engine is now Open source with a zlib license

Postby thedmd » Wed Feb 16, 2011 8:18 am

I will support Newton in my spare time. First will be Xcode projects for Mac OS X and iDevices.
In case of Windows I may be also be able to prepare builds using MinGW.
"God started from scratch too"
User avatar
thedmd
 
Posts: 149
Joined: Fri Jun 26, 2009 11:52 pm

Re: The Newton engine is now Open source with a zlib license

Postby Overhertz » Wed Feb 16, 2011 8:28 am

i've started looking though the forums looking at what some people have requested and added 1 function i also wanted added which is very useful for basic objects that require just a set force added to them each time, instead of the need of creating a procedure to be called outside of newtion... anyways i will share the update (it would be nice if there is a section on the forum to post such things... anyways

in files

newton.h
Code: Select all
NEWTON_API void  NewtonBodySetConstForce (const NewtonBody* body, dFloat x, dFloat y, dFloat z); //Colin Stewart - 16.02.2011


Newton.cpp
Code: Select all
//Colin Stewart - 16.02.2011
void NewtonBodySetConstForce(const NewtonBody* bodyPtr, dFloat x, dFloat y, dFloat z)
{
   dgBody *body;
   body = (dgBody *)bodyPtr;

   body->SetConstForce(dgVector(x,y,z,0));
}


dgBody.h
Code: Select all
//Colin Stewart - 16.02.2011
inline void dgBody::SetConstForce(const dgVector& force)
{
   m_constantForce = force;
}


add to the class declaration also:

both
Code: Select all
void SetConstForce(const dgVector& force); //Colin Stewart - 16.02.2011

and
Code: Select all
dgVector m_constantForce; //added 16.02.2011 - Colin Stewart


also find the inline procedure dgBody::ApplyExtenalForces (dgFloat32 timestep, dgInt32 threadIndex)

change it to >

Code: Select all
inline void dgBody::ApplyExtenalForces (dgFloat32 timestep, dgInt32 threadIndex)
{
   m_accel = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
   m_alpha = dgVector (dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f), dgFloat32 (0.0f));
   
   //Colin Stewart - 16.02.2011
   if ((m_constantForce.m_x != 0) || (m_constantForce.m_y != 0) || (m_constantForce.m_z != 0)) {
      //add any repeating internal forces here....
      this->AddForce(m_constantForce);
   }

   if (m_applyExtForces) {
      m_applyExtForces(*this, timestep, threadIndex);
   }
}


now in your include header for newton you add (in my case i wrote include for delphi so u will need to add this in c (easy enough)

Code: Select all
procedure NewtonBodySetConstForce(const body: PNewtonBody; x,y,z: Float); cdecl; external NewtonDLL;



ok so basically rather then create a function that is called by newton on ForceAndTorque callback, you no longer need to do this for simple objects you just call once on creation of the newton body

Code: Select all
NewtonBodySetConstForce(Result.ptrBody, 0, -10 * Result.fMass, 0);


this would be the equivelent of adding a callback which the callback would keep adding gravity * mass, note you can still set a regular callback also for more advanced forces/torque, this can be set as a constant downforce e.g. gravity


@ Julio, if you would consider adding this to next release? i can send you the actual updated files if neccasary, i think it is quite useful, i already use it, and i see it has been requested before :)

-Colin
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: The Newton engine is now Open source with a zlib license

Postby ledahut » Wed Feb 16, 2011 9:29 am

Not sure but if dgVector type use float (c and c++ type) value:
if ((m_constantForce.m_x != 0) || (m_constantForce.m_y != 0) || (m_constantForce.m_z != 0))

You test will often be false because you need an epsilon.
In fact you can remove this test and always apply the force (although m_constantForce=(0,0,0)).
what do you think?
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France

Re: The Newton engine is now Open source with a zlib license

Postby Overhertz » Wed Feb 16, 2011 9:32 am

no point to waste cpu cycles for a jmp operation if the user did not set a repeating force to be added (jmp is very expensive). and there should be no other problems, so far it is working perfect, since it saves me around 1 jmp per body per update, since this procedure adds the force via a single jmp, if adding gravity from extra procedure, first it will jmp to the external procedure, then when the users procedure calls AddForce, that is another jmp (large fps increase for me)

also there should be no need for an epsilon since the floats will be initialized as 0, which means a comparison with 0 should be correct. epsilon would only be useful if i wanted to check if it was close to 0
Last edited by Overhertz on Wed Feb 16, 2011 10:25 am, edited 2 times in total.
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: The Newton engine is now Open source with a zlib license

Postby ledahut » Wed Feb 16, 2011 9:46 am

(jmp is very expensive)

OK I agree after this explanation.
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France

Re: The Newton engine is now Open source with a zlib license

Postby JernejL » Wed Feb 16, 2011 10:11 am

Overhertz: i understand your reasons for this (default body gravity), but a properly object oriented design could easily handle this as a behavior inherited from it's parent-classes (call inherited object's method to apply gravity).
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1451
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: The Newton engine is now Open source with a zlib license

Postby Overhertz » Wed Feb 16, 2011 10:13 am

Delfi wrote:Overhertz: i understand your reasons for this (default body gravity), but a properly object oriented design could easily handle this as a behavior inherited from it's parent-classes (call inherited object's method to apply gravity).


that is correct, but this is not about simplicity, its about performance, to call an extra external function is a waste of a jmp operation.
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: The Newton engine is now Open source with a zlib license

Postby Marc » Wed Feb 16, 2011 10:54 am

I want to add my excitement about this. I guess I'm one of those waiting for years to see this go open src. :) :mrgreen:
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: The Newton engine is now Open source with a zlib license

Postby Overhertz » Wed Feb 16, 2011 3:58 pm

i'd like to just add i am mega delighted now, i've done some optimisations to my own engine, dropped in the latest newton 2.31 removed the callback for torque added some gravity, and i have now just tested 10,000 active bodies (boxes) created as convex hull, with 140FPS!!!!! :))))) maybe later today i will make a vid. but for some reason.... if i set the thread count higher, it has 0 effect, any ideas why? i have quad core....
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: The Newton engine is now Open source with a zlib license

Postby Julio Jerez » Wed Feb 16, 2011 4:18 pm

do you mean 1000 bodies not 10000 don't you?

On the thread count, that is one fo the reason I am improving the treading technology in sdk 3.00
So far 3.00 is for 50% to twice as fast as 2.00 when doing mutithreading wih a much more balance work load on each thread and with much lower overhead.
also in 3.00 the thread number is unlimited, we can have 16 or even 30 or 60 threads and there is not performace drop whatsoever.

3.00 for example when doing 4 threads in a quad core I get about 3.x the performance of one core across the board
if I set 16 thread I get more tha 4x the performance, while in 2.00 if I set more threads than the number of cores, the performance is reduced.
3.00 is the first time I see that a Hyperthread system actually yield extra performance.
where is 2.00 the performance is actually reduced when more threads than cores, it is something I can not explain.
Multithread programing is somekind of boodoo science.

But anyway let us see that video.
You can see that in the engine there is a lot of fabric that you can use to uptimize when you have access to the code.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: The Newton engine is now Open source with a zlib license

Postby Overhertz » Wed Feb 16, 2011 4:20 pm

ten thousand bodies
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: The Newton engine is now Open source with a zlib license

Postby Julio Jerez » Wed Feb 16, 2011 4:31 pm

wooow, that I have to see.

are you linking the the scene.lib, if you are you cna save the work to a .hml file and post it some were for anyone to test. If you know what I mean.
:twisted: :twisted:
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests

cron