Ok, other than ODE, I wanted to start simple (ODE has over 600 routines, Newton has less than 300)
Ok, so it has no DEF file for me to look at, so I did an export to a DEF:
Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file newton.dll
File Type: DLL
Section contains the following exports for Newton.dll
00000000 characteristics
44753364 time date stamp Thu May 25 00:32:36 2006
0.00 version
1 ordinal base
229 number of functions
229 number of names
ordinal hint RVA name
1 0 00003AA0 NewtonAddBodyImpulse
2 1 00001A60 NewtonBallGetJointAngle
3 2 00001AC0 NewtonBallGetJointForce
4 3 00001A90 NewtonBallGetJointOmega
5 4 00003B50 NewtonBallSetConeLimits
6 5 00001A50 NewtonBallSetUserCallback
7 6 00003340 NewtonBodyAddBuoyancyForce
8 7 000052C0 NewtonBodyAddForce
9 8 00005360 NewtonBodyAddTorque
10 9 00003470 NewtonBodyCoriolisForcesMode
11 A 00003A30 NewtonBodyForEachPolygonDo
12 B 000038B0 NewtonBodyGetAABB
13 C 000054A0 NewtonBodyGetAngularDamping
14 D 00003850 NewtonBodyGetAutoFreeze
15 E 00003290 NewtonBodyGetCentreOfMass
16 F 000034A0 NewtonBodyGetCollision
17 10 000037B0 NewtonBodyGetContinuousCollisionMode
18 11 00003160 NewtonBodyGetForce
19 12 00002C20 NewtonBodyGetForceAndTorqueCallback
20 13 00003870 NewtonBodyGetFreezeTreshold
21 14 00002E20 NewtonBodyGetInvMass
22 15 00003800 NewtonBodyGetJointRecursiveCollision
23 16 00003A10 NewtonBodyGetLinearDamping
24 17 00002DB0 NewtonBodyGetMassMatrix
25 18 000034C0 NewtonBodyGetMaterialGroupID
26 19 00003100 NewtonBodyGetMatrix
27 1A 000039D0 NewtonBodyGetOmega
28 1B 00003860 NewtonBodyGetSleepingState
29 1C 00003250 NewtonBodyGetTorque
30 1D 00002BB0 NewtonBodyGetUserData
31 1E 00003950 NewtonBodyGetVelocity
32 1F 00002BC0 NewtonBodyGetWorld
33 20 00005460 NewtonBodySetAngularDamping
34 21 00003820 NewtonBodySetAutoFreeze
35 22 00002BE0 NewtonBodySetAutoactiveCallback
36 23 00005320 NewtonBodySetCentreOfMass
37 24 00001A40 NewtonBodySetCollision
38 25 00003780 NewtonBodySetContinuousCollisionMode
39 26 00002C30 NewtonBodySetDestructorCallback
40 27 00003120 NewtonBodySetForce
41 28 00002C10 NewtonBodySetForceAndTorqueCallback
42 29 000053C0 NewtonBodySetFreezeTreshold
43 2A 000037D0 NewtonBodySetJointRecursiveCollision
44 2B 00005400 NewtonBodySetLinearDamping
45 2C 00002C40 NewtonBodySetMassMatrix
46 2D 000034B0 NewtonBodySetMaterialGroupID
47 2E 00002EB0 NewtonBodySetMatrix
48 2F 000030C0 NewtonBodySetMatrixRecursive
49 30 00003990 NewtonBodySetOmega
50 31 000031A0 NewtonBodySetTorque
51 32 00002BD0 NewtonBodySetTransformCallback
52 33 00002BA0 NewtonBodySetUserData
53 34 00003910 NewtonBodySetVelocity
54 35 00002B50 NewtonCollisionCalculateAABB
55 36 00001850 NewtonCollisionClosestPoint
56 37 00001880 NewtonCollisionCollide
57 38 000018C0 NewtonCollisionCollideContinue
58 39 00001950 NewtonCollisionMakeUnique
59 3A 00001820 NewtonCollisionPointDistance
60 3B 00005100 NewtonCollisionRayCast
61 3C 00003B00 NewtonConstraintCreateBall
62 3D 000041C0 NewtonConstraintCreateCorkscrew
63 3E 00004020 NewtonConstraintCreateHinge
64 3F 00004150 NewtonConstraintCreateSlider
65 40 00004230 NewtonConstraintCreateUniversal
66 41 000042C0 NewtonConstraintCreateUpVector
67 42 00001CC0 NewtonConstraintCreateUserJoint
68 43 00004590 NewtonConstraintCreateVehicle
69 44 000016F0 NewtonConvexCollisionCalculateInertialMatrix
70 45 000016E0 NewtonConvexCollisionCalculateVolume
71 46 000016D0 NewtonConvexCollisionGetUserID
72 47 000016A0 NewtonConvexCollisionSetUserID
73 48 00001640 NewtonConvexHullModifierGetMatrix
74 49 00001670 NewtonConvexHullModifierSetMatrix
75 4A 00001C10 NewtonCorkscrewCalculateStopAccel
76 4B 00001BF0 NewtonCorkscrewCalculateStopAlpha
77 4C 00001B60 NewtonCorkscrewGetJointAngle
78 4D 00001C60 NewtonCorkscrewGetJointForce
79 4E 00001AF0 NewtonCorkscrewGetJointOmega
80 4F 00001BE0 NewtonCorkscrewGetJointPosit
81 50 00001B70 NewtonCorkscrewGetJointVeloc
82 51 00001BD0 NewtonCorkscrewSetUserCallback
83 52 00005530 NewtonCreate
84 53 000019A0 NewtonCreateBody
85 54 00001320 NewtonCreateBox
86 55 000014F0 NewtonCreateCapsule
87 56 00001590 NewtonCreateChamferCylinder
88 57 00001680 NewtonCreateCompoundCollision
89 58 000014A0 NewtonCreateCone
90 59 000015E0 NewtonCreateConvexHull
91 5A 00001630 NewtonCreateConvexHullModifier
92 5B 00001540 NewtonCreateCylinder
93 5C 00001310 NewtonCreateNull
94 5D 00001DF0 NewtonCreateRagDoll
95 5E 00001370 NewtonCreateSphere
96 5F 00001710 NewtonCreateTreeCollision
97 60 00005080 NewtonCreateTreeCollisionFromSerialization
98 61 00004F70 NewtonCreateUserMeshCollision
99 62 00002280 NewtonDestroy
100 63 000055E0 NewtonDestroyAllBodies
101 64 000019B0 NewtonDestroyBody
102 65 00001DE0 NewtonDestroyJoint
103 66 00001E10 NewtonDestroyRagDoll
104 67 00001970 NewtonGetEulerAngle
105 68 00001030 NewtonGetTimeStep
106 69 00001B00 NewtonHingeCalculateStopAlpha
107 6A 00001B60 NewtonHingeGetJointAngle
108 6B 00001B20 NewtonHingeGetJointForce
109 6C 00001AF0 NewtonHingeGetJointOmega
110 6D 00001B50 NewtonHingeSetUserCallback
111 6E 00004420 NewtonJointGetCollisionState
112 6F 00001DC0 NewtonJointGetStiffness
113 70 00001DA0 NewtonJointGetUserData
114 71 00004400 NewtonJointSetCollisionState
115 72 00001DD0 NewtonJointSetDestructor
116 73 00001DB0 NewtonJointSetStiffness
117 74 00001D90 NewtonJointSetUserData
118 75 00004DF0 NewtonMaterialContactRotateTangentDirections
119 76 000010B0 NewtonMaterialCreateGroupID
120 77 000010C0 NewtonMaterialDestroyAllGroupID
121 78 00001180 NewtonMaterialDisableContact
122 79 00001210 NewtonMaterialGetBodyCollisionID
123 7A 000011A0 NewtonMaterialGetContactFaceAttribute
124 7B 00002830 NewtonMaterialGetContactForce
125 7C 000025F0 NewtonMaterialGetContactNormalSpeed
126 7D 000011B0 NewtonMaterialGetContactPositionAndNormal
127 7E 000011E0 NewtonMaterialGetContactTangentDirections
128 7F 00004B70 NewtonMaterialGetContactTangentSpeed
129 80 000025D0 NewtonMaterialGetCurrentTimestep
130 81 000010A0 NewtonMaterialGetDefaultGroupID
131 82 00001190 NewtonMaterialGetMaterialPairUserData
132 83 00001140 NewtonMaterialGetUserData
133 84 00002590 NewtonMaterialSetCollisionCallback
134 85 00002990 NewtonMaterialSetContactElasticity
135 86 00001260 NewtonMaterialSetContactFrictionState
136 87 00002A80 NewtonMaterialSetContactKineticFrictionCoef
137 88 000012B0 NewtonMaterialSetContactNormalAcceleration
138 89 00004DE0 NewtonMaterialSetContactNormalDirection
139 8A 00002930 NewtonMaterialSetContactSoftness
140 8B 000029F0 NewtonMaterialSetContactStaticFrictionCoef
141 8C 000012D0 NewtonMaterialSetContactTangentAcceleration
142 8D 00001100 NewtonMaterialSetContinuousCollisionMode
143 8E 000010D0 NewtonMaterialSetDefaultCollidable
144 8F 000024D0 NewtonMaterialSetDefaultElasticity
145 90 000023E0 NewtonMaterialSetDefaultFriction
146 91 00002530 NewtonMaterialSetDefaultSoftness
147 92 00004430 NewtonRagDollAddBone
148 93 00001E30 NewtonRagDollBegin
149 94 00001EA0 NewtonRagDollBoneGetBody
150 95 00001EE0 NewtonRagDollBoneGetGlobalMatrix
151 96 00001EB0 NewtonRagDollBoneGetLocalMatrix
152 97 00001E50 NewtonRagDollBoneGetUserData
153 98 00001E80 NewtonRagDollBoneSetID
154 99 00004490 NewtonRagDollBoneSetLimits
155 9A 00001E40 NewtonRagDollEnd
156 9B 00001E90 NewtonRagDollFindBone
157 9C 00001E70 NewtonRagDollSetForceAndTorqueCallback
158 9D 00001E60 NewtonRagDollSetTransformCallback
159 9E 00001960 NewtonReleaseCollision
160 9F 00001040 NewtonSetBodyLeaveWorldEvent
161 A0 00005200 NewtonSetEulerAngle
162 A1 00001020 NewtonSetFrictionModel
163 A2 00002380 NewtonSetMinimumFrameRate
164 A3 00001000 NewtonSetPlatformArchitecture
165 A4 00001010 NewtonSetSolverModel
166 A5 000049D0 NewtonSetWorldSize
167 A6 00001B80 NewtonSliderCalculateStopAccel
168 A7 00001BA0 NewtonSliderGetJointForce
169 A8 00001B60 NewtonSliderGetJointPosit
170 A9 00001B70 NewtonSliderGetJointVeloc
171 AA 00001B50 NewtonSliderSetUserCallback
172 AB 00001790 NewtonTreeCollisionAddFace
173 AC 00001750 NewtonTreeCollisionBeginBuild
174 AD 00004FF0 NewtonTreeCollisionEndBuild
175 AE 00002B10 NewtonTreeCollisionGetFaceAtribute
176 AF 00001800 NewtonTreeCollisionSerialize
177 B0 00002B30 NewtonTreeCollisionSetFaceAtribute
178 B1 00001BF0 NewtonUniversalCalculateStopAlpha0
179 B2 00001C40 NewtonUniversalCalculateStopAlpha1
180 B3 00001B60 NewtonUniversalGetJointAngle0
181 B4 00001BE0 NewtonUniversalGetJointAngle1
182 B5 00001C60 NewtonUniversalGetJointForce
183 B6 00001AF0 NewtonUniversalGetJointOmega0
184 B7 00001C30 NewtonUniversalGetJointOmega1
185 B8 00001BD0 NewtonUniversalSetUserCallback
186 B9 00001C90 NewtonUpVectorGetPin
187 BA 00004300 NewtonUpVectorSetPin
188 BB 000022C0 NewtonUpdate
189 BC 000043C0 NewtonUserJointAddAngularRow
190 BD 00001D00 NewtonUserJointAddGeneralRow
191 BE 00004340 NewtonUserJointAddLinearRow
192 BF 00001D80 NewtonUserJointGetRowForce
193 C0 00001D40 NewtonUserJointSetRowAcceleration
194 C1 00001D20 NewtonUserJointSetRowMaximumFriction
195 C2 00001D30 NewtonUserJointSetRowMinimumFriction
196 C3 00001D50 NewtonUserJointSetRowSpringDamperAcceleration
197 C4 00001D70 NewtonUserJointSetRowStiffness
198 C5 000045D0 NewtonVehicleAddTire
199 C6 000054D0 NewtonVehicleGetFirstTireID
200 C7 00004690 NewtonVehicleGetNextTireID
201 C8 00004760 NewtonVehicleGetTireLateralSpeed
202 C9 00004770 NewtonVehicleGetTireLongitudinalSpeed
203 CA 00001F40 NewtonVehicleGetTireMatrix
204 CB 000054E0 NewtonVehicleGetTireNormalLoad
205 CC 000046E0 NewtonVehicleGetTireOmega
206 CD 000046B0 NewtonVehicleGetTireSteerAngle
207 CE 000046A0 NewtonVehicleGetTireUserData
208 CF 00001F30 NewtonVehicleRemoveTire
209 D0 00001F20 NewtonVehicleReset
210 D1 00001F10 NewtonVehicleSetTireCallback
211 D2 000047E0 NewtonVehicleSetTireLongitudinalSlideCoeficient
212 D3 000047C0 NewtonVehicleSetTireMaxLongitudinalSlideSpeed
213 D4 00004780 NewtonVehicleSetTireMaxSideSleepSpeed
214 D5 000047A0 NewtonVehicleSetTireSideSleepCoeficient
215 D6 00001F60 NewtonVehicleSetTireSteerAngle
216 D7 000046D0 NewtonVehicleSetTireTorque
217 D8 00004740 NewtonVehicleTireCalculateMaxBrakeAcceleration
218 D9 00004800 NewtonVehicleTireIsAirBorne
219 DA 00004820 NewtonVehicleTireLostSideGrip
220 DB 00004840 NewtonVehicleTireLostTraction
221 DC 00004700 NewtonVehicleTireSetBrakeAcceleration
222 DD 00004A30 NewtonWorldForEachBodyDo
223 DE 00004A80 NewtonWorldForEachBodyInAABBDo
224 DF 00001050 NewtonWorldFreezeBody
225 E0 00001090 NewtonWorldGetUserData
226 E1 00001070 NewtonWorldGetVersion
227 E2 00004AF0 NewtonWorldRayCast
228 E3 00001080 NewtonWorldSetUserData
229 E4 00001060 NewtonWorldUnfreezeBody
Summary
6000 .data
9000 .rdata
3000 .reloc
5E000 .text
Here is my problem, I know there in's and out's, kinda, but
NewtonCreate
NewtonDestroy
For the begining, I tried:
declare cdecl import, NewtonCreate(string *malloc,string *free),string;
declare cdecl import, NewtonDestroy(string *world);
but I get an error with
Unresolved external __imp_NewtonCreate
Any suggestions? I'll convert newton if I can get help on this.
Did you create the import library? (from the tools menu)
In C or in Aurora.. looking...
*grins* just now did, I was using there LIB file, I didn't think of using the import library thing...
I didn't get an error!
going to setup the destroy object and see if that helps.
I'll let you know if I get stuck again, they use alot of custom objects.
That won't work on rakknet.dll though.
It worked fine on Newton.
I'll hammer on this some and see if I can get a basic routine working with Newton.
It will sit in with my tank game as I make it.
What didn't work on rakknet.dll?
Don't mean to interfere in the dialog, but sort of lost as to what is happening? Zumwalt are you writing some sort of way for us to use Newton Physics with Aurora?
Yes that is what he is doing.
Cool, I guess I should check into Newton and see what all it offers... things are progressing quickly, lots to keep up and to learn, love it!!
When I download Rakknet, and take the DLL from the distribution folder, place it in the project folder of my project, then use the Tools / Create Import Library, it errors and it unable to create an import library.
My tank project includes both the Rakknet dll and the Newton dll in its base folder, you can give it a go yourself to see what I mean.
Right now for my Newton calls, I keep crashing the program, I am passing stuff wrong probably, looking into it deeper.
It wants the pointer to the "world" which I figured was a pointer to the 'scene', but that blows up.
I'll keep hammering on it before I bug you Paul, this is more like a 6 month project for me and I want to fully understand the method calls.
I think one main problem I have right now is that I don't have all of the global structures to Newton defined, trying to find them.
Ironically, I know it will work once I get past this point because newtoncreate and newtondestroy are working.
EDIT:
LOL.. ok the world is the int passed back from the NewtonCreate command.
I am such an idiot. I need to sleep more often and drink less than 10 pots of cofee before bed.
For those watching this thread, I have succesfully initiated the Newton engine in Aurora and added objects to the Newton generated world, I am now learning the relationship between the Aurora mesh objects and the Newton objects. Once I get that figured out, hopefully my generic gravity will then be replaced with Newton gravity.
This is not an overnight process since today was the second day I have ever touched Newton.
Although today being a holiday wife will drag me out of the house so don't expect maricles on this day form me :)
That's cool zumwalt. Take your time, I know I got enough to study and work on for now. But, having those features will be great when they are finished.
Just to learn what you and how you are doing what you are doing, I don't expect a long detailed answer as I know you are just starting on it.
But, what are the steps you took so far?
1. know which dll to use
2. see inside of that dll
3. then make even 1 command work in Aurora
Enjoy the day out. I need to do chores I have been putting off for over 2 weeks, but my mind will be on Aurora while I am doing the other stuff.
First, I visited: http://www.physicsengine.com/
From there I downloaded the SDK for windows, verwion 1.53 and installed it. The install placed the files under:
C:\Program Files\NewtonSDK
In that folder, there is a SDK folder with a DLL folder inside it.
I copied the DLL from inside the DLL folder and placed it in the root of my Aurora3D projects folder.
Once I opened up Aurora and my project, I then clicked on Tools, Create Import Library and chose the Newton.dll that was in my project folder.
This created the newton.lib file I needed to work with.
Now, working with someone elses dll, you need to know about the IN's and OUT's of the methods, along with there names.
This is usually taken from some sort of instructions given by the developer of the dll.
In this case, what scarse information I have to work with is located in there help file, and it is scarse.
It lacks alot of primary information, like structures, global variables and such, but playing with the methods and learning what they really are doing will help in determining how and what to write to make them work.
To keep this short, I'll just cover 2 methods here, although at this time I have 20 or so already done.
To call an external DLL, you have to call its corosponding LIB file, so in my INC file that I created calling it newton.inc, I do a call to the lib with
#USE "Newton.LIB"
(syntax is not important in the quotes)
Now in my code to use the 2 main methods of Newton, (very important to use them I am certain of)
declare cdecl import, NewtonCreate(string *malloc,string *free),int;
declare cdecl import, NewtonDestroy(int world);
Now, what I don't know for sure is the two initial pointers for NewtonCreate, but if you pass them both a 0, it assumes default, these are supposed to be pointers to memory locations, but right now I don't know why, I haven't gotten that far.
What NewtonCreate does, is that it creates a 'world' that all physics will work in, this is a shell that wraps around your 3d world and encompases it for a lack of better terms.
This method works and returns to me a pointer to the world object.
When I am done with my application and exit form the do while loop for the game itself, I then terminate the world through NewtonDestroy(world) passing it the world pointer that is created in the begining.
This is typical of any external call in aurora. You have to know the name of the method and its values that are for both input and output to correctly use the public method.
There is the key to everything, the only methods on a DLL you can use are any publicly declared methods, methods that are private will not be available to use, and generally there is a purpose for that.
Hopefully this helps to understand the chaos that is me :)
Thanks for your efforts, I am sure it is hair pulling time. Good luck and thanks for your efforst again!!
This sounds pretty cool zumwalt! eagerly looking forward to see how it turns out ;D
Thanks, hopefully I can get over a few hurdles, but once I do, its smooth sailing.
I think I need to shoot the makers of Newton a quick email with questions though.
Undocumented global declarations is killing my efforts.
Trial 1, call this an alpha I guess.
No code to demonstrate it, its just the INC I have created.
You need newton 1.53 and create the lib import for to use it.
Downloaded the include file. Thanks for the efforts Zumwalt. Will take a look at what is available. I haven't downloaded Newton yet, Thanks again, as I know that has got to be quite an undertaking!
edited:Wow just looked through the include, that is lots of stuff you are figuring out Z, going to be really cool to have, thanks again!
RenderPrimitive Initial conversion.
Meat to bones to be added later.
Its just translating K.
Thanks though, couldn't do this without the help of Paul and the gang.
I have a ton more to do before I can fully display what this is doing.
I hope to have the tank demo updated with Newton either by this weekend or next.
As you can see from the latest build, I do initialize newton and do a few tests with it, but nothing visual yet. (that is in game)
Looking good, still over my head at the moment, glad you are tackling it!!
looking good Zumwalt ;)
will be interresting to see that in action!
I get an error when trying to make the raknet library from the raknet.dll. Did you have this problem Z?
Yes.
Place these in your Aurora Libs folder.
That will get rid of that error.
Aurora can't translate them using the makelib function.
(rather unzip this and place the 2 libs into your libs folder)
I have 12 header files and 8 cpp files to translate before I can build the demo up the way it needs done.
Once they are done, they are what the newton crew calls the 'toolbox', these are the list of methods you need in order to fully utilize the library.
Although you can use the library without the tools, the tools make it easier.
Once they are finished, I'll be posting them in a toolbox zip, and you will need to create a folder called toolbox in your aurora project folder where you have a project, and then the newton.inc will also inherit from a newtontool.inc, which will include all of those tools in the subfolder.
That said, your project will only need to do an include on the newton.inc, then you can fully utilize the newton engine.
If anyone has used Newton before and written a very very very simple project using the most basic components, please chime in.
Maybe you can take the include I have written already and write a 1 page of code application to show it in use.
Thanks Z, I will look for projects, I know guys have written stuff using it with DarkBasic Pro. I can see if I understand any and make a similar translation for Aurora. Will be a great way for me to get into it quickly. Will get to it this weekend, as got a few other things I want to wrap up this week. Thanks.
Cool your latest build went fine now with those libs :)
Good, well, rakknet is a secret obsession of mine.
I own his full enterprise license, and I am really obsessed with it.
Although anyone can get the full source and use it, its the license model that counts if you want to sell anything you do with it.
It keeps me distraut trying to use it with anything but C++, so finally, last night, I caved..
I purchased me another book (as if I need more)
C++ for game programmers
I just looked through snippets for newton on DarkBasic Forums, darkbasic passes parameters and sets things up differently. Apparently there is a newton version for darkbasic pro. So I doubt it will do any good with me helping you write an example. I will look for the c++ samples and see if I can help. I will install msc++ express.
K, the end result of what I am doing will require modification. Newton out of the box calls OpenGL.
The render routine will need to be modified to support the aurora render, amongst some other things.
Basically the two need to be married together smoothly.
As you can see from the demo, I can correctly instansiate a newton world.
Its getting down to rendering in that world, which lives in the aurora scene that is the next major breakthrough after finishing up the toolbox.
I appreciate your effort into looking at it though, maybe you can catch things I miss.
2 pair of eyes are better than 1.
Update made to Newton.inc, fixed some uint where they were void in my code.
Fully tested NewtonUpdate..
Basic Instructions for engine initialization:
global sub main()
{
// What ever you are doing here to initialize your world
// Newton Initializations
// This generates our virtual newton world
NewtonWorld World;
World=NewtonCreate();
// test create some objects in that world to make sure we get ID's back
// you can easily render the output result numbers, these are just integers
// juse use numToStr(nSphere) and numToStr(nCollision)
// you can also see your world id by simple numToStr(World)
NewtonCollision nSphere,nCollision;
nSphere = NewtonCreateSphere(World,5.0f,5.0f,5.0f);
nCollision = NewtonCreateBox(World,30,10,30);
// finish up your init stuff then start your game loop
do
{
// do stuff in your game loop as usual
// hope to replace this with more newton code to show a working newton object in loop
// before you finish the loop, do as before by getting the time adjustment
fAdjust = (timeGetTime() - startTime) / fTarget;
// Now, pass to the NewtonUpdate, the world ID and the adjusted time interval
NewtonUpdate(World,fAdjust);
}until di.KeyDown(DIK_ESCAPE);
// finished with the game, you have to get rid of the newton world
NewtonDestroy(World);
// flinally free your scene object
Scene.Free();
}
This all works to this point.
Now from what I am gathering, all newton stuff is invisible anyway, our objects we create then 'wrap' them in a Newtonfoil as it were.
(sad joke on foil eh)
Figured I would atleast document this to this point so I don't get to many people lost.
Z, first, nice to see you in your new avatar.
That global sub main is just for documentation right, it doesn't actually execute?
I also am looking through the newton stuff now that I got express c++ installed.
There are many routines that write to opengl, I don't know how you can translate those?
I am ready to help where I can now. So give me some direction on anything you would like me to look at and work on.
The global sub main is for demonstration purposes only where to place the code.
If you have sub methods that have your game code in them that instansiate your world, that is where you would create the newton world also.
Its just for informational purposes only.
As it stands, my tank game demo now has only 1 line in the main,
Game();
When game is done, I call:
Terminate(list of parameters);
I haven't uploaded that code yet because I am trying to put more newton calls in it.
Take a look at the Windows API for multithreading, see if you can make sense of the calls and if you can wrap it, if not its cool, I am going to look at it tonight when I get home.
Wrapping your brain around NewtonSDK, if you want to look deep into it, take a look at the code for the tutorials, every single one of them use the toolbox, in that toolbox is headers and code files. See how I have already completed 1 of the headers and 1 of the code files and posted it here, take a look at the corosponding header file and cpp file in the toolbox folder to start to get a handle on how I am doing the conversion.
This will also get another pair of eyes on the conversion itself to make sure I have no syntax errors or that I didn't wrap a method wrong. Thanks for the help and thanks for the comment on my avatar, it was the best pic of me I had available digitally that wasn't "too" goofy looking.
I can tell you without even looking, mutli threading will be way over my head at this point :)
I will keep studying and going back and forth with your includes and such to see if I can figure any of this out.
I am also going to see if there are any directx based physics engines. I don't know how you are going to do the opengl stuff. Like in the OpenGlutil.cpp
No worries, my brain works in mysterious ways.
Here is what I have so far with 10 minutes of searching and converting for multithreading:
#define _INC_PROCESS
#define _CRTIMP
#define _CRTAPI1
#define _P_WAITÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, 0
#define _P_NOWAITÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, 1
#define _OLD_P_OVERLAYÂÃ, 2
#define _P_OVERLAYÂÃ, Ã‚Ã, Ã‚Ã, 2
#define _P_NOWAITOÂÃ, Ã‚Ã, Ã‚Ã, 3
#define _P_DETACHÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, 4
#define _WAIT_CHILDÂÃ, Ã‚Ã, Ã‚Ã, 0
#define _WAIT_GRANDCHILD 1
declare cdecl import, _beginthread(void *p0,uint p1, void *p2),uint;
declare cdecl import, _endthread();
declare cdecl import, _beginthreadex(void *p0, uint p1, uint *p2, void *p3, uint p4, uint *p5),uint;
declare cdecl import, _endthreadex(uint p0);
declare cdecl import, abort();
declare cdecl import, exit(int p0);
declare cdecl import, _exit(int p1);
declare cdecl import, WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds),DWORD;
declare cdecl import, WaitForMultipleObjects(DWORD nCount, HANDLE *lpHandles, BOOL fWaitAll, DWORD dwMilliseconds),DWORD;
Oh yea almost forgot, I guess I didn't mention this along the way.
We don't need to do anything with the OpenGLUtil.cpp or its header.
Remember, we have to marry aurora with the newton, as he did with opengl and newton.
So, for instance, GLuint g_cubeTexture is nothing more than a pointer to a cubetexture.
That said, we can 'assume' that means the pointer to our C3DMesh or C3DObject.
I haven't gotten that far to figure out which or what it is, but that is the 'genera' idea.
You "wrap" the 'object' with a collission object.
Hmm...Look at this from a different angle, you own Hershey's and are making candy bars.
You are purchasing wrappers for those candies from other companies.. aka Newton is selling you the wrappers.
Each piece of candy requires its own special wrapper, so you design the wrapper using there system to cut the wrapper and place it on your candy...
Ok so maybe that didn't go as planned on explaining it. Its just how my mind works.
Just wanted to drop a quick line, I am still working on this.
Man am I learning alot about how game physics are added to a game.
The way this all works, is that the physics engines are nothing but a non-rendered scene engine.
Think of it this way, you have actions with reactions, but the reactions don't take place in the render scene, only the results of the reaction are.
Now, to take this into a real logical step, code wise, in Aurora's rendering engine, you get the results of the location to an object, and you have 3 objects for example, these 3 results of locations are passed as a call back into the physics engine, it does calculations on them and passes the results back out of the physics hidden scene (thats what it really is), you then apply these results to your 3 objects.
There is a synchronization step that is always taking place to ensure objects are synced between the render engine and the physics engine through callbacks.
For instance, in my Tank game, you notice my tank stays on the ground, I do this via a very generic function that asks if the tank mesh has collided with the terrain, if so, push up, if not push down. This tug of war goes on forever, but is very unrealistic and is processor entensive, not to mention innacurate.
Now if you add multiple objects doing the same thing with my function, you will see your FPS start to drop, that is because it is a linear call.
Thanks for the update Z.
While looking at different graphics engines, game engine frameworks this week, it is inevitable to run into physics as it is such a big part of it.
My sense this week from my surfing is that Newton would be number 3, ODE number 2 and Aegis PhysX as being number 1. What is your take since you are looking at all three in depth?
Ogre is really impressive, for a graphics engine. What would we need to do to use ogre in Aurora?
I also downloaded and am going to put more effort into Blender (modeling program) by going through the video tutorials and then the manual. Looks like it will be a great tool to learn and master. Just the quick video on the user interface was very impressive. I liked the thinking behind it all and talk about OOP, looks like they are doing really impressive coding to make it all happen. It is worth to watch the video just to see what all can be done with the interface.
http://www.ibiblio.org/bvidtute/contrib/interface.avi
Sorry for the delay on answering you Kryton, you are correct in your order of magnitude for the physics engines.
Reasons are:
Newton
Is a basic set, gets your feet wet, and doesn't have some of the advanced control sets, its also software based.
ODE
Includes more commands (over twice that as Newton), still limited as a software based physics system.
Aegis PhysX
Middle class engine, borders high class. Very ahead of the game compared to both ODE and Newton combined, and the best thing about PhysX is that not only does it have a software based set, but it has a hardware excellerated set for video cards that have the integrated PhysX chip set.
I have one or two more types of physics engine links at the house, however, they are high class enterprise level. These engines are also both software and hardware accelerated, games such as D&D online use the high end ones, so does all the other major games.
I have been busy with the local HOA stuff going on in the neighborhood (running for the Board of Directors, chairman), so my time has been tapped. FYI, DarkPhysics is based on Aegis PhysX.
Just a suggestion as I really have never done any of this stuff.
Quote from: zumwalt on September 14, 2006, 11:47:20 AM
in my Tank game, you notice my tank stays on the ground, I do this via a very generic function that asks if the tank mesh has collided with the terrain, if so, push up, if not push down. This tug of war goes on forever, but is very unrealistic and is processor entensive, not to mention innacurate.
Is it possible to make your tank aware of hills and holes in the terrain based on their location coordinates? You can tell the tank where uneven terrain is and have a simple test of position. When the tank come to the uneven terrain then slow the tank down and switch to collisions. A tank would naturally slow down a bit on uneven terrain (the slower moving tank will also give the processor time to keep up).
This way if your terrain is dominated by mostly flat areas, you don't need to use collision testing between the tank and the terrain.
John you got the right idea, but you need the height of the ground and at the moment can't get that without collision testing. It is coming in future releases Paul said.
Actually the simplest methdf to get the height assuming the ground never rotates is to use ray collision. Then the collision point tells the Y value of the ground, subtract from your object position and you have the height above the arbetrary ground mesh.
Question, how do I use ray collision in Aurora at the moment or is this on the 'later releases' ?
The RayCollided method of an object.
You call it from the mesh your using as a landscape specifying an origin (the position of the other mesh) and a direction vector. In this case the direction vector would be straight down. (0,-1,0)
Then call GetCollisionPoint of the landscape mesh to return the point the ray collided. Something like this in pseudo code:
VECTOR3 dir, coll_pt, objloc;
dir.x = 0;
dir.y = -1;
dir.z = 0;
objloc = tank.GetPosition(true);
if(myland.RayCollided(objloc, dir, false))
{
coll_pt = myland.GetCollisionPoint();
height = objloc.y - coll_pt.y;
}
else
{
//object is not over or is under the landscape object.
}
This only works if your landscape mesh is a top level mesh as GetCollisionPoint returns the point in local coordinates. Have to add the 'bworld' parameter yet. Landscapes are normally top level meshes anyway, in other words not the child of another mesh.
Try it out and let me know how you do. The RayCollided method hasn't been tested well yet ;)
Paul.
I'll fool with this in a few hours, K might get to it before I do.
Thanks Paul.