Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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  
  RoboFight - LD32 Compo entry  (Read 11607 times)
0 Members and 1 Guest are viewing this topic.
Offline SHC
« Posted 2015-04-20 03:07:38 »





RoboFight


A simple one-one 2d fighting combat game, where you fight by throwing needles or stinky socks. The other robot (the dark one) is the enemy, and is controlled by the computer.

The controls are simple, use A/D to move, SPACE to jump, ESC to pause. Use RIGHT/UP arrows to shoot and the DOWN arrow to turn on the shield. You can use the F1 key to switch between Windowed and Fullscreen modes. There is a tutorial in the game which will teach you the controls.

Thanks to LD, this is my second completed game. My first one is also in LD too. Thanks a lot LD!!

This game is written using Java 8 and requires a GPU capable of OpenGL 3.3 or higher. Any decent card released after 2008 will work. There is an issue for mac users, they have to run this jar using the terminal with
java -jar RoboFight.jar -XstartOnFirstThread
without which LWJGL3 will not start.


Offline CommanderKeith
« Reply #1 - Posted 2015-04-21 06:36:55 »

Looks nice, but I couldn't get the game to start from double clicking the jar.
javaw.exe fires up in windows task manager but then promptly closes in a second or two, with nothing shown on the screen.
Windows 7, 64 bit, java 8, nvidia.
Cheers

Offline SHC
« Reply #2 - Posted 2015-04-21 11:08:35 »

@CommanderKeith

That's very weird, can you try running it from the terminal? I think there will be some exceptions thrown in the console. It would be helpful for me to find out what the problem is, never experienced this.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #3 - Posted 2015-04-22 04:27:50 »

Sure:


Offline SHC
« Reply #4 - Posted 2015-04-22 04:42:18 »

@CommanderKeith

I'm pretty sure that it is crashing due to unavailable requested context. It is failing to find a OpenGL 3.3 context in core profile. What's your GPU?

Offline CommanderKeith
« Reply #5 - Posted 2015-04-22 05:07:46 »

Hmm, good question.
When I open up dxdiag.exe it says I have a display with Intel(R) HD graphics 4000 with 1696MB memory.
But When I open up the NVidia control panel and select system info, it says I have a GT GeForce 630M with 2048MB dedicated memory.

So I'm not sure which video card is being used by default.
But other LWJGL games work on this computer.

Offline Springrbua
« Reply #6 - Posted 2015-04-22 06:28:30 »

@ CommanderKeith is it a Notebook? If yes, Optimus tries to start "simple" games with the integrated Intel HD GPU, to save energy, and only Games which need more GPU-Performance, will be started with the nVidia by default. But optimus sometimes fails to decide which one it should use, so you need to manually start it with the nVidia.
This can be done by right-clicking the game -> start with GPU -> nVidia.
But as much as i remeber this won't wok with java, as they are started with another ".exe" (under windows). For those games you need to go to the nVidia system configuration.
There you will see a drop list of games. If you click on the "add" button, you will see the latest started games. There should be a "Java" entry, which you should add. Then select "use nVidia" and it should now start with the dedicated nVidia GPU.

Hope it helps Smiley
Offline SHC
« Reply #7 - Posted 2015-04-22 07:07:16 »

This is getting interesting, my quick search for Intel HD 4000 says that it supports OpenGL 4.1 on Windows. Dunno why it is failing to get a context. Tracing back in my code, it originates in my Window class, like this.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public Window(int width, int height, String title, Monitor monitor, Window share)
{
    size = new Vector2(width, height);
    position = new Vector2();
    this.title = title;
    this.monitor = monitor;

    handle = glfwCreateWindow(width, height, title, monitor == null ? NULL : monitor.getHandle(), share == null ? NULL : share.getHandle());

   if (handle == NULL)
       throw new RuntimeException("Cannot create window");

    registeredWindows.put(handle, this);

    // Initialize the native callbacks
    initNativeCallbacks();
}

It is that glfwCreateWindow is returning the handle as NULL aka 0. My guess is that it failed to find a context, which should not happen on your GPU. Checking with my code, I forgot to add a GLFW error callback, so I'll make a build now after setting it. I think that is the only way to find out what is happening. Will upload the new build soon.

Offline SHC
« Reply #8 - Posted 2015-04-22 08:41:51 »

@CommanderKeith

I have updated the download links to the latest build with error callback. I think this should find out what the error is. Will you please try running it for me again?

Offline CommanderKeith
« Reply #9 - Posted 2015-04-22 13:10:33 »

I'm still seeing the same error, cannot create window.
By the way, try making the program dump out System.out to a text file next to the jar file, that way I can easily post the error for you.

@ CommanderKeith is it a Notebook? If yes, Optimus tries to start "simple" games with the integrated Intel HD GPU, to save energy, and only Games which need more GPU-Performance, will be started with the nVidia by default. But optimus sometimes fails to decide which one it should use, so you need to manually start it with the nVidia.
This can be done by right-clicking the game -> start with GPU -> nVidia.
But as much as i remeber this won't wok with java, as they are started with another ".exe" (under windows). For those games you need to go to the nVidia system configuration.
There you will see a drop list of games. If you click on the "add" button, you will see the latest started games. There should be a "Java" entry, which you should add. Then select "use nVidia" and it should now start with the dedicated nVidia GPU.

Hope it helps Smiley
Thanks for the tip, you're right! The Nvidia control panel does have a list of programs with the choice of what graphics card should be used.
Strangely, I can't see java.exe or javaw.exe in there. But I can add them to the list manually.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Springrbua
« Reply #10 - Posted 2015-04-22 13:43:27 »

New games or programms are usually not in the list.
Adding them manually is much easier, if you start them once. Then they will appear on top of the "last started"-list, which appears when you press "add".
Offline SHC
« Reply #11 - Posted 2015-04-22 15:53:01 »

@CommanderKeith

You can always redirect the output to the text file from command prompt. Use the redirection operator.

1  
java -jar RoboFight.jar > file.log

It is more simple. And didn't the output contained something like
<integer>: <description>
line? I guessed that there is one such line before the exception is thrown. Is there any such thing?

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #12 - Posted 2015-04-22 16:20:50 »

For maximum usability you should have a Swing window that pops up or something to fall back on that displays the error.
Offline SHC
« Reply #13 - Posted 2015-04-22 16:25:48 »

@BurntPizza

The problem is, swing doesn't work well with LWJGL3, especially on Mac OS X. It just hangs the game.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #14 - Posted 2015-04-22 16:43:29 »

No, a swing window solely to display an error if the game couldn't get a LWJGL window to work. Not for normal operation.
Even a JOptionPane would work in a pinch.
Pages: [1]
  ignore  |  Print  
 
 

 
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!