Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Odejava version 0.2  (Read 5318 times)
0 Members and 1 Guest are viewing this topic.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Posted 2003-12-23 10:15:46 »

Odejava version 0.2 is released. I am commiting the files now. See http://odejava.dev.java.net for information on how to checkout it from the CVS. You can also browse project files and documentation using your browser.

I have started this thread for people to comment Odejava's higher level API and other support libraries like Xith3D toolkit library.

Higher level API has just been started.
All comments are welcome. Documentation is not complete, also API still needs some work. There exists couple examples that show you how easy it is to use.

Lower level API is stable and works very well.
There exists one simple example, documentation from ODE's own site works perfectly as the API is one to one with ODE's own interface.

Toolkit: Odejava-Xith3D
There exists a helper class which automatically binds Odejava objects into Xith3D shapes (or transformgroups if the object is complex).

Toolkit: Odejava-Jme and Odejava-Openmind
These are coming up.


Happy Christmas for everyone!
Offline aNt

Senior Devvie




AFK


« Reply #1 - Posted 2003-12-23 20:36:11 »

nice one dude  Grin
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #2 - Posted 2003-12-28 16:38:24 »

I made some enhancements and fixes to the CVS, but there's still a problem with linux platform and TriMesh. This is pure ODE problem (OPCODE actually) and it's top priority currently to get this fixed, win32 version works fine.

The binding from Odejava into Xith3d works quite nice currently, it's pretty easy to define objects in Odejava and get them to Xith3d automatically or by telling what ASE object , appearance or Shape3D you wish to use for given Odejava object. Check the Car demo source and tell me if you have any ideas on how to develop it further.

I hope we get the JWS demos running soon and also new website.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jens

Senior Devvie




Java for games!


« Reply #3 - Posted 2003-12-29 08:08:04 »

Are there plans to create a binding from Xith3D to ODE (currently it is ODE->Xith3D)? For instance I'd like to load an ASE model in Xith3D and add it to the ODE world.

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2003-12-30 00:27:02 »

The problem with that is that usually the 3D geom would be more complex than it's ODE representation (for example spokes in a wheel).

You'd have to give ODE many hints on how to represent it.  Eg. Should a mesh be represented by TriMesh or by it's bounding box?  Other things such as Spheres are harder again - loaded from an ASE file they are mearly meshes.  Another thing that you don't get is the relationship's between the objects - how do you know the properties of a hinge or joint?

All of the above questions I guess could be answered if we had a seperate (.ode?) file which stored the ODE properties and a reference to the ASE file.

However I don't think a simple Xith3D/ASE->ODE would work.

Personally I think just constructing the ODE objects then adding Xith3D TG's to them is acceptable.

Will.

Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #5 - Posted 2003-12-30 05:41:34 »

William, I've though the same thing but for now I've decided to go other way around (define physics in Odejava and offer simple OdejavaToXith3d helper class for users). It's simpler and I got first implementation out very fast.

However for the future, here's an interesting thread:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1072726004;start=0

It contains a project that aims defining Xith3D world (objects) on XML. This alone is nice but why not to extend it a bit and add also physical attributes to every object? This is quite simple to accomplish, but would require some work to make good XML definition.

Below is my post if anyone has any thoughs on how to go with this further on Odejava side:

---

For each object one could define:

1. identity (or name) of object

2. collision primitive(s)
-geometry data like sizex,y,z (e.g. box)
-local position (x,y,z)
-complex composite objects have multiple primitives

3. mass distribution
-e.g. simply mass size which is centered

4. surface parameters
-frictions, bounciness..

There should be also common physics XML definition for the world itself that contains e.g. gravity or common friction values etc. Also joint node's would be good, these bind two different objects to each other (e.g. leg to body) and define their attributes (how much can I move my leg related to my body) and so on.

After these definitions, not only Xith3D objects but also their physic engine objects could be created automatically using XML definition, both sides would be neatly in the same place.

Here's one thing I'd like to clarify for people that haven't used physic engines yet. Why to define primitives two times per object, once for scenegraph (Xith3D) and once for physics engine? Think for example a human, it's quite complex object for 3D renderer, but for physics engine it consists of a sphere (head), cylinders (neck, arms, legs) and a torso (box). As physics calculations are quite complex it's best to simplify objects as much as possible on the physics engine side.

