Red Game 2D Engine tech demo

Here is a small and very simple tech demo for my 2D engine:

https://dl.dropbox.com/s/8usme6rssbhkqk4/general%20shot.png?dl=0

FEATURES:

  • simple animations (very simple)
  • particle effects
  • slow motion
  • controller support
  • surround sound

KEYBOARD CONTROLS:

  • WASD: move
  • mouse: aim
  • left mouse button: shoot
  • right mouse button: toggle slow motion
  • scroll: zoom
  • escape: exit

CONTROLLER CONTROLS:

  • left thumb stick: move
  • right thumb stick: aim
  • right trigger: shoot
  • A: toggle slow motion
  • POV Y (up and down on that little plus thing): zoom
  • start: exit (i just realised how weird that sounds)

EXTRA CONTROLS:

  • f1: toggle fullscreen
  • f2: toggle debug mode
  • f3: open grapher

DOWNLOAD:

KNOWN BUGS:

  • PS controllers don’t work
  • on my computer (not sure about others) there is an error which has to do with the GUI but it doesn’t effect anything at all

made using ‘Space Art’ by Kenney.
sounds by myself.

getting the error “Could not launch game. See console for details.”

https://dl.dropboxusercontent.com/u/33049592/cmd.bmp

I’ll have a look at that this afternoon… Can’t get on computer atm…

Can I just have some more information here?
Was it before it started loading?
During loading?
After it finished?
If it was during loading, what file was it on? (As close as you can)

Nvm… Just figured it out by looking at github…
Do you have your java_home variable set up? Because it doesn’t seem like it is finding it…

That is not at all what is happening there. If the Java path could not be found then it would say something along the lines of “Java is not recognized as an internal or external command”.

Let me guess… You’re trying to run a command in the program that starts another program? This is the program that it can’t find.

I am not just running the ‘Java’ command, I’m running ‘%java_home%/bin/java’…
But System.getenv(“java_home”) is returning null…

… Why would you run the JVM? The Jar will start the JVM for you.

Because it has to extract some jars and natives…
I put it all into a jar for convenience but the way it works is:

  • when you start the jar, it will use the main-class in the manifest which is rg.launcher.Launcher
  • it will go through all the files and if it is in the lib/ directory it will extract it
  • relaunch the jar with the extracted jars in the class path, the natives as the library and the main class for the actuall game as the… Well… Main class

I couldn’t just continue on after extracting the files… It wouldn’t work, I had to restart it

I just figured out that System.getProperty(“java.home”) works better…
I’ll try to fix it this afternoon, if not I will set it as my first priority when I get home from my holiday…

I have fixed that bug (along with other tiny bugs) and it should work now…
I have updated the download links so you will have to download it again…

Can someone please try it to see if it works and to say what they think of it?

Gets further in the start up process but fails with the following error now:


java -jar faster.jar

java.io.FileNotFoundException: img\icon\i
con.png (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at rg.utils.ImageUtils.loadImage(ImageUtils.java:56)
        at rg.core.World.setIcon(World.java:220)
        at Main.main(Main.java:21)
java.io.FileNotFoundException: img\icon\icon-large.png (The system cannot find t
he path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at rg.utils.ImageUtils.loadImage(ImageUtils.java:56)
        at rg.core.World.setIcon(World.java:222)
        at Main.main(Main.java:21)
Exception in thread "main" java.lang.NullPointerException
        at rg.utils.ImageUtils.resizeImage(ImageUtils.java:73)
        at rg.core.World.setIcon(World.java:227)
        at Main.main(Main.java:21)

I have an idea of how to fix it but sadly I’m going away tomorrow…
You will have to wait till next week (i might put it in a fresh topic)…

Don’t create separate topics. Use the same one.

Would anybody here know why that in the Jar, instead of having a folder ‘foo’ which contains the file ‘bar’, there is a file which is named ‘foo\bar’?

Because it looks like that is what is going wrong… I think… (Can some1 check that? Just look into one of the jars to see if there is an ‘img’ folder or files starting with ‘img’)

You are using a FileInputStream to try read the file “img\icon\icon-large.png” from inside the jar. This won’t work as its technically not a file but a file inside another file (you probably have it extracted locally on your computer hence why its working there).

Use something like getResourceAsStream instead, plenty of tutorial online on how to load resources from inside a jar.

It only uses a FileInputStream if .getResourceAsStream() returns null…
It’s a universal all-in-one kind-of thingy-Ma-bog…

But know that I think of it, you are probably right!
Because I have it locally on my computer it is going to the second option (FileInputStream) and working… But that still doesn’t fix the problem of why the files are screwed up in the jar… I think it may be because the file seperator is a back-slash when a jar should have forward slashes…

Sadly I can’t fix it in a while… But I will set is as my first priority when I get back…

FINALLY FIXED
and I have tested it on my computer away from the files so it ‘should’ work… (I have said ‘should’ before in this topic… so… yeah…)

I also added some new features which you can see at the top:

  • scrolling
  • toggle anti-aliasing (not working, do not use)

I also have less memory usage… don’t know how I did that though… :-\

sry for all the problems… hopefully you enjoy…