RoboFight - LD32 Compo entry

[h1]RoboFight[/h1]
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 [icode]java -jar RoboFight.jar -XstartOnFirstThread[/icode] without which LWJGL3 will not start.


LudumDare Entry Page | Download JAR | Source code (GitHub)

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

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

Sure:

@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?

Hmm, good question.
When I open up dxdiag.exe it says I have a display with Intel® 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.

@ 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 :slight_smile:

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.


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.

@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?

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.

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.

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

@CommanderKeith

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


java -jar RoboFight.jar > file.log

It is more simple. And didn’t the output contained something like [icode]: [/icode] line? I guessed that there is one such line before the exception is thrown. Is there any such thing?

For maximum usability you should have a Swing window that pops up or something to fall back on that displays the error.

@BurntPizza

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

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.