Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Mechanics / Re: Compiling odejava natives on: 2005-04-09 08:21:27
Oh well, I just read on the ODE mailing list that the ODE makefile actually _does_ compile OPCODE, despite what is said in various ODE documentation.

So, my problems are probably not related to the Odejava makefile, but compiling ODE in general. Therefore, there's no idea in me bugging this list with my problems in this regard. Sorry ;-)

Ole
2  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-04-09 08:17:38
Hi!

You guys rock! Yes, by changing the 4 lines in GeomTriMesh.java, it almost works! Sometimes when I run the demo, all the collisions are detected, and no spheres go through the trimeshes. But sometimes two certain spheres pass through. It's got nothing to do with changing anything in the code, since I don't do that, I just run the demo again and again :-)

This behaviour does seem like a problem with some algorithm based on nondeterministic behaviour, just like I suppose a HashSpace is. (Though I haven't looked at the code, so I don't know if it actually does behave in a deterministic manner.)

I guess this is a big step towards getting rid of these trimesh problems. Let's hope somebody find out how to get rid of the last problems. (My girlfriend needs to use the computer this week-end, so I'm afraid I don't get that many chances at having a look at it...)

Anyway, thanks a lot to you people for the work so far!

Ole
3  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-04-04 18:12:22
Hi!

Fancy. Sounds a bit difficult to reproduce for the rest of us, though. I posted a simple example to this thread some time ago, which demonstrates severe problems in sphere-trimesh collision detection. Perhaps my problems are related to my OS (Fedora Core 3), my processor (an AMD Athlon), the version of Java (5.0, but I've also tried 1.4.2 which has the same behaviour), or the OdeJava version (newest from the archive, with newest natives, but the behavious is similar with newest OdeJava from the CVS, and also some older OdeJava and native versions from the archive). Or a programming error on my side, though nobody has been able to point it out.

I've tried to move the whole scene various combinations of 100 units along the X, Y, and Z axes. The result is weird: In no combination do all the spheres collide correctly, but each sphere changes collision behaviour in various positions.

Since I posted the sample program, I have not had the impression that anybody has tried to compile and run it, although this is a very quick excercise. This could be interesting. Therefore: Is everybody else seeing the same problem as I am, or is it just on my OS, processor, and Java version?

Ole
4  Game Development / Game Mechanics / Re: Compiling odejava natives on: 2005-04-02 16:44:18
Hi William!

Today I tried my luck at compiling the Odejava natives, but without success. To stay clear of trouble, I downloaded the latest certified ODE source files referenced from the Odejava Wiki page, since those sources must have worked for somebody before me :-)

I'm trying to compile the Odejava natives for Linux.

The new Wiki page looks a lot better than the old one, so thumbs up! I'll make a brief summary of what I did in order to make the sources compile:

1: I downloaded the latest certified ODE sources, as described on the Wiki page.
2: I copied user-settings.examples into both user-settings and user.settings (just to make sure I got the right file there - are you sure it should be user.settings, as the Wiki page says?), setting these variables:
PLATFORM=unix-gcc
PRECISION=SINGLE
BUILD=debug
WINDOWS16=0
OPCODE_DIRECTORY=OPCODE
3: I ran make-gcc.sh.

This gives the following error when make-gcc.sh is doing "make ode-lib" from the ode directory:

make: *** [ode/src/collision_trimesh_trimesh.o] Error 1

Later, when make-gcc.sh is making libodejava.so, these errors (or are they strictly speaking just warnings?) occur, and no libodejava.so file is generated:

