Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
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  Java Game APIs & Engines / Xith3D Forums / Out of Focus Effect on: 2005-04-29 09:00:27
Does anyone know how to make a Shape3D appear out of focus? I have had a look around the web at opengl stuff and it looks like a standard procedure is to draw into the accumulation buffer a number of times, with a slight perspective jitter each time, then put that result on the screen. Can we do this in xith?

Regards,

Alistair
2  Java Game APIs & Engines / Xith3D Forums / Re: Shapes and Text3D on: 2005-04-26 09:21:49
I was not handling when part of a shape3D intersected with another part. For the serif font fh actually overlaps at the top. So one segment was overlapping another. For the tesselation this means that one line segment crosses another. When this happens the gluTesselator stuff expects to be able to call combine(...) or combineData(...) I had not implemented either of these callbacks or set the gluTesselator to call them.

The fix is to change ShapeTriangulator in three spots. At around line 83 put in the following lines;

1  
2  
glu.gluTessCallback(tess, GLU.GLU_TESS_COMBINE_DATA, this);
    glu.gluTessCallback(tess, GLU.GLU_TESS_COMBINE, this);


Then alter the combine and combineData methods as follows:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public void combine(double[] coords, Object[] data, float[] weight, Object[] outData) {

     outData[0] = coords;
  }
  /**
   * called by glu
   * @param coords
   * @param data
   * @param weight
   * @param outData
   * @param polygonData
   */

  public void combineData(double[] coords, Object[] data, float[] weight, Object[] outData, Object polygonData) {
   
    outData[0] = coords;
  }


Note that it is very important that outData[0] is set to something. It does not really matter what - it just has to be non null. It does not seem to be used in any meaningfull way.

This fix stops the program from crashing however the results are not perfect. I end up with a little hole where f and h intersect. After a bit of stuffing around I realised that I was not setting the winding rule of the gluTesselator to the same winding rule of the Shape. The following bit of code starting around line 86 does this.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
int shapeWinding = iter.getWindingRule();
    switch(shapeWinding){
      case PathIterator.WIND_EVEN_ODD:
        glu.gluTessProperty(tess,GLU.GLU_TESS_WINDING_RULE,GLU.GLU_TESS_WINDING_ODD);
        break;
      case PathIterator.WIND_NON_ZERO:
        glu.gluTessProperty(tess,GLU.GLU_TESS_WINDING_RULE,GLU.GLU_TESS_WINDING_NONZERO);
        break;
      default:
        //just leave it set to whatever glu sets as default
       break;
    }


