Character Control

Well, here’s part two of my engine/game.

http://www.mojomonkeycoding.com/files/jme/CharControl.zip

The file is almost 3 meg, my apologies. It’s the damn models.

This is showing off version 2 of the terrain engine. Plus a tracking camera system with entity (character) controlling. The character action is physics based where your key input effects acceleration of the character, not it’s velocity. Allows for a little more realism… maybe? :slight_smile:

The tracking system is still a little rough around the edges, you may notice jitter now and then. I plan on adding a rubber band system soon to deal with that.

Only has basic controls at the moment…

Forward - w, Up
Right - d, Right
Left - a, Left

You can also switch resolutions with 1,2,3
switch wireframe 7
switch fill mode 8
take screenshot right control + p

Be as critical as you like. I take all your criticism seriously. Egon Olsen my notice the extra control scheme other than wsad :slight_smile:

Thanks

UPDATE: Hmmm I just noticed that switching resolution screws up the textures… will look into.

Really nice!

Just need an Axe and you can market it as “Virtual Logging” :slight_smile:

60fps steady on my athlon 1800 / gf3 ti200
Windows XP.

I await the next version!

couldn’t get it to work. no matter what vidoe mode I selected I get

Jul 11, 2003 8:56:25 AM jme.system.PropertiesIO
INFO: PropertiesIO created
Jul 11, 2003 8:56:25 AM jme.system.PropertiesIO load
INFO: Read properties
Jul 11, 2003 8:56:31 AM jme.system.PropertiesIO save
INFO: Saved properties
java.lang.InternalError: Could not get display mode
at sun.awt.Win32GraphicsDevice.getCurrentDisplayMode(Native Method)
at sun.awt.Win32GraphicsDevice.getDisplayMode(Win32GraphicsDevice.java:330)
at jme.system.DisplaySystem.getValidDisplayMode(DisplaySystem.java:333)
at jme.system.DisplaySystem.initDisplay(DisplaySystem.java:439)
at jme.system.DisplaySystem.(DisplaySystem.java:135)
at jme.system.DisplaySystem.createDisplaySystem(DisplaySystem.java:264)
at test.general.TestMain.initDisplay(TestMain.java:164)
at test.general.TestMain.initSystem(TestMain.java:214)
at jme.AbstractGame.start(AbstractGame.java:88)
at test.general.TestMain.main(TestMain.java:351)
Exception in thread “main” java.lang.NullPointerException
at test.general.TestMain.cleanup(TestMain.java:346)
at jme.AbstractGame.start(AbstractGame.java:114)
at test.general.TestMain.main(TestMain.java:351)

that’s with full screen checked or not. On a old NVIDIA RIVA TNT2

Hmmm not sure what could be causing that problem.

The method that’s calling the display modes is as follows:

Any other LWJGL experts see a problem with what I’m doing and know why it’d break on zParticles machine??


public DisplayMode getValidDisplayMode(int width, int height, int bpp) {
        //get all the modes, and find one that matches our width, height, bpp.
        DisplayMode[] modes = Display.getAvailableDisplayModes();
        //Make sure that we find the mode that uses our current monitor freq.
        GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] gd = ge.getScreenDevices();
        for (int i = 0; i < modes.length; i++) {
            if (modes[i].width == width
                && modes[i].height == height
                && modes[i].bpp == bpp
                && modes[i].freq == gd[0].getDisplayMode().getRefreshRate()) {

                LoggingSystem.getLoggingSystem().getLogger().log(
                    Level.INFO,
                    "Setting mode to " + modes[i]);
                return modes[i];
            }
        }

        //none found
        return null;
    }

IMO this one is bad:
modes[i].freq == gd[0].getDisplayMode().getRefreshRate()

and on linux all frequencies are 0 Hz

Do you recommend that I just ignore freq? Or what would you suggest?

UPDATE: Just had a friend try out the demo on his linux box. Worked fine, so apparently that’s not causing an issue with his? Any ideas?

Looks sweet! Can’t wait to see what you do with this!

-SG

this is all it does for me

C:\character control>Run.bat
C:\character control>set CLASSPATH=.;.\lib\jme.jar;.\lib\lwjgl.jar
C:\character control>java -Djava.library.path=.\lib test.general.TestMain
Jul 11, 2003 1:13:10 PM jme.system.PropertiesIO
INFO: PropertiesIO created
Jul 11, 2003 1:13:10 PM jme.system.PropertiesIO load
INFO: Read properties
C:\character control>

Ok, definately need to improve on how to run this thing. So far I’m 2 for 4.

nlmueng: could you try executing the demo by hand? You’ll need lwjgl.jar and jme.jar in your CLASSPATH and lwjgl.dll in your PATH. Execute test.general.TestMain. Does it do the same thing for you on the command line?

Thanks

ALSO: Do you not get the pop-up window asking for resolution, fullscreen, etc?

it does not pop up anything. Tried by hand, same thing.

Ok, one other thing to try… do you see the properties.cfg in the base directory? Delete that and try again.