---
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #6 - Posted 2003-12-30 06:01:49 »

Quote
Are there plans to create a binding from Xith3D to ODE (currently it is ODE->Xith3D)? For instance I'd like to load an ASE model in Xith3D and add it to the ODE world.


As William pointed out, I feel that this would not work for obvious reasons. But e.g. on Car demo I did this:

1. Load your ASE object into Xith3D TransformGroup
-on car demo I loaded tire and rim mesh into wheelTransformGroup Xith3D object.

2. Set your own object (here an TransformGroup) into Odejava object
odejavaToXith.addUserTransformGroup(
 "wheelFrontLeft",
 wheelTransformGroup);

Of course here the caveat is that you have to manually create this object's physical side on Odejava. Here the Body named "wheelFrontLeft" is simply org.odejava.GeomSphere object that simulates an wheel.


Offline Jens

Senior Devvie




Java for games!


« Reply #7 - Posted 2004-01-01 17:31:14 »

How can I handle scaled objects (scaling needed to let objects appear smaller)? Let's say you have the following path in the scenegraph:

...
 |
TransformGroup, which scales by the factor x (not 1)
 |
TransformGroup, which is modified by ODE
 |
...

This propably won't work, because ODE's internal coordinates differ from the visible ones. How can this be done?

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #8 - Posted 2004-01-04 13:55:46 »

Quote
How can I handle scaled objects (scaling needed to let objects appear smaller)?


I added a method called setScale to org.odejava.xith3d.OdejavaToXith3D class. You can try it out yourself. Basically I added these two lines to following methods: createTransformGroups() (scale when objects are being created), updateBodyTGs() (scale when dynamic objects are being updated) and updateGeomTGs() (scale when static objects are being updated):
// Scale objects visually
t3d.setScale(scale);
t3d.scaleTranslation(scale);

And there's also getter and setter for the scale attribute.

This should do the trick for you. Do a CVS update and give it a shot.
Offline Jens

Senior Devvie




Java for games!


« Reply #9 - Posted 2004-01-04 14:22:42 »

I don't currently need the feature anymore. However I tested it and it seems to work better, but it doesn't collide with other objects when it should. I didn't really run a useful test. If I need scaling again and experience problems I'll tell you.

Xith3D Getting Started Guide (PDF,HTML,Source)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #10 - Posted 2004-01-04 14:31:58 »

Quote
I don't currently need the feature anymore. However I tested it and it seems to work better, but it doesn't collide with other objects when it should. I didn't really run a useful test. If I need scaling again and experience problems I'll tell you.


Actually, the proper solution would be to add uniform scaling into org.odejava.Body and org.odejava.Geom classes. Every getPosition, getQuaternion etc. method should be scaled accordingly.

So, if you use OdejavaToXith3D.setScale(0.2f) then you have to scale all Odejava position and translation calls aswell, then scaling should work as you want.
e.g. on your app. do:

Vector3f position = myWorld.getBody("car").getPosition();
position.scale(0.2f);
Quat4f quat = myWorld.getBody("car").getQuaternion();
quat.setScale(0.2f);

Not too convinient, but it works.

---

Summarum, the OdejavaToXith3D is wrong place for scaling, the right place to do scaling is on Body and Geom objects. I'll add this to todo list and ask some opinions from other people also.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #11 - Posted 2004-01-04 14:43:37 »

I'd like to ask an opinion from you guys. Usually Odejava objects are best to keep under certain scale because of ODE.
But on the Xith3D side people usually would like to scale all Odejava objects e.g. bigger. The right place to do this is to add scaling factor to every position and translation methods in Geom and Body objects.

Because Body.getPosition() and Body.getQuaternion() calls are made very often (once per object per frame), do you see any performance loss on following code:
public Vector3f getPosition() {
       return new Vector3f(
           Ode.floatArray_getitem(posArray, 0),
           Ode.floatArray_getitem(posArray, 1),
           Ode.floatArray_getitem(posArray, 2));
   }