I have updated the source file (http://alistairdickie.com/shapegeom_src.zip). A screenshot of fh is shown below.

You may also note that I have added a Char3D and CachedText3D. These are designed to be used togheter to create a cache of Shape3D's for use in rapidly changing text. I intend to use this for a score counter.

I really should get this into CVS for xith3D. I seem to be able to check stuff out easy enough but can not seem to add. Can someone point me in the right direction?

Ken- For the moment I am not really sure where to start on the putting something together for jogl. The only direct jogl calls I have ever written are this gluTesselator stuff. I am happy for anyone to take this code and write a jogl specific implementation that has no reference to xith. I have done the bitmapped font but was never really happy with it. It is relatively easy to drawText on the graphics of a BufferedImage then use this as a texture for some quad.  

Regards,

Alistair

3  Java Game APIs & Engines / Xith3D Forums / Re: Shapes and Text3D on: 2005-04-15 12:48:49
Will: I am not sure about LWJGL. I had a quick look and it looked like the tess stuff was not fully done. I hope someone advises otherwise.

Ken: Yes we can put something like this into JOGL. I am a scenegraph person and know little about what to do with the verticies that I get back from the tess stuff to make them JOGL happy. If you look at my code I add them to a xith TriangleArray. I am sure that there is something that JOGL has that would be appropriate. In any case they should be cached somehow so you do not do the tess thing every frame. Something like my code will do a generalized Shape Tessalator (and its extrusion in one dimension  (I may add twists later)), and java.awt.Font text. What do you mean by bitmap support?

4  Java Game APIs & Engines / Xith3D Forums / Re: Shapes and Text3D on: 2005-04-13 21:10:31
bump - any comments?
5  Java Game APIs & Engines / Xith3D Forums / Shapes and Text3D on: 2005-04-10 03:12:41
I thought it was going to be pretty easy to write some code to create extruded shapes (of which text is a subset). I was wrong.

The main problem was to take a java.awt.Shape and make triangles of it. Triangulation is not easy. Java3D uses some very complex code to make Text. After almost a week of stuffing around, toying with my own triangulation code, and generally going mad, I found this
http://www.geocities.com/foetsch/extrude/extrude.htm

It was pretty much exactly what I was after. Someone has been nice enough to include a glu port in jogl so from there on it only took a day or so.

You can now do three things pretty easily.
- Create a TriangleArray from a java.awt.shape object for both an extruded and flat version.
- Make a Text2D shape that is flat text from java.awt.font
- Make a Text3D shape that is extruded text.

It is not super fast and I would not suggest creating these objects on the fly whilst rendering.

The simple version of what I do to render text from a java.awt.Font is to get the Glyphs from the font (they are Shape objects), get a PathIterator from the Shape, pass the path to glu and get triangles back then create a TriangleArray for the front back and sides.

Because I use glu from JOGL this will not currently work with LWJGL. I am not sure if there is a glu port in LWJGL. If so it should be pretty easy for someone to copy what I have done.

You can get my source at http://alistairdickie.com/shapegeom_src.zip. It is even commented and has an example! I have it in a package org.xith3d.shapegeom. At some stage it could be incorporated however I want a little feedback first. Run the test to have a play org.xith3d.shapegeom.Text3DTest

A few screenshots:


6  Java Game APIs & Engines / Xith3D Forums / Re: ui xith3d on: 2005-04-06 11:52:08
Will,

These are both a little harder than they should be.

I am going to do some more work on my program and will do a little on the interface package but will not get to it for a few weeks.

I am currently looking at getting a really nice Text3D shape done. You should see that in the next few days.

Regards,

Alistair
7  Java Game APIs & Engines / Xith3D Forums / Re: ui xith3d on: 2005-04-04 20:45:02
I have just done some memory profiling for my game. I was amazed at the rate that objects are created and destroyed in Xith3D. I seem to be churning through thousands of primitave arrays (of every type) every frame. Not to mention a bunch of other objects to do with rendering. The GC has a lot of work to do.

With the UI stuff turned on things are worse. I am not sure if that is just because there is more stuff to render, or if swing is making it even worse. In any case there is more investigation required.

I think I can answer a few questions on David's UI Interface stuff. I have spent hours looking at that code and am pretty sure I understand at least the basics.

Regards,

Alistair

8  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-04 20:38:01
I think I will make a smaller windowed version. I have done some memory profileing and the UI stuff is churning through quite a few objects. I will discuss this more on the Xith3d forums.
9  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-03 20:19:11
Skippy,

What are you system specs? If I wind down the amount of memory available to the JVM I get similar behaviour.

Thanks for giving it a go.

Alistair
10  Java Game APIs & Engines / Xith3D Forums / Re: ui xith3d on: 2005-04-03 09:51:05
I have not "fixed" the ui stuff currently built into Xith but think I have used if pretty extensively in my game (currently beta). I use quite a bit of the functionality that is descirbed as lacking in thread. Have a look at http://zplax.alistairdickie.com

- Semi Transparant buttons that react to MouseOver (see the six buttons at the top). I had to slightly modify UI window manager for this. Essentially these buttons are each UIWindows with a single JButton in them.

- Text output to a semi transparent ui window (press c to see the frame rate thing). This is a JText area on a UIWindow.

- JLabel output to a semi transpared UI Window (The score and time windows).

- 2D graphics in a semi tranparant UI Window (the water level window).

- A custom component made up of a JTextField two JButtons and a JLabel (see the JSpinner like thing in the game settings window).

- Text written onto the graphics object of a BufferedImage (actually a DirectBufferedImage) that is placed as a texture on some geometry (see the banner by pressing b)

-I pop another frame over the top of the main one for my About dialog.

A few tips that I ended up applying.

- Set the Layout of any component you are going to add stuff to to null. Then use setBounds on the objects you are going to add for positioning. That way you will always know where you stuff is going to do without having to rely on one of the funky swing layouts.
-Use setColor(0,0,0,0) to make something transparent or setColor(0,0,0,128) to make it kind of tansparent. Do this all over the place and all will be well.

Don't get me wrong. I think the UI stuff that currently exists can go a long way. I think when David Yazel made it he was very focused on being able to drag UIWindows around - that is whey they move if you click in the top left 15 pixels or so (I also changed UIWindow to customize or disable this)

Regards,

Alistair

11  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-02 19:55:11
Thanks - you system specs are very similar to mine so the game "should" be running fine. If you are using teh JWS version can you pop up a console to see if there are any error messages.

The timer I am using is the hidden sun.misc.Perf. Maybe you have an early version of 1.4.2 that did not have it, or mayber it is returning something funny? I have tested it with 1.4.2_07. Before you start the game press c to get the little window in the lower right show up. What fps and rn% are you getting before the game starts? If these figures are all screwed up it could be that the timer is doing funny things.

Regards,

Alistair
12  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-02 08:32:20
I think for some reason it is ending prematurely. Please confirm the version by clicking on the help (?) and then about. Also please post your system specs.

Regards,

Alistair
13  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-04-02 08:15:52
Maybe someone who is really mac savy can help me out with what is wrong with my image loading so I can get it working for lilian.

I try to find the URL for the image in the jar file like this
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
URL imageURL = this.getClass().getResource(filename);
      if(imageURL != null){
        return imageURL;
      }
      if (imageURL == null && loader != null) {
        loader.getResource(filename);

      }
      if (imageURL != null) {
        return imageURL;
      }
      else {
        try {
          imageURL = new URL(filename);

          try {
            InputStream in = imageURL.openStream();//a hack to see if the URL exists
           in.close();
            return imageURL;
          }
          catch (IOException e) {
            imageURL = null;
          }


        }
        catch (MalformedURLException e) {
//              e.printStackTrace();
       }
      }


loader is the ClassLoader that loaded the main application. The string (filename)I pass is of the form:
1  
skins/standard/data/box/ft.jpg

and this is the location of the image a jar file that is in the classpath. Do I need to use \\ instead of / for a mac? I thought that was just for File's and URL's were standard across all systems?
14  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-04-02 08:07:41
ewillis,

Yeah - I do that with the reflection. It is working on my JWS version and when I use the installer on my Windows machine. I did have some trouble when I ran it through proguard but I thought I fixed it. I have more or less given up on proguard. It was breaking too much.

I will be updating the installer tonight. version 1.0 beta3 dated 2 Apr 03 is the current one (see the about screen in the help menu).

Thanks,

Alistair
15  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-02 04:08:05
Zorax,

Please confirm that you start the game (i.e. the big column of balls comes up in the crater) but that you can not right click to load and shoot? In any case I am just uploading a new version for the JWS. In this version (1.0 beta3) you can use the space bar to load and shoot the gun in addition to right clicking. Also if you right click or press space before the game has started it will bring up the dialog for you to start the game (same as clicking on the icon in the top right corner).

http://zplax.alistairdickie.com/zplax.jnlp

If you are not using jws and you used the installer just get zplax.jar and replace the one in your installation directory. Because of the way it is now signed you will also have to get xith3d.jar and replace that too.

http://zplax.alistairdickie.com/dist/jars/

Regards,

Alistair



16  Game Development / Newbie & Debugging Questions / Re: Extensibility and webstart...how? on: 2005-04-01 21:51:20
I think the place to start is to focus on what I want users and developers writing extensions to be able to do. The basic problem is that developers will write some code and put together some resources as an extension to my game and I need to ensure that this can get to users. I am going to take it as a given that the classes and resources will be packaged into a jar file. This jar file then has to find its way onto the users system and be loaded onto the classpath (not possible as I want users to be able to add extensions after program start), or be loaded via a URLClassLoader.

I think the way I am going to do it is allow the user to specify the directory containing the skins. By default this will either be the skins directory in the program installation path (if it was installed by an installer), or the gamename/skins directory in the "user.home" directory if it is running via JWS. Users can place skins there manually, download them to there via a "skin server" from within the program, or perhaps click on a jnlp link that references the main game jnlp but also includes the skin jar as an additional resource. I have to think more about the latter one.

Regards,

Alistair
17  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-04-01 21:08:37
Lilian,

I have changed the way I do some of the image loading and have uploaded a new version. I am not sure this will fix it but if you have the patience please have another try.

Regards,

Alistair
18  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-01 09:47:31
Now I have a made it JWS compatible. This has temporarily broken the ability for users to create skins and add them to a skins directory however by the production version there will be a way for dynamic skin additions.

Go here

http://zplax.alistairdickie.com/zplax.jnlp

I have also made a few little changes like dismissing the start-up sequence by clicking, a help file loader and the way scores are temporarily exported.

Regards,

Alistair
19  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-04-01 09:46:35
OK - I succumbed to the pressure and have made it JWS compatible. This has temporarily broken the ability for users to create skins and add them to a skins directory however by the production version there will be a way for dynamic skin additions.

Go here

http://zplax.alistairdickie.com/zplax.jnlp

I have also made a few little changes like dismissing the start-up sequence by clicking, a help file loader and the way scores are temporarily exported.

Regards,

Alistair
20  Games Center / Archived Projects / Re: Zplax 1.0b on: 2005-04-01 02:40:53
I should make this clearer. Right click to load the gun, then right click again to fire and reload.

You need to have started a game. Click on the icon in the top left corner then click Start Game.

Regards,

Alistair
21  Games Center / Archived Projects / Zplax 1.0b on: 2005-03-31 22:58:00
For those that look at the Xith3D forum sorry about the cross post but I guess I should have put the notification about the beta release of my game here.

Zplax is a shooting puzzle game developed with Xith3D and jogl. It needs a 1.4.2 or later JVM to run (I think). You can get it from http://zplax.alistairdickie.com/.  

Anyone can download the game and be a beta tester. From a bit of feedback it seems the Mac installer does not configure everything correctly. I have not worked out the exact problem yet. Any feedback from Mac or Linux users is especially appreciated.

Regards,

Alistair
22  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-03-31 19:58:53
Lilian and Will,

Please have a look at the zplax installation directory on your Mac's. Do you have a directory called lib? This should have been where the mac jogl librarys went.

If they are there then I may be referencing the libray path the wrong way. I am not 100% sure how InstallAnywhere does stuff on the mac but I think you should have a file called zplax.lax in the installation directory. These are the settings that are passed to the LaunchAnywhere. You should find a property:

lax.nl.java.option.additional

This should be set to:

-mx256m -Djava.library.path=.:./lib

I think that this is the right way to set the library path on a mac but I am not 100% sure.

Will - you can have a look at System.out and System.err by altering the following properties in the zplax.lax file. From the InstallAnywhere help file:

lax.stdout.redirect
The location of your application's "stdout" output. Set to null to suppress, console to write to a console window, or any file name to output to a file. Note: If you are specifying a path name to a Windows file, make sure to use escaped backslashes (i.e., c:\\myfolder\\output.txt)

lax.stderr.redirect
The location of your application's "stderr" output. Set to null to suppress, console to write to a console window, or any file name to output to a file. Note: If you are specifying a path name to a Windows file, make sure to use escaped backslashes (i.e., c:\\myfolder\\output.txt)

Regards,

Alistair
23  Java Game APIs & Engines / Xith3D Forums / Re: Making Zplax (the Xith3D bits) on: 2005-03-31 08:49:32
I will follow up on all of these at some stage. I should get the CVS and comit a few things. I spent many hours reading a range of Xith classes (TextureLoader, UIWindowManager amongst others) There are only a few little changes that I "had" to make but there were more that I could of.

Now for more on the transparency. This is particulary in relation to the banner. That is the bit in the game that contains tutorial information. Fly it in with i and out with o. Show and hide it with b. It is still not what I want. You can see that on the edges of the banner there are some fully transparent pixels (so the image used for the texture has transparency). What I want to be able to do is fade the whole thing in and out, without sacrificing the ability to have a partially transparent image.

The banner's geometry is a simple TriangleStripArray created like this:

1  
2  
geom = new TriangleStripArray(widthN * 2 * heightN, GeometryArray.COORDINATES |
        GeometryArray.TEXTURE_COORDINATE_2, stripVertexCounts);


I then do stuff to set the coordinates and texture coordinates point wise.

To create the appearance I use this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
Appearance app = new Appearance();

    PolygonAttributes polygonAttributes = new PolygonAttributes(PolygonAttributes.POLYGON_FILL,
        PolygonAttributes.CULL_NONE, 0f);

    app.setPolygonAttributes(polygonAttributes);


    tmp = DirectBufferedImage.make(w, h, DirectBufferedImage.DIRECT_RGBA);

    try {
      BufferedImage img = null;
      img = ImageIO.read(this.getClass().getResource("data/parchment.png"));
   
      BufferedImage rgb = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR);
      rgb.getGraphics().drawImage(img, 0, 0, rgb.getWidth(), rgb.getHeight(), 0, 0, img.getWidth(), img.getHeight(), null);


      Graphics2D g = (Graphics2D) tmp.getGraphics();
      g.drawImage(rgb, 0, 0, null);
      cache = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR);
      cache.getGraphics().drawImage(tmp, 0, 0, null);


    }
    catch (IOException e) {
      e.printStackTrace();
    }

    tex = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, tmp.getWidth(), tmp.getHeight());
    ImageComponent2D im = new ImageComponent2D(ImageComponent.FORMAT_RGBA, tmp.getWidth(),
        tmp.getHeight(), tmp);

    tex.setImage(0, im);

    app.setTexture(tex);

    //this is vital!!
   TransparencyAttributes transAttr =
        new TransparencyAttributes(TransparencyAttributes.BLENDED, 0.0f, TransparencyAttributes.BLEND_SRC_ALPHA,
            TransparencyAttributes.BLEND_ZERO);
    app.setTransparencyAttributes(transAttr);

    TextureAttributes texAtt = new TextureAttributes();
    texAtt.setTextureMode(TextureAttributes.REPLACE);
    app.setTextureAttributes(texAtt);

    shape.setAppearance(app);