g++: OPCODE/*.o: No such file or directory
g++: OPCODE/Ice/*.o: No such file or directory

I guess the problem is that make-gcc.sh makes no attempt at compiling OPCODE, although the user-settings.example file states that the ODE build files will not do this for us. Has make-gcc really ever worked, or should I just find out how to compile OPCODE before I start compiling the Odejava natives?

Thanks in advance - any help greatly appreciated :-)

Ole
5  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-14 16:06:52
Hi guys!

Consider using JAXB. It makes XML processing extremely easy. Have a look at this nice introduction:

http://java.sun.com/developer/technicalArticles/WebServices/jaxb/index.html

I'm using it for a project at work, and it works _extremely_ well. As one of my colleagues said recently, it's probably the only third-party product we've ever used that we haven't complained about a single time yet :-)

Well, read the tutorial. You have my guarantee that it really does work as nicely as the article proposes - at least for XML parsing, I haven't yet tried it for generating XML documents. However, it does have some output formatting capability, so I guess it's fine for this too.

Kind regards,
Ole
6  Game Development / Game Mechanics / Re: [odejava] Updating Linux natives on: 2005-03-13 13:20:59
Hi William!

Yes, I read the Wiki page (I assume you mean the OdeJava Wiki page). That's the page I'm referring to in my first posting in this thread. Since the Odejava homepage is down today, I haven't been able to check if it's had any updates since my last check, though.

BTW, compiling odejava (not ODE, or the OdeJava natives, but the pure Java part) directly after checking it out from CVS isn't possible, since some XODE classes require Xerces in the classpath. It's something that should probably be fixed. Either by altering the Ant buildfile (but then again, the CVS repository should include some Xerces jar files that the buildfile can refer to), ripping out XODE to a separate package (I'd go for this if I were in charge), or using an XML parser that comes with J2SE (com.sun.org.apache.xerces seems to come with J2SE 5, I don't know if it's part of J2SE 1.4 as well).

Anyway, just a few thoughts.

Kind regards,
Ole
7  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-13 06:52:13
Hi William!

I've tried different windings of the triangles, and reversing the direction of the normals. Nothing changes the behaviour. I've also tried to translate all of my scenery to various other places to see if that made any change, but I haven't done that systematically, so there may be a chance there.

I tried to boil down my example to just a single static triangle and a single sphere falling down. The sphere falls down nicely, until it hits the triangle, and then my JVM crashes (a HotSpot error, referring to the native ODE trimesh collision function).

Anyway, before spending too much time on that, I think I'll just wait for the new release of the ODEJava natives. Thanks for taking your time to compile a new release of those!!

BTW, William, while compiling the new ODEJava natives, do you think you could spend a little time updating the Wiki page on how to compile them? I still haven't found the Makefile patch (probably because it has moved from the "contrib" folder to the real makefile?), and applying the dCylinder2 patch is not just a matter of following the instructions in the readme file in the "contrib/dCylinder2" folder, I found out. Just a thought, and something I would really appreciate :-)

Kind regards,
Ole
8  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-09 18:02:34
Hi DP!

Thanks for the suggestions. However...

I tried creating boxes instead of spheres, in order to see how they interact with the trimeshes when they fall down. (You can do the same, just alter the createSphere method in my demo.) They interact in exactly the same way with the trimes as the spheres do. And even fall through _exactly_ the same trimeshes.

Setting the normals when creating the trimeshes makes no difference either. Exactly the same behaviour.

A posting on the ODE list looks exactly like this problem:

http://q12.org/pipermail/ode/2005-March/015300.html

However, it's hard to convince people that it's an ODE problem, as opposed to wrong usage of ODE:

http://q12.org/pipermail/ode/2005-March/015302.html

So perhaps there's an obvious mistake somewhere in my code, but I cannot find it. And I cannot find a way to make it even simpler than it is now :-)

Anyway, DP, thanks for your ideas and thoughts. Keep them coming, please ;-)

Ole
9  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-05 19:15:53
Yuippey, I managed to squeeze the demo into a posting small enough for the forum system, hopefully without letting go of too much readability. Please try and compile the above class and just invoke the main method. On my system, the spheres interact with only 2 of the 8 trimeshes, and fall through the rest as if they weren't there.

It's pretty easy for you guys to try and alter various parameters in the system. I've tried everything I could think of (number of contact points per interaction, surface mode, surface bounce, time steps, etc. etc.), but nothing seems to help.

Anyway, now you have something to play with this weekend. Have fun :-)

Ole
10  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-05 19:09:06
package collisionproblem;

import javax.vecmath.*;

import org.odejava.*;
import org.odejava.collision.JavaCollision;
import org.odejava.display.DisplayBin;
import org.odejava.xith3d.OdejavaToXith3D;
import org.odejava.xith3d.Xith3DDisplayObject;

import com.xith3d.render.CanvasPeer;
import com.xith3d.render.RenderPeer;
import com.xith3d.render.jogl.RenderPeerImpl;
import com.xith3d.scenegraph.*;
import com.xith3d.scenegraph.Locale;

public class CollisionProblem {
   // Number of pieces in the ramp
   private int rampPieces = 8;

   // Radius of the middle of the ramp
   private double circleRadius = 20;

   // Width of the ramp
   private double rampWidth = 20;

   // View
   Vector3f viewLocation = new Vector3f(-40f, -40f, 70f);
   Vector3f viewCenter = new Vector3f(0f, 0f, 0f);

   // Variables that are used as in the Odejava-Xith3d examples
   View view;
   Locale locale;
   BranchGroup scene;
   OdejavaToXith3D odejavaToXith;
   DisplayBin boundObjects = new DisplayBin();
   HashSpace space;
   JavaCollision collision;
   World world;

   private static int rampPartNumber;

   public static void main(String[] args) throws Exception {
       CollisionProblem problem = new CollisionProblem();
       problem.render();
   }

   public CollisionProblem() {
       initXith();
       initExample();
       initLights();
       initXithFromOdejava();
   }

   private void initXith() {
       VirtualUniverse universe = new VirtualUniverse();
       view = new View();
       universe.addView(view);
       locale = new Locale();
       universe.addLocale(locale);
       scene = new BranchGroup();
       locale.addBranchGraph(scene);

       // create canvas for our graphics
       RenderPeer rp = new RenderPeerImpl();
       CanvasPeer cp = rp.makeCanvas(null, 1024, 768, 32, false);
       Canvas3D canvas = new Canvas3D();
       canvas.set3DPeer(cp);

       // Set view
       view.addCanvas3D(canvas);
       view.getTransform().lookAt(viewLocation, viewCenter,
               new Vector3f(0, 0, 1));
   }

   private void initExample() {
       Odejava.getInstance();
       world = new World();
       world.setGravity(0f, 0f, -9.82f);
       space = new HashSpace();
       collision = new JavaCollision(world);
       createRamps();
   }

   private void initXithFromOdejava() {
       odejavaToXith = new OdejavaToXith3D(boundObjects);
       Appearance[] apps = new Appearance[] { createAppearance(1f, 0f, 0f),
               createAppearance(0f, 1f, 0f) };
       for (int i = 0; i < 200; i++) {
           odejavaToXith.addUserAppearance("RampPart" + i, apps[i%2]);
       }
       odejavaToXith.createTransformGroups(space.getGeoms());
       Xith3DDisplayObject.addToScene(boundObjects, scene);
   }

   private Appearance createAppearance(float r, float g, float b) {
       Appearance app = new Appearance();
       ColoringAttributes coloring1 = new ColoringAttributes();
       coloring1.setColor(r, g, b);
       app.setColoringAttributes(coloring1);
       return app;
   }

   private void render() {
       while (true) {
           // Collide objects in given space
           collision.collide(space);
           collision.applyContacts();

           // Step simulation
           world.quickStep(.01f);
           boundObjects.updateAll();
           view.renderOnce();

           // Make sure our CPU's don't need to go in 100% usage :-)
           try {
               Thread.sleep(10);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
       }
   }

   private void initLights() {
       Color3f col1 = new Color3f(0.5f, 0.5f, 0.5f);
       Transform3D t = new Transform3D();
       Vector3f pos1 = new Vector3f(0.0f, 0.0f, 30.0f);
       t.set(pos1);
       Vector3f dir1 = new Vector3f(pos1);
       dir1.negate();
       dir1.normalize();
       DirectionalLight light1 = new DirectionalLight(col1, dir1);
       scene.addChild(light1);
       light1.setEnable(true);
   }

   /**
    * Creates Geoms for all the ramp pieces in the world.
    */
   private void createRamps() {
       for (int i = 0; i < rampPieces; i++) {
           createRampGeom(i);
       }
   }

   /**
    * Creates Geom for a single ramp piece in the world.
    */
   private void createRampGeom(int i) {
       Point3f beforeLeft = getInnerPoint(i - 1);
       Point3f beforeRight = getOuterPoint(i - 1);
       Point3f afterLeft = getInnerPoint(i);
       Point3f afterRight = getOuterPoint(i);

       int vertexCount = 4;
       int indexCount = 2;

       float[] vertices = new float[vertexCount * 3];
       int[] indices = new int[indexCount * 3];

       int beforeLeftIndex = 0;
       int beforeRightIndex = 1;
       int afterLeftIndex = 2;
       int afterRightIndex = 3;

       fillVertex(vertices, beforeLeftIndex, beforeLeft);
       fillVertex(vertices, beforeRightIndex, beforeRight);
       fillVertex(vertices, afterLeftIndex, afterLeft);
       fillVertex(vertices, afterRightIndex, afterRight);

       fillIndex(indices, 0, beforeLeftIndex, afterRightIndex, afterLeftIndex);
       fillIndex(indices, 1, beforeRightIndex, afterRightIndex,
               beforeLeftIndex);

       String name = "RampPart" + rampPartNumber++;
       GeomTriMesh rampGeom = new GeomTriMesh(name, vertices, indices);
       space.addGeom(rampGeom);

       // Create a couple of spheres, to demonstrate the collision problems
       createSphere(beforeLeft, beforeRight, afterRight);
       createSphere(beforeLeft, beforeRight, afterLeft);
   }

   /**
    * Creates a sphere in the middle of the 3 given points
    */
   private void createSphere(Point3f p1, Point3f p2, Point3f p3) {
       GeomSphere sphere = new GeomSphere(1);
       Body b = new Body(null, world, sphere);
       b.setSphereMass(1, 1);
       b.adjustMass(80);
       b.setPosition((p1.x + p2.x + p3.x) / 3, (p1.y + p2.y + p3.y) / 3, 7);
       space.addBodyGeoms(b);
   }

   private Point3f getInnerPoint(int i) {
       return new Point3f(getInnerX(i), getInnerY(i), 3);
   }

   private Point3f getOuterPoint(int i) {
       return new Point3f(getOuterX(i), getOuterY(i), 3);
   }

   private float getInnerX(int i) {
       return (float) (Math.cos(getAngle(i)) * (circleRadius - (rampWidth / 2)));
   }

   private float getOuterX(int i) {
       return (float) (Math.cos(getAngle(i)) * (circleRadius + (rampWidth / 2)));
   }

   private float getInnerY(int i) {
       return (float) (Math.sin(getAngle(i)) * (circleRadius - (rampWidth / 2)));
   }

   private float getOuterY(int i) {
       return (float) (Math.sin(getAngle(i)) * (circleRadius + (rampWidth / 2)));
   }

   private double getAngle(int i) {
       return (double) i / (double) rampPieces * (double) 2 * Math.PI;
   }

   private void fillVertex(float[] vertices, int index, Point3f point) {
       vertices[index * 3 + 0] = point.x;
       vertices[index * 3 + 1] = point.y;
       vertices[index * 3 + 2] = point.z;
   }

   private void fillIndex(int[] indices, int index, int p1, int p2, int p3) {
       indices[3 * index + 0] = p1;
       indices[3 * index + 1] = p2;
       indices[3 * index + 2] = p3;
   }
}
11  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-05 12:32:44
So, nobody interested? :-) Anyway, I've done my work and made a little demonstration of my problems. Unfortunately, I cannot post it to this forum, since it would make my post too long (I already tried, yes ;-) ). If anybody has an idea about where I can put my code, please send a note.

