Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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: how to use (for beginners)  (Read 4360 times)
0 Members and 1 Guest are viewing this topic.
Offline Jani Laakso

Junior Member




Do it with Java!


« Posted 2003-12-12 05:23:45 »

I have started this thread for Odejava beginners. If you have any questions on how to get started with Odejava then post your message here.

In here you can ask e.g. how to create various objects, create fixed enviromental objects (e.g. racing track with ramps), or how to attach an box into a sphere with a joint (e.g. car chassis with 2-axis joint on wheels) and so on.

Currently best source for getting started with Odejava is package net.java.dev.odejava.test. Simplest scenario is OdeHelloWorld.java.

Binding odejava's objects into 3d renderer is simple. Check e.g. package net.java.dev.odejava.jme.test. There is a BoxApp.java class that constantly reads translation and rotation information for each object from OdeBox.java class and updates this information to jME objects before rendering the scene.

http://odejava.dev.java.net has a package called odejava-0.1.1-full.zip, all sources included.
Offline Jani Laakso

Junior Member




Do it with Java!


« Reply #1 - Posted 2003-12-14 17:44:43 »

I'll be adding few simpler demos later showing how to implement a specific physic setup with odejava. Something as simple as getting started tutorials with Xith3d. E.g. how to create simple objects, static objects, how to use various joints, how to apply forces to an object and finally how to bind ode objects to your 3d library (xith3d, jme, openmind etc.). What do you think, these are pretty simple but might help the understanding of Odejava at first glance, how important is this?

In the meantime you can ask your question here (or by writing email to me).

Please suggest demos than should be added to the getting started section or other ideas that you might have. Java API itself is ready but there's always room for making it better.

PS. New package and CVS will be released in a couple days.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2003-12-18 02:20:37 »

an Ode getting started guide for Xith3D would be very good indeed.

How is ode at handling terrain?  I currently generate terrain using a random fractal generator (essentially just making quads) and I am woundering how hard it would be to integrate it with ode and a vehicle.

Thanks,

Will.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jani Laakso

Junior Member




Do it with Java!


« Reply #3 - Posted 2003-12-20 10:22:05 »

Terrain is added to Odejava 0.2 along with nicer API also.

Terrain is basically defined by heights and length. If you want to check how it is implemented then see ode/contrib/TerrainAndCone/readme.txt

I am sure it works with Odejava also but rendering the terrain needs to be done. it would be excellent if you can write an Xith3d routine that draws the terrain, see ode/contrib/TerrainAndCone/readme.txt and see the method dsDrawTerrain.  Should not be too complicated, the routine just draws filled triangles with couple lines of code. I try to concentrate on releasing the new version, contact me if you need help with this one!

Trying to release version 0.2 this weekend.
Offline Jani Laakso

Junior Member




Do it with Java!


« Reply #4 - Posted 2003-12-20 10:45:06 »

Here's how you create terrain on Odejava 0.2.

---
int terrainNodes = 4;
float[] heights = new float[terrainNodes* terrainNodes];
float length = 4f;
float height = 0.5f;
int numNodesPerSide = 4;
for (int i=0;i<terrainNodes* terrainNodes;i++)
 heights = height * (float) Math.random();
GeometryTerrain terrain = new GeometryTerrain(space, heights, length, numNodesPerSide);
---

Please write to me if anyone wishes to create Xith3d routine that renders this terrain. I think this is pretty easy for anyone that is familiar with 3d.

In practise the routine below needs to be made with Java.

---
void dsDrawTerrain(int x,int y,float vLength,float vNodeLength,int nNumNodesPerSide,float *pHeights)
{
       float A[3],B[3],C[3],D[3];
       float R[12];
       memset(R,0,sizeof(R));
       R[0] = 1.f;
       R[5] = 1.f;
       R[10] = 1.f;
       float pos[3];
       pos[0] = pos[1] = pos[2] = 0.f;
       float vx,vy;
       vx = vLength * x;
       vy = vLength * y;
       
       int i;
       for (i=0;i<nNumNodesPerSide;i++)
       {
               for (int j=0;j<nNumNodesPerSide;j++)
               {
                       A[0] = i * vNodeLength + vx;
                       A[1] = j * vNodeLength + vy;
                       A[2] = GetHeight(i,j,nNumNodesPerSide,pHeights);
                       B[0] = (i+1) * vNodeLength + vx;
                       B[1] = j * vNodeLength + vy;
                       B[2] = GetHeight(i+1,j,nNumNodesPerSide,pHeights);
                       C[0] = i * vNodeLength + vx;
                       C[1] = (j+1) * vNodeLength + vy;
                       C[2] = GetHeight(i,j+1,nNumNodesPerSide,pHeights);
                       D[0] = (i+1) * vNodeLength + vx;
                       D[1] = (j+1) * vNodeLength + vy;
                       D[2] = GetHeight(i+1,j+1,nNumNodesPerSide,pHeights);
                       dsDrawTriangle(pos,R,C,A,B,1);
                       dsDrawTriangle(pos,R,D,C,B,1);
               }
       }
}
---
Offline Jens

Senior Member




Java for games!


« Reply #5 - Posted 2003-12-21 08:06:21 »

In the Xith3D forum, there is a thread about building odejava on Mac OS X.

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

Junior Member




