Game Development Community

ODEScript New Thread

by Gary "ChunkyKs" Briggs · in Torque Game Engine · 08/08/2006 (11:29 am) · 99 replies

Well, it's about a year on since I last was really posting stuff, so I thought I'd start a new thread.

From my .plan just now www.garagegames.com/blogs/20342/11050

Here's some code:
icculus.org/~chunky/stuff/odescript/oderocks-2006-08-08.tar.gz
icculus.org/~chunky/stuff/odescript/odescript-2006-08-08.tar.gz

ODEScript is the C++ code. ODERocks is a mod.

If you want the crossbow bolt thing to work, you'll need to edit projectile.cc and add StaticShapeObjectType to the Projectile::csmStaticCollisionMask at the top of the file.

In-game, hold down the C key to see the little physics UI. If you're on a real client instead of a listen server, the only UI widgets that will work properly are gravity [all directions], and the add rock/add link buttons.

Gary (-;
#21
09/22/2006 (12:27 am)
Thanks for sharing your work here. I still have to mess with the options a bit to make it update faster, but that will all come in time. Anyway, a quick addition to get the menu working (not perfectly, but good enough) is to open oderocks\main.cs and search for "initServer();". Add "initClient();" without the quotes below it and then you should be able to open the menu by pressing "c".
#22
09/22/2006 (10:56 am)
Gah! I thought I'd updated this more recently than that. I have it working properly with the menu, as well as now having you able to increase the number of steps. I'll try to make sure all is working and upload another version today.

Thanks,
Gary (-;
#23
09/27/2006 (11:58 am)
Hi!
I tried ODEScript, and it kind of works. It seems that the update rate of ODE is quite slow, the position of ODE simulated box is updated only few times per second. The demo videos have a bit slow framerate (though it is a bit hard to judge from the videos), but it still looks like that the objects move at least relatively smoothly. Have I done something wrong, or is this how it this normal/expected behavior at this point of developement? Or is my question late, and the "as well as now having you able to increase the number of steps" refers to this situation?
#24
09/27/2006 (6:37 pm)
Hola all, again

odescript-2006-09-27.tar.gz
oderocks-2006-09-27.tar.gz

Here's a dump from just now. Just dropping in and dumping code, I'm working on jugglemaster again right now, so odescript hasn't progressed much in the last couple weeks :-/

Anyways. This one has a variable number of world steps among other stuffs. Rotational interpolation still doesn't work and I still can't figure out how to do it.

Gary (-;
#25
10/29/2006 (7:16 pm)
Hi, I'm getting some compiler errors when installing OdeScript.

../engine\game/shapeBase.h(78) : error C2059: syntax error : 'protected'
../engine\game/shapeBase.h(79) : error C2065: 'pShapeBase' : undeclared identifier
../engine\game/shapeBase.h(79) : error C2275: 'ShapeBase' : illegal use of this type as an expression
        ../engine\game/shapeBase.h(51) : see declaration of 'ShapeBase'
../engine\game/shapeBase.h(79) : error C2056: illegal expression
../engine\game/shapeBase.h(79) : error C2079: '<alignment member>' uses undefined class 'ODEShape'
../engine\game/shapeBase.h(79) : error C2433: '<alignment member>' : 'friend' not permitted on data declarations
../engine\game/shapeBase.h(91) : error C2039: 'pShapeBase' : is not a member of 'ShapeBaseConvex'
        ../engine\game/shapeBase.h(70) : see declaration of 'ShapeBaseConvex'

Compiling on MSVC++2005, TGE 1.5 and ODE 0.7

Linked (Includes):
Ode-0.7\include\ode
(libraries)
Ode-0.7\lib

Made the Shapebase.h change (add friend class ODEShape)


Which Ode, Torque, and compiler versions are my best bet to get it to compile cleanly?

Many thanks for your hard work on this project

--Alex Huck

-Edit- I tried this on TGE 1.4, same error

-Another edit- Could this be a compile order error? Should the new OdeScript folder of files be compiled before the ShapeBase.h changes would be recognised? I assume this must be the case, because class ODEShape needs to be defined before you make it a friend class. Does anyone know how I tell VC++2005 I want Odescript compiled first? I suppose it would be easier to do an #include at the top of shapebase.h, which file should I include?
#26
10/29/2006 (11:13 pm)
.
#27
10/30/2006 (12:41 pm)
@Alex: Your error actually sounds like the "friend class ODEShape" is misplaced or missing the semicolon. In TGE 1.5, I have it on line 76, as it seems like you do too. I suspect you left out a semicolon?

Also, mixing forward and back slashes make baby Chunky cry.

@Beserk:
Quote:By the way, here are 2 cents: Physics libraryes such as ODE uses collision detection mainly on a per-polygon basis.

No.
Well, kinda. But mostly no.

Saliently: my stuff explicitly does nothing with ODE collisions, because as I said here:

Quote:Torque has a complete, working, collision engine. As demonstrated by RigidShape, this is more than sufficient for most things. ODEScript studiously avoids replacing this.
*snippage*
Until you have demonstrated that Torque's collision detection doesn't work for your application, replacing it is a nontrivial amount of work that may be unneccesary.

Everything I've done so far uses Torque collisions which work fine for me until you get to high velocities, and by "high", I mean "really high".

Gary (-;
#28
10/30/2006 (3:44 pm)
@Gary:

Many thanks, All the errors in shapeBase and the odeScript files are gone, they compile fine. Now I get the same error AlienForce got, LNK2001 errors. You advised him to check his ODE links, and I did, and I'm not sure... Linking is the same as setting to Include/lib directories, right? I set the Include directories to ode-0.7/Include/ode and also ode-0.7/include, no go. :( Is linking something different?
#29
10/30/2006 (3:59 pm)
@Alex: includes and libraries are used in different parts of the compile process; includes are used when compiling to object code, which happens before linking. Libraries are used in linking.

You need to set more than directories for linking.

You'll need to find where the libraries you link with are actually listed in your environment. You're looking for a list that says something like DirectX, OpenGL, Windows Core, blahdy blah. Might be a list of .dll files.

You need to add ode.dll or whatever it's called to that list. Sorry, you'll have to find it yourself [your compiler and build environment probably have appropriate documentation available], I don't really do that whole windows thing :-/

Gary (-;
#30
10/30/2006 (5:05 pm)
I think I got it in the link queue, but when it comes time for the linking process I get this error:

Linking...
C:\TGE1.5\engine\ode-0.7\contrib\DotNetManaged\Release\ode.dll : fatal error LNK1302: only support linking safe .netmodules; unable to link ijw/native .netmodule

-edit- Maybe if AlienForce is out there somewhere he can help me, by explaining how he fixed his LNK errors :)

-edit2- I've been trying to follow MSDN's explaination of this error, and it's all greek to me

...edit 3... Boy is my face red, I downloaded the wrong thing from ode.org, I downloaded the source(ode-src-0.7.zip), not the win32 version(ode-win32-0.7.zip)... Ok, I have everything I need (The lib file I need to put in "Additional dependencies" [I wondered where that was...])

-edit4- Waiting for it to compile... Can't wait, I'm too impatient... On a side note: I hope these edits don't bump this thread... just in case they do I'll stop here

:)
#31
10/30/2006 (5:38 pm)
I am getting completly different errors using XCode 2.4 on an iMac(PPC) running OSX 10.4.8 .
cd "/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode"
    setenv MACOSX_DEPLOYMENT_TARGET 10.2
    setenv NEXT_ROOT /Developer/SDKs/MacOSX10.3.9.sdk
    /usr/bin/g++-3.3 -o /Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/Torque\ Demo\ OSX -L../example -L/Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/gcc/darwin/3.3 -F../example -F../lib/openal/macosx -F../lib/xiph/macosx -filelist /Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/Torque\ Demo\ OSX.LinkFileList -framework AGL -framework Carbon -framework OpenGL -framework CoreFoundation -framework DrawSprocket -framework OpenAL -framework Ogg -framework Vorbis -framework Theora -framework ApplicationServices -framework Cocoa -framework Accelerate -lode -arch ppc -prebind -Wl,-Y,1455 -mmacosx-version-min=10.2 -lz -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk
ld: warning prebinding disabled because dependent library: @executable_path/../Frameworks/Theora.framework/Versions/A/Theora is not prebound
ld: Undefined symbols:
_fprintf$LDBLStub
_vfprintf$LDBLStub
_printf$LDBLStub
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(error.o) reference to undefined _fprintf$LDBLStub
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(error.o) reference to undefined _vfprintf$LDBLStub
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(misc.o) reference to undefined _fprintf$LDBLStub
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(lcp.o) reference to undefined _printf$LDBLStub
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(timer.o) reference to undefined _fprintf$LDBLStub
	ld: warning prebinding disabled because dependent library: @executable_path/../Frameworks/Theora.framework/Versions/A/Theora is not prebound
	ld: Undefined symbols:
	_fprintf$LDBLStub
	_vfprintf$LDBLStub
	_printf$LDBLStub
	/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(error.o) reference to undefined _fprintf$LDBLStub
	/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(error.o) reference to undefined _vfprintf$LDBLStub
	/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(misc.o) reference to undefined _fprintf$LDBLStub
	/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(lcp.o) reference to undefined _printf$LDBLStub
	/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/libode.a(timer.o) reference to undefined _fprintf$LDBLStub

Any help would be apreciated. I'm inexperienced in C++ and am pretty clueless about the lib file and just added it to the project sp I think the problem lies in there.
#32
10/30/2006 (6:11 pm)
@gary, it compiled fine, but now it gives me a GPF when I run oderocks -edit- hold up, I might've fixed this

@richard, take my advice with a grain of salt, I've never used a mac, much less coded on one. I'll see how far I can get you: The lib file tells your program how to take information from the ODE SDK (As is my understanding)

This file cannot be tossed into the project like a cpp or h file, it needs to be specially set up, I don't know how to do it in xcode, but I'll give it a shot at trying to guess:

THere should be some kind of build option in the top menu (Does mac get a top-of-the-screen drop down menu?[Shows what I know about mac :P]) If you have some sort of manu system in xcode, look for these sorts of keywords:

Build options
Libraries
Linker

It should be some place similar to where you set up the OpenGL libraries (I assume you did, to get torque to compile, us Windowsers have to set up DirectX, and seeing as OpenGL is the crossplatform version of DirectX I would guess mac users set it up with OpenGL)

Sorry I can't be of much assistance
#33
10/30/2006 (6:25 pm)
Well, It apears XCode can find the libs and when I tried with a new ODE-0.7 version I was able to limit my errors to this.
cd "/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode"
    setenv MACOSX_DEPLOYMENT_TARGET 10.2
    setenv NEXT_ROOT /Developer/SDKs/MacOSX10.3.9.sdk
    /usr/bin/g++-3.3 -o /Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/Torque\ Demo\ OSX -L../example -L/Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode -L/Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode/../engine/ode -L/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib/gcc/darwin/3.3 -F../example -F../lib/openal/macosx -F../lib/xiph/macosx -filelist /Users/alex/Code/Torque/Torque\ Game\ Engine\ 1.5\ SDK/Torque\ SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/Torque\ Demo\ OSX.LinkFileList -framework AGL -framework Carbon -framework OpenGL -framework CoreFoundation -framework DrawSprocket -framework OpenAL -framework Ogg -framework Vorbis -framework Theora -framework ApplicationServices -framework Cocoa -framework Accelerate -lode -lode -arch ppc -prebind -Wl,-Y,1455 -mmacosx-version-min=10.2 -lz -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk
ld: warning prebinding disabled because dependent library: @executable_path/../Frameworks/Theora.framework/Versions/A/Theora is not prebound
ld: Undefined symbols:
_dMassSetCappedCylinder
_dMassSetCappedCylinderTotal
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/tmassconsole.o reference to undefined _dMassSetCappedCylinder
/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/tmassconsole.o reference to undefined _dMassSetCappedCylinderTotal
		ld: warning prebinding disabled because dependent library: @executable_path/../Frameworks/Theora.framework/Versions/A/Theora is not prebound
		ld: Undefined symbols:
		_dMassSetCappedCylinder
		_dMassSetCappedCylinderTotal
		/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/tmassconsole.o reference to undefined _dMassSetCappedCylinder
		/Users/alex/Code/Torque/Torque Game Engine 1.5 SDK/Torque SDK/xcode/build/torque_xcode_2_2_UB.build/Default/Torque-MacCarb-Release.build/Objects-normal/ppc/tmassconsole.o reference to undefined _dMassSetCappedCylinderTotal
Build failed (1 error, 1 warning)
@Alex: Thanks for yout try.

Anyone else have anything that might be useful?
#34
10/30/2006 (7:06 pm)
Personally, what I've done in XCode is this:

I downloaded and built the latest versioned ODE release, /a la/
unzip ode-src-0.7.zip
cd ode-0.7
./configure
make && sudo make install

This will place, by default, the includes in /usr/local/include/ and the library in /usr/local/lib

Then in XCode [Latest version. 2.4, at time of writing, YMMV with previous versions], with your Torque project open, Project->Edit Project Settings.
Make sure you're on the build tab, and go to General->Search Paths in the dropdown
Suffix "/usr/local/include" [without the quotes] on "User Header Search Path", and suffix "/usr/local/lib" [again without the quotes] on "Library Search Paths"

I'm sure this last bit is nonoptimal, but what works for me. Go to General->Linking in that drop down, and to your "Other Linker Flags", add "-lode" [without quotes, yada yada].

You probably don't want to link dynamically with ODE. Ever. So I would suggest making sure that you delete libode.dylib from /usr/local/lib, leaving only libode.a

Anyways. That's what I do. There are as many different ways to molest your XCode settings to make this work as there will be XCode developers who'll ever try it, so whatever fits in with your workflow, run with it.

Gary (-;

PS The *really* cool people build ODE as a framework that can be copied into your ~/Library/Frameworks dir, then draggy the framework into your XCode project. Then in your project, add that ODE framework to the build target's "Copy Files" stage. Then you don't have to do anything to your XCode settings, and people get to modify their local ODE [LGPL HIPPY ALERT] in what you send them.
#35
10/30/2006 (7:14 pm)
@Richard: I'm not sure why you wouldn't have a capped cylinder in your build, I'm pretty sure it's in the default getup.

On the other hand, I don't use capped cylinders in my oderocks anywhere, so there's always the option of just snipping lines 49 to 67 of tmassconsole.cc. You'd be left without a capped cylinder default. This isn't a problem, since:

ConsoleMethod(tdMass, SetParameters, void, 12, 12,
	"(themass, cgx, cgy, cgz, I11, I22, I33, I12, I13, I23) "
	"Set parameters on the mass") {

	argc; argv;
	dMassSetParameters(&object->mass, dAtof(argv[2]), dAtof(argv[3]),
		dAtof(argv[4]), dAtof(argv[5]), dAtof(argv[6]),
		dAtof(argv[7]), dAtof(argv[8]), dAtof(argv[9]),
		dAtof(argv[10]), dAtof(argv[11]));
	object->setMaskBits(object->NewMass);
}

You can reimplement ANY of the other tdMass->Set{body shape default thing} using that call, it's just a pain to do :-D

Gary (-;
#36
10/30/2006 (7:18 pm)
@Alex: Did you fix the GPF?

Gary (-;
#37
10/30/2006 (7:28 pm)
Yes, I fixed it, I made a chain of balls above the lake, is there a guide on the names of the controls on the gui?

Much fun, I see great potential in this, for me it's just a little choppy

But something strange happend, from now on when I move what's in "example", and rebuild (Aka clean rebuilding) It does not compile to create anything but torqueDemo.exe, and Opengl2d3d.dll, and another dll (I forget which other, I replaced this example with my backup example folder)
#38
10/30/2006 (7:50 pm)
Quote:But something strange happend, from now on when I move what's in "example", and rebuild (Aka clean rebuilding) It does not compile to create anything but torqueDemo.exe, and Opengl2d3d.dll, and another dll (I forget which other, I replaced this example with my backup example folder)

Other than binaries, what's in example/ is what's in example/, and doesn't get recreated. It's like a big sample dataset. Just re-extract that part of your SDK archive.

Quote:a guide on the names of the controls on the gui?

Names of the controls on the GUI? If you mean, the script variables, you can open on the GUI Editor, or physicsDlg.gui, and just read the names straight off the controls. They shoudl also be described and documented in physicsdefaults.cs

Gary (-;
#39
10/31/2006 (3:53 am)
@Gary: thanks for all the sugestions, but I think the problem isn't with the linker because when I added ode to the object or a library search path it still gives me the same errors, but removing the .dylib added a bunch of new undefined symbols. Maybe I'm just missing some files but for ode script I have:
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/odehelper.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/odehelper.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/odeshape.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/odeshape.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tbody.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tbody.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tbodyconsole.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tcontact.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tcontact.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tcontactconsole.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tjoint.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tjoint.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tjointconsole.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tmass.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tmass.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tmassconsole.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/torque_ver.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tworld.cc
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tworld.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/game/tworldconsole.cc
and for ODE I have
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/collision_space.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/collision_trimesh.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/collision.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/common.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/compatibility.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/config.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/contact.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/error.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/export-dif.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/mass.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/matrix.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/memory.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/misc.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/objects.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/odecpp_collision.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/odecpp_old.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/odecpp.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/odemath.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/rotation.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/timer.h
/Torque Game Engine 1.5 SDK/Torque SDK/engine/ode/ode.h
(and libode.a in /Torque Game Engine 1.5 SDK/lib/libode.a)
All files included in my project except the odelib.a at times, but it doesn't seem to make a difference.
I hope this helps in diagnosing my problem.
#40
10/31/2006 (10:38 am)
Where did you download your version of ODE from? It seems that the only symbols you're missing are for capped cylinders, so did you try removing the code from tmassconsole to create capped cylinders?

Gary (-;