To explain this a little. The polygon attributes part is standard. tmp is one of the DirectBufferedImages that is in Xith. If I understand correctly these things are really great as the backing store for the direct buffered image is the same bytes that are used by jogl to send to the video card. Note I create a RGBA one. The image I actually want is read in to img using ImageIO. The type of this buffered image is unknown so I turn it into a TYPE_4BYTE_ABGR the cheats way using the graphics.drawImage method. I then do the same thing to put rgb onto tmp. (tmp is a bit of a misnomer - it is actually the one that goes on the texture). Finally on the image creation I store a copy of the image in cache for later (see below).

To create the texture I use the Texture2D aand ImageComponent2D constructors. Note that ImageComponent2D really likes DirectBufferedImage's.

Now comes the bits I don't really understand, and still have not got working the way I want. You can see what I have done to create the appropriate TransparencyAttributes and TextureAttributes. The combination of BLENDED, BLEND_SRC_ALPHA, REPLACE, etc in these has caused me heartache. I do not really understand what is going on under the hood. I would like to be able to set new transparency attributes over time and fade out the whole thing, while continuing to have a partially transparent image as I loaded above.

A few more nicities are listed below. I like that as I have this DirectBufferedImage I can draw on it using getGraphics and all I need to do is tell the Texture it is dirty and all will be well.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
    public void clearText() {


    tmp.getGraphics().drawImage(cache, 0, 0, null);


  }

  public void addText(String text, int fontSize, int x, int y) {
    Graphics2D g = (Graphics2D) tmp.getGraphics();
    g.setColor(Color.white);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
    g.setFont(new Font("serif", Font.BOLD, fontSize));
    g.drawString(text, x, y);
    tex.setDirty(true);

  }


