EDIT: Failed to mention where the new AnimText (BitmapText alternative) can be found. Currently it can only be found in the sample game project, under ui/components/ as I spent most of my time as of late optimizing the buffer handling for the 2D framework and not finishing this up. Atm, it handles single lines of text for animation purposes and doesn’t give any control over things like Kerning.
Please do let me know how it works for you if you give it a try…
The game has a few small quirks in formation reset after death in some odd circumstance and I just don’t have time to finish it atm. But the source is very useful and it’s fun to play! It really hasn’t been optimized for Android, but does run. It’s basically there for showing how to use the 2D framework and something to try on the desktop.
Keyboard:
L/R Arrows: Moves you back and forth
Spacebar: Fires guns
Right ALT: Launches missle / detonates missles
ESC: Main main
Joystick:
Stick: Moves you back and forth
Button0: Fires guns
Button1: Launches missle / detonates missles
Button7: Main menu
Android:
VStick: Moves you back and forth
Button: Fires guns
No control for missles, because I never got around to actually making this flly work with Android
Everything else is touch controlled.
I did have 2 problems though:
First the game wouldn’t start on full screen (game me a failed to create display(-2) error or something), however non-fullscreen did work. The menu also didn’t fully work for me, I couldn’t go into Controls & Sound, however new game & exit game did work.
@reveance said:
Very nice! It runs very smooth for me..
I did have 2 problems though:
First the game wouldn’t start on full screen (game me a failed to create display(-2) error or something), however non-fullscreen did work. The menu also didn’t fully work for me, I couldn’t go into Controls & Sound, however new game & exit game did work.
Other than that, very cool
Sorry about the menu thing, I never implemented all of the options. Eventually I’ll finish it up.
As for the fullscreen. This is a JME issue. Keep selecting screen resolutions until you can select a refresh rate that your monitor actually supports. It should work fine at that point. Also remember to select the proper color depth!
@t0neg0d said:
Sorry about the menu thing, I never implemented all of the options. Eventually I'll finish it up.
As for the fullscreen. This is a JME issue. Keep selecting screen resolutions until you can select a refresh rate that your monitor actually supports. It should work fine at that point. Also remember to select the proper color depth!
It doesn’t matter, I just thought the maybe the menu wasn’t working just for me
And thanks for the full screen thing, it was indeed me selecting wrong settings works now
Sorry for bumping this again. I failed to mention something rather important:
The new AnimText (alternate BitmapText class) can be found in the Game’s source. I have not added this to the library yet, though it seems to work very well… I was focusing on improvements for handling buffers for the 2D framework’s core class AnimElement, which the AnimText class leverages.
Atm, the class allows you to create single lines of text for animation purposes and has no real control over things like Kerning and such. I’ll update this for multiline text at least before adding it to the library.
If anyone has the time, I’d love to hear how it goes using this.
You’ll also find the menu class in the same package as AnimText. This shows how you can animate individual characters (though, this is fairly self explanatory after using AnimElement).
One last “undocumented” feature that was added as of late:
[java]
Element.setAsContainerOnly();
[/java]
This removes all renderable components from an Element leaving a Node with all of the Element’s functionality.
This was added to accommodate layers when using the 2D framework, though can be leveraged for other purposes. Seemed a better idea than creating a separate class.
Use the following settings for creating a layer. (i.e.game stage, ui layer, background, etc… containers that should always appear in the order they are added)
I downloaded the Galaga.rar from the Google Code, but discovered it needs to be updated to use the new .gui.xml file extension. I realize you probably can’t update the RAR on GC at this point.
Is there an up-to-date Galaga project available via SVN?
@sgold said:
I downloaded the Galaga.rar from the Google Code, but discovered it needs to be updated to use the new .gui.xml file extension. I realize you probably can't update the RAR on GC at this point.
Is there an up-to-date Galaga project available via SVN?
I’ll have this up in… about 60(ish) minutes?
I was just playing with it… trying to narrow down what works well/does not work well on Android.
I think I may need to update TemporalActions with a flag that allows the user to force transform usage as apposed to buffer changes to help provide a way to squeeze every last ounce performance out of animation-rich projects.
Atm, the project runs on Android… with some issues… but is very slow just due to the shear number of animations running/Particle emitters used, etc.
So… give me an hour and I’ll post the new link!
@sgold said:
I downloaded the Galaga.rar from the Google Code, but discovered it needs to be updated to use the new .gui.xml file extension. I realize you probably can't update the RAR on GC at this point.
Is there an up-to-date Galaga project available via SVN?
Ok… the updated version is currently being uploaded to:
I failed to mention… you’ll need to re-enable Joystick support in Main.main
Just uncomment the AppSettings (well… everything but where it is setting the icons).
In other news, I think I’ll be rewritting this in an Android friendly way as another Android example project. I’ll post a link to the Android-friendly version once it is completed.
I’ll likely use the original and the new as a guide to both using the 2D Framework and considerations for making Android/iOS ready games with the framework.
Unfortunately the new version doesn’t address my issue. When I run the app in the IDE I get
Problem loading style map: java.lang.IllegalStateException: No loader registered for type "xml"
May 07, 2014 6:09:58 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at tonegod.gui.core.Element.<init>(Element.java:203)
at tonegod.gui.controls.util.ModalBackground.<init>(ModalBackground.java:26)
at tonegod.gui.core.Screen.initModalBackground(Screen.java:2410)
at tonegod.gui.core.Screen.setSpatial(Screen.java:1916)
at com.jme3.scene.Spatial.addControl(Spatial.java:602)
at mygame.Main.initGUIScreen(Main.java:314)
at mygame.Main.simpleInitApp(Main.java:122)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
The following code in Main.java:
[java]
private void initGUIScreen() {
screen = new Screen(this, “mygame/ui/style_map.xml”);
[/java]
apparently needs to be updated to refer to a “.gui.xml” file.
@sgold I see what happened. It appended to the archive instead of recreating it. The correct version is in the source as well, but I doubt the project updated properly. Recreating it and uploading the new rar.
EDIT: This gave me the chance to re-enable joystick support anyways
With the new RAR, I was able to run Galaga. I’ve played a few levels, and had fun. GREAT DEMO!!
Every time I run the game see a strange warning:
WARNING: Found unknown Windows version: Windows 7
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
I’ve never seen this warning before. I’m not sure if it is important.
Plus, the first time it ran I got an NPE in AnimMenu.java line 291, but I haven’t been able to reproduce that.
Anyway, thanks for making this available. We need more open source games. Browsing the source of a complete app is always educational.
@sgold said:
With the new RAR, I was able to run Galaga. I've played a few levels, and had fun. GREAT DEMO!!
Every time I run the game see a strange warning:
WARNING: Found unknown Windows version: Windows 7
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
I’ve never seen this warning before. I’m not sure if it is important.
Plus, the first time it ran I got an NPE in AnimMenu.java line 291, but I haven’t been able to reproduce that.
Anyway, thanks for making this available. We need more open source games. Browsing the source of a complete app is always educational.
Make sure you run clean & build on the project at some point. Compile on save is disabled from testing on Android.
Likely it is due to this & the fact that the original project was created on my old machine (Old version of Windows 7)
@t0neg0d said:
Make sure you run clean & build on the project at some point.
Good suggestion. Unfortunately when I “Clean and Build” on the project I get
Copying 1 file to S:\SVN\Galaga\mobile\libs
S:\SVN\Galaga\nbproject\mobile-impl.xml:21: The following error occurred while executing this line:
S:\SVN\Galaga\mobile\build.xml:90: Cannot find D:\Java 3rd Party Libraries\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml imported from S:\SVN\Galaga\mobile\build.xml
BUILD FAILED (total time: 6 seconds)
Looks like you hardcoded an absolute path in “mobile/build.xml”. (I extracted the project to my S: drive.)
Oh… also you’ll notice I just didn’t handle scaling of the ui very well either as I was just figuring out ways of mixing and matching the 2D framework & gui controls… and my initial attempts here (before staring to integrate the framework) were probably less than a good way of handling things.
It looks like the NPE you saw was related to an ActionListener for mapping keyboard controls to the menu. I’ll see if I can figure it out here.