Do it with Java!


« Reply #6 - Posted 2003-12-21 11:55:10 »

Thanks for the tip, I'm busy gettin odejava 0.2 out and setting up the CVS. Low level API is now fully supported through ODE C API, high level API is almost finished after this is done I'll release 0.2.

PS. It supports TriMesh and also some contrib sections like Terrain, Cone and Cylinder.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #7 - Posted 2003-12-21 22:23:31 »

Just incase anyone else is following this thread (Jani has already been emailed the code) - the Xith3D method to build the terrain from a heightmap is finished - I'm releasing the code along side some other handy modular 3D related stuff in a small library named "Enviro3D (e3d.jar)".  I'll bung it in the xith-tk projects cvs in due course.

Also included will be a random fractal terrain generator which I ported from C.

Will.

Offline Jani Laakso

Junior Member




Do it with Java!


« Reply #8 - Posted 2003-12-22 06:29:55 »

Hope you get to try odejava.org.geom.GeomTriMesh also Smiley

Terrain works nicely on Odejava 0.2 but rendering has still some issues, surely William can fix them.
Offline Jens

Senior Member




Java for games!


« Reply #9 - Posted 2003-12-22 11:08:49 »

I'm really looking forward to the next ODE release and the Xith3D terrain stuff sounds very interesting, too.  Smiley Please don't keep these things to yourselves. Get them out, soon.  Grin

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

JGO Coder


Projects: 2


Fire at will


« Reply #10 - Posted 2003-12-23 08:02:02 »

update: I think I've fixed the terrain problemo.

The new high-level ode objects are most convenient.  It'll be good when its in CVS (hopefully this will be soon) Smiley

Will.

Offline Jani Laakso

Junior Member




Do it with Java!


« Reply #11 - Posted 2003-12-23 11:04:05 »

Odejava 0.2 is going to CVS now.. It should be there in half an hour or so.
Offline otelo

Junior Member





« Reply #12 - Posted 2006-03-08 13:03:13 »

Thanks for the tip, I'm busy gettin odejava 0.2 out and setting up the CVS. Low level API is now fully supported through ODE C API, high level API is almost finished after this is done I'll release 0.2.

PS. It supports TriMesh and also some contrib sections like Terrain, Cone and Cylinder.


It's been more than two years, but GeomCone support is still missing. Am I overlooking something? Is it even in the native library ?
Offline NewbTon

Junior Member




Odejava games rock!


« Reply #13 - Posted 2006-03-08 15:27:05 »

Damn I read this entire thread before I found out it was from 2003  Cheesy
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #14 - Posted 2006-03-08 17:22:45 »

 Grin Grin

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #15 - Posted 2006-04-28 16:29:14 »

Some documentation at least was created in that time Smiley

http://www.java-gaming.org/forums/index.php?topic=12150.0

Will.

Offline PeteTheNotSoGr8

Junior Newbie





« Reply #16 - Posted 2006-04-28 16:33:24 »

In the most recent documentation it says that the terrain call has been disabled.  Is this actually the case?  If so does anyone know why?

In case I can't use the preprogrammed terrain generator, what is an appropriate size for the triangles in a GeomTriMesh that is serving for the terrain.  My current count takes to long to run through and I run into timing issues with other threads starting their shit before I am ready for that to happen.

BTW I am doing fractal terrain based on the Diamond-Star method, if that helps find a solution.

Thanx for any help you can give me.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #17 - Posted 2006-04-29 05:21:51 »

I also implemented fractal based terrain, and used GeomTriMesh's.  The Terrain thing was a patch to ODE that was not commented or documented and didn't work.  GeomTriMesh is a more generic case, but should work well for terrain.

Will.

Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #18 - Posted 2006-04-29 12:02:25 »

I also implemented fractal based terrain, and used GeomTriMesh's.  The Terrain thing was a patch to ODE that was not commented or documented and didn't work.  GeomTriMesh is a more generic case, but should work well for terrain.
I had bad experiences on this one.. Objects falling through the terrain, and other bugs like that..

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline PeteTheNotSoGr8

Junior Newbie





« Reply #19 - Posted 2006-05-05 16:37:36 »

William Denniss,
Could you post a link to the source code for your terrain.  I seem to have everything working but it just won't pick up the collision with the surface.  The exact same code works with the GeomPlain terrain, pretty well but I just can't make it go for that third dimension.
Offline horizon_w

Junior Newbie





« Reply #20 - Posted 2006-05-17 04:26:35 »

     I'm the beginnner of ODEjava. I found the resources have little difference between the CVS and odejava.org----there have different jar files. I choose to run the code  from the odejava.org on the netbean, they have been compiled correctly, but when I choose to run a project of odejava ,I saw nothing! even the sample. Can u help me to slove that?
     I found the my package strcture are not  as same as what have been mentioned above.
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.

ctomni231 (32 views)
2014-07-18 06:55:21

Zero Volt (28 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (25 views)
2014-07-16 23:30:00

Cero (40 views)
2014-07-16 00:42:17

Riven (42 views)
2014-07-14 18:02:53

OpenGLShaders (29 views)
2014-07-14 16:23:47

Riven (29 views)
2014-07-14 11:51:35

quew8 (26 views)
2014-07-13 13:57:52

SHC (63 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!