24  Java Game APIs & Engines / Xith3D Forums / Re: Zplax 1.0b out on: 2005-03-31 08:17:59
Will,

Thanks for the comments. I am moderatly amazed the installer worked on the Mac and kind of amazed that the game ran without me having to fix something.  I was just trusting the folks from ZeroG. It was actually a little difficult to configure.

I did seriously consider JNLP but there are a few things that have turned me off. First there is the way I handle skins. jar files can be dynamically added as you are playing the game if they are put in the skins directory. I am pretty happy with the idea that a game downloaded using JNLP goes somewhere but I feel that many users will just want a shortcut (forgive the windows like thoughts here).

I fixed the Mac OS X 10.3.4 thing on the install page - thanks for that tip.

I take it the effect you mean when you hit the water is the ripple? That should be happening when all balls hit the water. I hope this is the case for you.

The point about easier starting is good. Maybe I will put a special start game button somewhere.

Sounds are all kind of screwed and very betaish. I think I will fix them for the production release. I need to get the levels right and fix quite a few of them.

I kind of got carried away with the loading effect. I thought of it in the shower and just wanted to see if it could be done. I think I will make it so if you click anywhere on the splash panel or the surrounding faded and blured desktop it will revert just to a floating splash panel, or maybe just minimise the lot. I ditch the whole frame at the end of the loading phase in any case.

