Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 / Artificial Intelligence / Re: Pathfinding method: discussion on: 2007-04-01 00:00:05
That's actually pretty darn clever! I've had a quick look at it and it seems to suit my requirements very well, in that it is as easy to find an alternative shortest route (possibly same amount of node traversals) as it is to find the first. For the purpose I will be applying the pathfinding method for, I will be dealing with an extremely small number of nodes (typically less than 20)...however, possible alternative routes will be vitally important. Thanks for your description.

That said, I am still going to explore the possibilities of the original post. As you may have gathered, I have never really ventured into this realm and I only know algorithms by name, not by nature. Does "my method" bear any resemblance to an existing algorithm? Would be interested to know.
2  Game Development / Artificial Intelligence / Re: Pathfinding method: discussion on: 2007-03-30 15:08:16
I think the dead-easy to implement flood-fill will suffice.

Flood fill? Please elaborate.
3  Game Development / Artificial Intelligence / Pathfinding method: discussion on: 2007-03-30 13:32:15
Hi there

I don't have a specific question per se, but would appreciate some discussion on this topic.

As with many game developers, I have now reached the point where Pathfinding has become a problem. I have spent some time on the following idea, and would like you to comment on it, or find errors in my thinking. I realize that I am probably re-inventing the wheel, in which case I would appreciate it if you point that out to me. Also, I think that this method may only work for small networks, because you start running into problems somewhere between "The Towers of Hanoi" and "The Traveling Salesman".

So, without further ado...

Here is the network of nodes connected by existing paths. SP is the Start Point, EP is the end point. How to get from SP to EP (shortest route)? A very important consideration in this case is that by "shortest path", I mean "the least number of nodes to traverse", and NOT "shortest physical distance". That would be "Best Path". However, it it easy to figure out which path is the shortest if you have the x, y (and z) coordinates of the nodes.


Make a list of all the connections. At this point check if a connection between SP and EP exists (in this case it would have been 9-6). If there is, you have found the only (and shortest) path. If it doesn't, continue.


Starting at the top left of the connections list (node 1), start eliminating duplicate connections. In this example, 1-3 is the same as 3-1,  1-4 is the same as 4-1, etc.


You are now left with a list of all the connections


Separate the start and end points from the intermediaries. If a path element contains the start point (9) it will be considered a start path, if the path element contains the end point (6) it will be considered an end path, all other path elements are considered intermediaries. At this point, check if there are any shared nodes between start paths and end paths (9-x, x-6).  If there are, calculate the lengths of these paths to determine the shortest route. There may be any number of these three-node paths, find all of them, find the shortest, end. If not, continue...


When no two node paths (9-6), or three node paths (9-x-6) could be found, things start getting a little complex. In our example, there are two path leading from node 9 (start point) and two paths leading to node 6 (end point). Let's call the start point paths 9-a and 9-b, and the end point paths x-6 and y-6. Ideally, if there exists a 4 node path, we should look for a-x, a-y, b-x or b-y. These mid-paths, if they exist, will be found in the Intermediary path list. If more than one path is found, calculate distance, find shortest, end.


If no 4-node path was found, the next logical step will be to seek for a 5-node path. More or less the same procedure is followed. Again, we know that there are two paths leading from SP, namely 9-1 and 9-8. We also know that there are 4 intermediary paths with node 1 as an element, namely 1-3, 1-4, 1-7 and 1-8. Since the 9-1-3 path is established, we now consider the first intermediary path element (1-3) as the start point, and use the same method as above to find the shortest route to EP. Ideally this will be 3-2-6 (looking for 2-3 or 3-2) or 3-5-6 (looking for 3-5 or 5-3), since we know that the two paths converging on node 6 come from node 2 and node 5. If such a path is found, we would have 9-1, 1-3, 3-2, 2-6 (9-1-3-2-6 - five nodes) or 9-1, 1-3, 3-5, 5-6 (9-1-3-5-6 - five nodes).

If no path was found, we take the second path element from the node 1 list, namely 1-4. We now consider this intermediary path element (1-4) as the start point, and use the same method as above to find the shortest route to EP. Ideally this will be 4-2-6 (looking for 2-4 or 4-2) or 4-5-6 (looking for 4-5 or 5-4), since we know that the two paths converging on node 6 come from node 2 and node 5. If such a path is found, we would have 9-1, 1-4, 4-2, 2-6 (9-1-4-2-6 - five nodes) or 9-1, 1-4, 4-5, 5-6 (9-1-4-5-6 - five nodes).

If more than one 5-node path was found, find the one with the shortest physical distance. End.

If no 5-node path was found...

And so on.

Comments?
4  Java Game APIs & Engines / JOGL Development / Re: Swing on Top - 2D on 3D on: 2006-04-11 22:00:42
Ah, sounds promising. Would it be possible to [easily] make a fully 3D ui that almost entirely consists of Swing components, and have, say, 3D popups and flyouts?
5  Java Game APIs & Engines / JOGL Development / Swing on Top - 2D on 3D on: 2006-04-11 21:26:26
Hello all

I have read that it is possible to "Draw Java2D graphics on top of 3D OpenGL rendering. The JGears demo again provides an example of this: the icons and frames-per-second counter are drawn on top of the gears using Java2D." This is quite an astounding claim (requires Mustang, apparently) as IMHO this gives jOGL quite the leg up on the desktop horse.