On my work PC I got the same error as zparticle. I don’t know for sure what the problem with the code you posted is, but that PC works with my own LWJGL game which selects the display mode like this:


                int mode = -1;
                DisplayMode[] modes = Display.getAvailableDisplayModes();
                
              for (int i = 0; i < modes.length; i ++) {
                  if (modes[i].width == width && 
                      modes[i].height == height && 
                      modes[i].bpp >= bits && modes[i].bpp != 24 &&
                      (mode<0 || 
                       modes[i].bpp > modes[mode].bpp || 
                       (modes[mode].freq != FPS && modes[i].freq == FPS)
                       ) ) {
                            
                            System.out.println("Maybe selecting mode " + modes[i].width + "x" + modes[i].height + "x" + modes[i].bpp + " @" + modes[i].freq);
                              mode = i;
                  }       
              }          
              
              if (mode == -1) {
                    throw new Exception("No compatible display mode available.");
              }
          
             Display.setDisplayMode(modes[mode]);
            gl = new GL("Cosmic Trip", modes[mode].bpp, 0, 0, 0);
            gl.create();

Don’t know if that’s the best method (the code looks a bit clumsy maybe), but it seems to work for me. And as you can see I consider the refresh rate too without a problem as it limits itself to the reported compatible modes anyway (like you also do).
[/quote]
Egon Olsen my notice the extra control scheme other than wsad
[/quote]
Oh, no! You haven’t adopted his jpct demo’s control scheme, haven’t you? ;D

  • downloading on my home PC now *

Erik

Ok, this is strange. I haven’t touched the Display Managing code since my last demo post… which ran for you Erikd. So, something really strange is going on. Are you guys on linux?

The first demo I only tried on my home PC. I just tried your new demo on my home PC and it still works there so it is not that weird :slight_smile:

Again, I was impressed. :smiley:
Very cool you added a model loader too. It immediately looks a lot profi-er with an animated dude running around :slight_smile:
The camera movement could be more smooth though, but otherwise just great improvements!
Got 75fps throughout, no matter how much there was on screeen 8)

EDIT: Both my work PC and my home PC are windows, not linux.

BTW, the code I posted above is old; in the current code (which I don’t have here) also limits its refresh freq. at 85Hz as some computers reported back rates like 150Hz. It also has some fall back mechanism where it selects any reported compatible video mode it can find before bailing out.

Thanks erikd.

Yeah the camera tends to fling around sometimes. I’ll have to put a warning that it may cause seizures. :slight_smile:

I’m planning on putting in a smooth rubberbanding feature to remove that.

If you have any ideas what may be causing that error on zparticles machine and your work machine, please let me know.

I will try changing the way I get the frequency and see if that helps. I’ll post when it’s updated.

Hmm, on redhat 9 I get:
LOADING: jme/data/Paladin/Paladin_head.md3
jme.exception.MonkeyRuntimeException: Could not open MD3 Model.jme/data/Paladin/Paladin_head.md3
at jme.geometry.model.md3.Md3Model.importMD3(Md3Model.java:542)
at jme.geometry.model.md3.Md3Model.loadModel(Md3Model.java:412)
at jme.geometry.model.md3.Md3Model.initialize(Md3Model.java:260)
at jme.geometry.model.md3.Md3Model.(Md3Model.java:204)
at test.general.TestMain.initGame(TestMain.java:274)
at jme.AbstractGame.start(AbstractGame.java:97)
at test.general.TestMain.main(TestMain.java:351)
2003-jul-11 22:50:31 jme.texture.TextureManager deleteAll
INFO: Deleting All Textures

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x516A2740
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.

Current Java thread:
at org.lwjgl.opengl.CoreGL.isTexture(Native Method)
at jme.texture.TextureManager.deleteAll(TextureManager.java:400)
at jme.texture.TextureManager.reset(TextureManager.java:450)
at test.general.TestMain.cleanup(TestMain.java:347)
at jme.AbstractGame.start(AbstractGame.java:114)
at test.general.TestMain.main(TestMain.java:351)

Dynamic libraries:

java -cp lib/lwjgl.jar:lib/jme.jar -Djava.library.path=/mnt/annat/spel/xap-demo-1.3/ -Xmx128m -Xms128m test.general.TestMain

:-/

[quote]Ok, this is strange. I haven’t touched the Display Managing code since my last demo post… which ran for you Erikd. So, something really strange is going on. Are you guys on linux?
[/quote]
This is my work machine and it is Win2K SP3. I’ve run other lwjgl programs before with no trouble.

I’m using

java version “1.4.1_02”
Java™ 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot™ Client VM (build 1.4.1_02-b06, mixed mode)

might it need a different SDK?

Ugh! That’s because the files actually has a MD3 extension not md3. I have GOT to remember to keep my capitalization correct.

If you change it to md3 in the jme/data/Paladin directory it should run. I’ll make sure to fix that.

Man, this is not going nearly as smoothly as I’d had hoped :slight_smile:

zParticle: OS and java specs look the same as the machine I’m on right now. I must be doing something wrong with the frequency parameter that doesn’t work with some Cards? Monitors? I’ll see if I can’t fix this.

Ok, Updated. I removed all checks for frequency while setting the display mode. See if that helps any.