(The rest of this posting assumes you have my code...)
Take the code and compile it. I've put it all in one class, for your convenience. Run it, and feel puzzled :-)

I guess this demo clearly shows that Ode or Odejava has problems with Trimesh collisions, unless I made a basic bummer somewhere in my code.

BTW, I'm using the latest Odejava files available at the Odejava homepage, and I'm running on Linux. If anybody running other versions or using other OS'es don't see a problem when running my demo, please let me know ;-)

Enjoy!

Ole
12  Game Development / Game Mechanics / Re: [odejava] Updating Linux natives on: 2005-03-03 18:56:38
Hi William!

Thanks for the reply. I've still got no clue as to how to apply the cylinder2 patch, and where in the world I should get the Makefile patch, but this is a start ;-)

Fiddling a little with the sources once I get the build environment working is no problem. I'm not new to C or Java, I just have a problem with makefiles - they sometimes seem to live their own life. (I like Ant a whole lot more!) Besides, I thought the Odejava build process was simple, i.e. simple enough that somebody had made it automatic. But I seem to be wrong.

On a slightly related note, are there any plans for a new "real" Odejava release? Seeing that the newest release is from the 30th of October, and quite a few small fixes have been applied to the Ode CVS repository, I guess other people than me could use a freshly built Odejava.