Regards,

Alistair





25  Java Game APIs & Engines / Xith3D Forums / Making Zplax (the Xith3D bits) on: 2005-03-30 22:01:52
It thought I should share some of the challenges that I faced using Xith to make Zplax. Xith3D is an excellent API and I am really greatfull to all that have contributed. There were a few things that I found presented a challenge to me. In this post I will outline some of them.

UI Stuff

Zplax makes extensive use of the ui part of Xith. I really enjoyed being able to use swing to make my UI as I am pretty familiar with it, but there were a few things that need a little work. The event processing framework does not allow a lot of Swing stuff to happen as it normally does. I had to overload UIWindowManager and alter the way mouse events are processed to get my MouseEntered functionality.

TextureLoader

TextureLoader is nice in that there are many ways you can pass a path to a resource to it. One thing that did not work for me though is getting it to find a resource from a jar file that is added to a new URLClassLoader. This was largely because of the way that this static TextureLoader.tf hangs around. I overloaded TextureLoader and added some functionality to tell it what ClassLoader to use to look for resources at. I also added the ability to give it an absolute URL.

ASE Loader

I guess it would not be too much work to read simple (non- texture) materials from the ASE file. It surprised me that it was not done.

Transparency

I tried for ages to get a texture that included transparency draped over some geometry, then fade out the whole thing. I am sure there is a way to do this but I did not stumble upon it.