comparing to this code:
public Vector3f getPosition() {
      if (scale != 1) {
          Vector3f result = new Vector3f(
               Ode.floatArray_getitem(posArray, 0),
               Ode.floatArray_getitem(posArray, 1),
               Ode.floatArray_getitem(posArray, 2));
          result.scale(scale);
          return result;
      } else {
         return new Vector3f(
           Ode.floatArray_getitem(posArray, 0),
           Ode.floatArray_getitem(posArray, 1),
           Ode.floatArray_getitem(posArray, 2));
      }
   }

I am not too good at JVM optimization but my gut feeling says that this does not affect to performance in any way, JVM optimizes these things very nicely, or am I complete fool on this case?


Below is an explanation taken from ODE FAQ:
---
12.8. Should I scale my units to be around 1.0 ?

Say you need to simulate some behavior on the scale of a few millimeters and a few grams. These small lengths and masses will usually work in ODE with no problem. However occasionally you may experience stability problems that are caused by lack of precision in the factorizer. If this is the case, you can try scaling the lengths and masses in your system to be around 0.1..10. The time step should also be be scaled accordingly. The same guideline applies when large lengths and masses are being used.

In general, length and mass values around 0.1..1.0 are better as the factorizer may not lose so much precision. This guideline is especially helpful when single precision is being used.
---
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #12 - Posted 2004-01-05 04:31:53 »

Quote
I made some enhancements and fixes to the CVS, but there's still a problem with linux platform and TriMesh. This is pure ODE problem (OPCODE actually) and it's top priority currently to get this fixed, win32 version works fine.

I forgot to mention that Linux version has been on the CVS for a while (compiled with latest GCC under Fedora). TriMesh problems have been fixed.

If anyone needs mac version and has problems compiling the library, feel free to ask help through these forums. MacOS library will get to the CVS eventually.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #13 - Posted 2004-01-07 06:40:57 »

Here's a small screenshot of CarTerrain simulation with Odejava using Xith3D. It works pretty nice even though it has quite a large terrain. This is with a 2GHz processor and with good GPU. However, I've made zero optimizations or tweaks, e.g. all objects are on the same space. But the code is very simple. This scenario has following Odejava objects:
-single TriMesh consisting of 6144 vertices (terrain)
-200 boxes
-25 spheres
-bridge made out of boxes
-car (boxes + 4 wheels with hinges)
Collisions seems to work nicely. However I noticed problems with boxes that are a lot bigger than terrain's vertices (single triangle).

Screenshot link:
http://cray.tuug.org/~jani/odejava/carTerrain.JPG
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #14 - Posted 2004-01-07 07:27:31 »

Quote
Are there plans to create a binding from Xith3D to ODE (currently it is ODE->Xith3D)? For instance I'd like to load an ASE model in Xith3D and add it to the ODE world.


You can create Odejava TriMesh objects out from ASE file easily. If you want I can send you the code, basically it's only passing vertices and indexes to org.odejava.GeomTriMesh constructor. I did this on CarTerrain example where I loaded the Terrain made with 3dstudio (CarTerrain example is not yet on CVS).
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #15 - Posted 2004-01-08 01:55:56 »

I have created a class named Xith3DToOdejava which can handle Xith3D to Odejava conversions.  Currently only IndexedTriangleArray to GeomTriMesh is supported.

I needed this method for a (BSD) Xith3D/Ode terrain generation library I am currently writing so I thought I may as well plonk it in.

I will be adding some more which can create an Odejava box based on the bounding box of a xith3d object (be it a mesh or whatever).  The reason this is usefull is that TriMesh isn't always needed and a simple bounding box will do.

Will.

Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #16 - Posted 2004-01-08 16:49:01 »

I decided to add CarTerrain files directly to the CVS, so now there are following new files in the CVS:
org.odejava.xith3d.test.CarTerrainExample
org.odejava.test.car.CarTerrain
terrain.ASE

This demo, like all others (except one lower level demo) are using the new higher level API. I suggest you use it as much as you can and extend it with lower level API as needed.