Ole
13  Game Development / Game Mechanics / Re: [odejava] Weird GeomTriMesh problems on: 2005-03-03 18:48:17
Hi!

Just a quick note: I have exactly the same problem - my car in my game passes through some of my trimeshes, and stay on top of others. I've no idea what makes it pass through some trimeshes and not others, as the trimeshes are very alike, they are only turned a little compared to each other (i.e. the lengths of the sides of the trimeshes are identical).

I could strip down my "wannabe-game" to a simple example showing the problem, if that could be of any use. (If somebody already has a simple example program showing the problem, I won't spend my time on that, but otherwise I'll do it in the weekend!) I don't know where to upload my source files in that case, though, as I don't have a home page of my own :-)

Ole
14  Game Development / Game Mechanics / [odejava] Updating Linux natives on: 2005-02-26 09:26:43
Hello!

I'm trying to update my odejava Linux natives using the description on the odejava.org homepage (the "Docs" tab, the "Compiling/Updating Odejava Natives"). However, the description is either very old or just not working for me :-)

I'm using Fedora Core 3, if that's of any interest. Let's see what I've tried, and what doesn't quite seem to work for me:

1: Grab latest ODE CVS: No problem.
2: Apply cylinder2 contrib patch: Don't know how to do it. I try to "cd contrib/dCylinder2/", and then "patch dcylinder2.patch", but it does nothing. I've tried other invocations of the "patch" command as well, but none seem to work.
3: Apply Makefile patch: Where can I find it?
4: Edit user.settings: I suppose it should read "copy config/user-settings.example to config/user-settings, edit so the correct operating system and debug mode is selected". No problem.
5: Just run make-gcc: make-gcc doesn't seem to be a standard part of Fedora Linux, so I just try "make" and "gmake". None of these make the compilation work.

One of my problems is that the ODE makefile assumes that I have already compiled OPCODE, but OPCODE is, as far as I can see, in a Windows-only state in ODE's CVS repository. Perhaps the "Makefile patch" solves this for me, if I can find it?

Please please please, can anybody help me here? :-) I guess somebody must have been able to do it before ;-)

Thanks in advance,
Ole

PS: If you're wondering why I'd like to update the odejava natives, it's because the trimesh collision doesn't seem to work for me. I'm writing a game with a car (made out of a box and 4 spheres, just like the Ode and Odejava-xith3d demos) on some ramps (made out of trimeshes), and my car falls through a lot of the trimeshes. Not all of them, but about half of them. All trimeshes have the same size and orientation, so it doesn't seem to be a problem related to size, as some of you have in another thread in this forum. Since some fixes to trimeshes have been submitted to the Ode CVS, I thought it might be worth a try.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (12 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (29 views)
2014-07-23 21:07:15

Riven (30 views)
2014-07-23 20:56:16
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!