Sounds

Sounds did not work quite the way I wanted. When I play a little sound I did not want the HD to be accessed, rather I wanted all little sounds preloaded. I also wanted to be able to play multiple copies of the same sound at the same time. While I used part of the Xith Javasound stuff I did a lot of my own.

Thanks again to all.

Regards,

Alistair
26  Java Game APIs & Engines / Xith3D Forums / Zplax 1.0b out on: 2005-03-30 21:03:50
Well after two months of coding in my spare time the beta version of my game is out. Zplax is a shooting puzzle game developed with Xith3D and jogl. It needs a 1.4.2 or later JVM to run (I think). You can get it from http://zplax.alistairdickie.com/.

I have only been lurking on this forum and have few posts. I would really value the opinions of other developers.  I have not got a Linux or Mac box to test the installers on. I am not really sure if the game will work on those platforms and am especially interested in feedback on that.  

I have conceeded that I am not the best modeller and my modeling is pretty simple. Felllow developers can write skins for the game using Xith3D. You can find our more on the website.

I will write a seperate post on some of the challenges that I found using Xith3D.

Regards,

Alistair

27  Java Game APIs & Engines / Xith3D Forums / Re: Xith3D problem on: 2005-03-24 09:10:49
Most of the examples were giving me this exception. I was able to stop it in the code I wrote by putting a graceful exit so System.exit(0) is not called while rendering is happening. Psuedo code is something like this in a class that extends Thread.