This newer demo has better controls, you have to keep keys down in order to accelerate the car in high speed or to steer it some direction, like in traditional games if you wish. It's also easier to drive around as the friction is lower.

Note that the terrain is bit rough and steep in many places. Well, it's my first terrain with 3d studio Smiley
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #17 - Posted 2004-01-13 12:47:55 »

Excellent work! If you compare the result with number of lines of code for the CarTerrain, it is in a class of it's own! Cheesy

While testing your stuff I had a couple of problems that other people might encounter as well.
First of all, if the landscape doesn't have any texture on it, it is because the path to the texture is absolute. In the terrain.ASE file change
*BITMAP "D:\eclipse\workspace\odejava\odejava\odejava-xith3d\data\images\groundandtrees3.png"
to
*BITMAP "data\images\groundandtrees3.png"
and things should look a bit nicer. (Maybe something that Jani could change in CVS as well when you get a chance.) When debugging this I also noticed that highlighting effects only took place on backside of the terrain mesh. Drive around so that the viewpoint will end up below the surface and you will see it. Guess this is a Xith/JOGL issue. I am sure someone knows the answer to that one right away, and maybe even how to let the car cast a shadow on the ground anyone? I know this is a ode demo, but that would be so nice!

I also got some strange error messages regarding reading the ASE file. That was related to the ASE reader didn't like the linebreaks in the file (tireAndRim.ASE). Converting it to Unix style fixed the problem (or just dl that file direct from the web instead of WinCvs also fixed it).

Hope this can be of help to someone. If you haven't already tried it you should! Really cool stuff! Thanks Jani!  Cool

Offline Akatere

Innocent Bystander




Java games rock!


« Reply #18 - Posted 2004-01-20 12:33:38 »

Quote

If anyone needs mac version and has problems compiling the library, feel free to ask help through these forums. MacOS library will get to the CVS eventually.


I succeeded to compile libode.dylib, but can't compile libjavaode.jnilib, in my MacOSX 10.3.2.
I read "compliling-macosx.rtf", the command:
g++ -W -Wall -Llib -dynamiclib -o lib/libodejava.jnilib net/java/dev/odejava/ode/odejava_wrap.o net/java/dev/odejava/ode/odejava.o -lode -framework JavaVM
makes following errors;
/usr/bin/libtool: internal link edit command failed
ld: Undefined symbols:
_dCreateTriMesh
_dGeomTriMeshDataBuild
_dGeomTriMeshDataBuildSimple
_dGeomTriMeshDataCreate
_dGeomTriMeshDataDestroy
_dGeomTriMeshGetPoint
_dGeomTriMeshGetTriangle

Please, fix TriMesh problem for macosx.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #19 - Posted 2004-01-23 04:01:17 »

Quote
Excellent work! If you compare the result with number of lines of code for the CarTerrain, it is in a class of it's own! Cheesy

Thank you, I would say that this is all because of ODE Smiley

Higher level API is very young still, there are some design issues that need to be solved but for simpler demos it is very usable.

I'd like to hear if anyone has made a big world (using multiple spaces) with Odejava. I know some people are looking into this.

Quote

the path to the texture is absolute. In the terrain.ASE file


Good point, I'll fix this next time I do changes to Odejava.
I will also check the ASE file's linebreaks.

About your renderer related questions. Better graphics (like shadows) are always welcome, I assume e.g. Xith3d does not support "easy" shadows feature just yet, hopefully this will be added soon.

PS. If you start an project with Odejava, be sure to write your questions, and screenshots Cool, here.

Cheers, Jani!
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #20 - Posted 2004-01-23 04:10:18 »

Quote


I succeeded to compile libode.dylib, but can't compile libjavaode.jnilib, in my MacOSX 10.3.2.
I read "compliling-macosx.rtf", the command:

Please, fix TriMesh problem for macosx.


compiling-macosx.rtf is currently deprecated, the author of this document told me that new version is coming, I do not know the exact date though. This document is for earlier versions of Odejava.

But.. if you got ODE compiled properly then the rest should  go fine. Please check file:
odejava/odejava/compile/compiling-gcc.txt
Especially the last g++ line that links odejava library, you are missing some objects from your link command (TriMesh objects). On compiling-gcc.txt last line has all objects explicitly added as parameters to the linker. This command was used to compile linux library for current Odejava.