Does anyone have experience in this regard? How fast is it? How reliable is it?
6  Java Game APIs & Engines / JOGL Development / Re: JSR - 231 OpenGL Tutorials on: 2006-04-02 21:12:57
Awesome! Thank you very much! I had recently moved over to jogl from j3d (just as I had reached a "functional" level of competence) and I had my hands full with virtually 99% of all the tuts I had gotten hold of *not working*. Your effort is highly appreciated.
7  Java Game APIs & Engines / Java 3D / How do I get screen x,y coords of 3D objects on: 2005-07-12 11:13:41
Hi again

I would like to know if anyone has an easy, cheap way of obtaining the screen coordinates of objects in the 3D scene. I want to draw some 2D stuff onto the canvas near certain objects when they appear on screen (I already have the drawing part figured out) but I'm having trouble getting the screen coordinates of these objects.

Also, while I'm at it, does anyone know how to get the lookat vector from the current viewingplatform transform?

Thanks guys!

m
8  Java Game APIs & Engines / Java 3D / Rotations around world and local coordinate system on: 2005-07-12 07:21:39
Hi there

I hope someone can help me with this little prob.

I need to rotate my viewplatform (henceforth referred to as camera) around the world Y-axis, and at the same time, around the camera's own local X-axis. The camera should only have pitch and yaw capabilities, but the way I'm doing it now it also rolls because it rotates around the world x-axis. Here's a snippet:

           xgrpVP is a TransformGroup
           x3dVPcurrXform is a Transform3D
           translate is a Vector3D
           origin is a Vector3D
           x3dVPTemp... are Transform3D's
           incElev and incAzim are doubles

            xgrpVP.getTransform(x3dVPcurrXform);
            x3dVPcurrXform.get(mxVP);
            translate.set(mxVP.m03, mxVP.m13, mxVP.m23);
            x3dVPcurrXform.setTranslation(origin);
            x3dVPTemp2.rotX(0.0);
            x3dVPTemp1.rotY(0.0);
            x3dVPcurrXform.mul(x3dVPTemp1, x3dVPcurrXform);
            x3dVPcurrXform.mul(x3dVPTemp2, x3dVPcurrXform);
            x3dVPcurrXform.normalize();
            x3dVPTemp2.rotX(incElev);
            x3dVPTemp1.rotY(incAzim);
            x3dVPcurrXform.mul(x3dVPTemp1, x3dVPcurrXform);
            x3dVPcurrXform.mul(x3dVPTemp2, x3dVPcurrXform);
            x3dVPcurrXform.normalize();
            x3dVPcurrXform.setTranslation(translate);
            xgrpVP.setTransform(x3dVPcurrXform );

Q: How do I rotate my camera around the world's Y-axis, and at the same time, around the camera's own local X-axis?

Q: How do I obtain the lookat vector from the camera? I need it for picking purposes.

Thanks in advance

mokopa
9  Java Game APIs & Engines / Java 3D / Re: Overlays/Interface Panels - best way? on: 2005-07-12 07:08:53
I have had much success with the extension of Canvas3D, overriding postRender(). I have also solved the flickering issue. Using this method my (complex scene) fps drops from 45 without overlay to about 40+-3 with overlay, behaviors and timers, and my very un-optimized drawing code does a lot of scaling calculations:

class DrawOnCanvas3D extends Canvas3D
{
    private J3DGraphics2D j3dg2d;
    private int width = 512, height = width;
    private BufferedImage bufim;
    private Graphics2D g2d;

    public DrawOnCanvas3D(GraphicsConfiguration gc)
    {
        super(gc);
        bufim = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
        g2d = bufim.createGraphics();
        j3dg2d = this.getGraphics2D();
    }

    public void postRender()
    {
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
        g2d.fillRect(0,0,width,height);
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
        g2d.setColor(Color.WHITE);

  /*---->
         g2d.drawingStuffHappensHere(...)
  <----*/

        j3dg2d.drawAndFlushImage(bufim, 0, 0, this);
    }
}
10  Java Game APIs & Engines / Java 3D / Re: HUD on top of Canvas3D on: 2005-07-12 06:52:58
I have had much success with the extension of Canvas3D, overriding postRender(). I have also solved the flickering issue:

class DrawOnCanvas3D extends Canvas3D
{
    private GraphicsContext3D gc3d;
    private J3DGraphics2D j3dg2d;
    private int width = 512, height = width;
    private BufferedImage bufim;
    private Graphics2D g2d;

    public DrawOnCanvas3D(GraphicsConfiguration gc)
    {
        super(gc);
        bufim = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
        g2d = bufim.createGraphics();
        j3dg2d = this.getGraphics2D();
        gc3d = this.getGraphicsContext3D();
    }

    public void postRender()
    {

        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0,0,width,height);
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
        g2d.setColor(Color.WHITE);

  /*---->
  g2d.drawingStuffHappensHere(...)
  <----*/

        j3dg2d.drawAndFlushImage(bufim, 0, 0, this);
    }
}
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.

BurntPizza (21 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (87 views)
2014-09-10 06:39:09

Tekkerue (42 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!