private boolean running;

public void run(){

  while(running){
     do some work....
     view.renderOnce();

  }
  System.exit(0);
}

public boolean setRunning(boolean running){
  this.running = running;
}

then call setRunning(false) on the rendering thread.
28  Java Game APIs & Engines / Xith3D Forums / MouseOver UI thingy on: 2005-02-18 10:18:38
After a couple of days of coding I must say thanks to all who have contributed to xith3d.

I spent quite a bit of time getting a pretty UI exit button for my app. The behaviour I want is a standard mouse over button that changes icon when you mouse over it. I extened UIWindow, made the root a JPanel, added a JButton to it and tried to use the standard setRolloverEnabled(true) and setRolloverIcon(icon) methods. This did not work.

After a bit of investigation it is apparant that the UIEventAdaptor was processing all events on the canvas and these were not being transferred to the various UIWindows. They were being transferred to the UIWindowManager however. Essentially what I had to do was fiddle with the UIWindowManager a bit so the MOUSE_MOVED events triggered MOUSED_ENTERED and MOUSE_EXITED events on the UIWindows. This still did not do the automatic rollover thing so I had to make my custom UIWindow a MouseListener and "manually" change the icons.

The really cool thing is that I now have pretty buttons that change when you mouse over them. Maybe there was an easier way...

There is still a bit of mystery. The mouse over looks to work about 10 pixels below the button?

I am not sure if someone wants to put this code in the repository. It is posted here just in case.

Regards,

Alistair

The changes to UIWindowManager:

near the top

//objects needed for enter/exit support
   UIPositionedWindow inWindow = null;