For last resort, here's an extract from my mac friend's mail:
c++ -bundle -I/System/Library/Frameworks/JavaVM.framework/Headers  -DHAVE_STRSTREAM -o libjavaode.jnilib -framework JavaVM -I include  net/java/dev/odejava/ode/odejava.cpp  net/java/dev/odejava/ode/odejava_wrap.cxx  ode/src/array.o  ode/src/error.o ode/src/memory.o ode/src/obstack.o ode/src/odemath.o  ode/src/matrix.o ode/src/misc.o ode/src/rotation.o ode/src/mass.o  ode/src/ode.o ode/src/step.o ode/src/stepfast.o ode/src/lcp.o  ode/src/joint.o ode/src/timer.o ode/src/mat.o ode/src/testing.o  ode/src/collision_kernel.o ode/src/collision_util.o  ode/src/collision_std.o ode/src/collision_space.o  ode/src/collision_transform.o ode/src/collision_quadtreespace.o  ode/src/collision_trimesh.o ode/src/collision_trimesh_sphere.o  ode/src/collision_trimesh_box.o ode/src/collision_trimesh_ray.o  ode/src/fastldlt.o ode/src/fastlsolve.o ode/src/fastltsolve.o  ode/src/fastdot.o OPCODE/*.o OPCODE/Ice/*.o

Above was used to link earlier Odejava versions (not current cvs head!), you can use the same syntax but check the objects that you give to this as parameters.

And, if you get the library compiled, send it to me by email and I'll add it to the CVS. Even better if you can give describe the process you used to compile ODE and Odejava, I'll add also that to the CVS.

Let me know if this does not work, I'll ask better instructions from my MacOS friends, Jani.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #21 - Posted 2004-01-23 04:18:30 »

If you have compiled Odejava's native library for MacOS, please send it to me. Even better if you can give out some comments about the required process.

Compiling native library is an task that should not be required from Odejava's users, but MacOS version is still missing from Odejava project. Current CVS contains only linux and win32 library.

If you badly need MacOS library but cannot compile one, then   write a message and I'll harass my extremely busy MacOS friend enough to get one.
Offline ttaranov

Innocent Bystander




Java games rock!


« Reply #22 - Posted 2004-01-25 05:12:58 »

what can I say - ode is almost everything I wanted! 3d physics and graphics in java! The ode->xinth transform is slightly buggy and unfinished (no support for all high level geoms - at least in 0.2 as well as some weird visual sphere deformation issues), however otherwise works perfectly for my needs.

Now we just need to add soft-body and liquid physics into ODE and into odejava and then I'll definitely get everything I'll ever want for a while! Smiley
Keep up the good work!
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #23 - Posted 2004-01-28 04:59:49 »

Quote
The ode->xinth transform is slightly buggy and unfinished (no support for all high level geoms - at least in 0.2 as well as some weird visual sphere deformation issues), however otherwise works perfectly for my needs.

You might pass some more info of the bug(s) you've found. I'm sure there are some, due to very light testing and rapid development Smiley

Yes, one might add CappedCylinder and Cylinder to OdejavaToXith3d class. I think I even have the Xith3d's geometry code lying around somewhere..
Note that current Odejava version does not contain Cone or Terrain objects, but there's TriMesh support that can be used e.g. for static landscape.

About the sphere deformation issues, this has to do with Xith3d only I assume? You can check org.odejava.xith3d.SphereGeometry class and change it, it's Xith3d code only. Or just use user defined object (a'ka link to your own ASE object) to Odejava's spheres if you wish.

Quote

Now we just need to add soft-body and liquid physics into ODE and into odejava and then I'll definitely get everything I'll ever want for a while! Smiley
Keep up the good work!


Way to go ttaranov! Let me know when you have it done, I'll gladly add it to the CVS Grin Seriously, this project has just started, if anyone want's to join Odejava's development team, just raise a hand Smiley

Have fun and be sure to post your screenshots when you get something nice out of Odejava!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (32 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (58 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!