the first bit of the processMouseEvent method with my changes in bold
public synchronized void processMouseEvent(MouseEvent me) {

           boolean rightButton = ((MouseEvent.BUTTON3_MASK & me.getModifiers()) != 0);
           boolean leftButton = ((MouseEvent.BUTTON1_MASK & me.getModifiers()) != 0);

           UIPositionedWindow w = getWindow(me.getPoint());


           boolean eventConsumed = false;

           if (me.getID() == MouseEvent.MOUSE_MOVED) {
               if (mode == OM_MOVE_WINDOW) {
                   focus.setPosition(me.getX(), me.getY(), canvasDim);
                   eventConsumed = true;
               }
               else if(mode == OM_NONE){
                 if(w == null && inWindow != null){
                   //mouseExited inWindow
                   UIOverlayInterface o = inWindow.getOverlay();
                   if (o instanceof UIWindow) {
                       MouseEvent mec = new MouseEvent(me.getComponent(),
                               MouseEvent.MOUSE_EXITED,
                               me.getWhen(),
                               me.getModifiers(), me.getX(),
                               me.getY(),
                               me.getClickCount(), false);

                       ((UIWindow) o).dispatchEvent(mec);
                   }
                   inWindow = null;


                 }
                 else if(w != null && inWindow == null){
                   //mouseEntered w

                   UIOverlayInterface o = w.getOverlay();
                   if (o instanceof UIWindow) {
                       MouseEvent mec = new MouseEvent(me.getComponent(),
                               MouseEvent.MOUSE_ENTERED,
                               me.getWhen(),
                               me.getModifiers(), me.getX(),
                               me.getY(),
                               me.getClickCount(), false);
                   
                       ((UIWindow) o).dispatchEvent(mec);

                   }
                   inWindow = w;
                 }
                 else if(w != null && inWindow != null && w != inWindow){
                   //mouseEntered w and Exited inWindow

                   UIOverlayInterface o = inWindow.getOverlay();
                   if (o instanceof UIWindow) {
                       MouseEvent mec = new MouseEvent(me.getComponent(),
                               MouseEvent.MOUSE_EXITED,
                               me.getWhen(),
                               me.getModifiers(), me.getX(),
                               me.getY(),
                               me.getClickCount(), false);

                       ((UIWindow) o).dispatchEvent(mec);
                   }

                   o = w.getOverlay();
                   if (o instanceof UIWindow) {
                       MouseEvent mec = new MouseEvent(me.getComponent(),
                               MouseEvent.MOUSE_ENTERED,
                               me.getWhen(),
                               me.getModifiers(), me.getX(),
                               me.getY(),
                               me.getClickCount(), false);

                       ((UIWindow) o).dispatchEvent(mec);
                   }
                   inWindow = w;
                 }

                 //else if (w==null) setOverlayFocus((UIPositionedWindow) null);
               }
           }

And here is my custom UIWindow that I use it with:

package islandtest;

import com.xith3d.userinterface.UIWindow;


import javax.swing.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;

public class IslandExitUIWindow extends UIWindow implements ActionListener, MouseListener {

 private IslandMain main;
 private Icon grey;
 private Icon red;
 private JButton button;


 public IslandExitUIWindow(IslandMain main) {
   super(50,50, true, true);

   this.main = main;
   JPanel panel = new JPanel();
   panel.setLayout(new GridLayout(1,1));
   panel.setDoubleBuffered(true);
   panel.setSize(new Dimension(40,40));
   panel.setLocation(0,0);
   panel.setBackground(new Color(0,0,0,0));

   button = new JButton();
//    button.setLayout(new BoxLayout(button,BoxLayout.X_AXIS));
   button.setSize(40,40);
   button.addActionListener(this);
   button.setMargin(new Insets(0,0,0,0));
   button.setBorder(BorderFactory.createEmptyBorder());
   button.setLocation(0,0);
   button.setBackground(new Color(0,0,0,0));
 
   panel.addMouseListener(this);

   try {
     grey = new ImageIcon(ImageIO.read(new File("d:/code/island/src/islandtest/data/exitgrey.png")));
     red = new ImageIcon(ImageIO.read(new File("d:/code/island/src/islandtest/data/exitred.png")));
     button.setIcon(grey);

   }
   catch (IOException e) {
     e.printStackTrace();
     button.setText("Exit");
   }
   panel.add(button);

   this.setRoot(panel);

 }

 public void actionPerformed(ActionEvent e) {
    main.doExit();

 }

 public void mouseClicked(MouseEvent e) {

 }

 public void mousePressed(MouseEvent e) {

 }

 public void mouseReleased(MouseEvent e) {

 }

 public void mouseEntered(MouseEvent e) {
   button.setIcon(red);


 }

 public void mouseExited(MouseEvent e) {
   button.setIcon(grey);
 }


}



29  Java Game APIs & Engines / Xith3D Forums / Re: Building the Source on: 2005-02-16 09:25:52
I do not really plan to modify the source but there is no documentation like source so I thought I would take a look.

BTW I just got your ASE loader working after building a few things in 3ds. I even got the materials (well texture maps) to work. This should make things much easier for me.

I did not follow the tutorial step by step but am mildly familiar with Java3D, altough I have not really used it for a few years.

Regards,

Al
30  Java Game APIs & Engines / Xith3D Forums / Building the Source on: 2005-02-15 01:29:02
I am just new to Xith3D and intend to give it a go in a game. My aim this morning was to download, build and run the tests in my IDE. It all worked pretty well but I want to report a few glitchs.

I first built using ant and all went well. Then I tried just compiling the source trees from within the IDE. The few errors were:

- In com.xith3d.sound.loaders.test.TestOggLoader, om.xith3d.sound.drivers.joal.test.TestSoundDriverImpl, com.xith3d.spatial.bounds.SphereTest and com.xith3d.terrain.TestTerrain the compiler did not like the fact that TestCase does not have a public no arg constructor.

- I had to exclude com.xith3d.spatial.bounds.Sphere test from the compile as from line 183 to 187 it could not recognise the method classify(Vector3f)

- The class org.xith3d.test.Xith3DTestCanvas had to be excluded as I did not have the net.jtank stuff. This also meant org.xith3d.test.Xith3DGeomTest had to be excluded.

Regards,

Alistair
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.

xsi3rr4x (15 views)
2014-04-15 18:08:23

BurntPizza (14 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (179 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!