Micro Bot Wars (JavaFX)

I had been working on a game for the JavaFX contest, but couldn’t get what I wanted(performance problems and JavaFX bugs) so I didn’t work on it much, until the day before it was due, I was like wth(Thanks to minecraft, I saw the amount of updates and thought I should stop being lazy) and worked all day and night till 6am. I had to change a lot to get something playable, which meant a lot had to be removed.

And I ended up with something simple:
Applet:
http://www.pokemonworldonline.net/games/microbotwars/Micro_Bot_Wars.html
Webstart:
http://www.pokemonworldonline.net/games/microbotwars/Micro_Bot_Wars_browser.jnlp

Controls are: Arrow keys and mouse client to fire, and AWSD and F to fire.
P to pause.

It’s a 2d 2player robot battle game. Sorry no AI yet. Its a applet.
Enjoy the music (made by Blackhole).

The idea is from a crappy game “The dot game” my brother used to play, which was a dot shooting at other dots on a black screen, which supported a lot of players. I don’t remember what it was called.

I’ll be adding up to 8+ players, AI, power ups, options, maps, more tiles, more art, cell phone version, etc

And later once JavaFX is optimised a little more, I’ll build what I wanted in the first place but as a separate game.

Note: The game will lag if there’s lots of bullets on screen.

Last changes:

1.01
Added heath bars.
Removed heath stats.
Added pause fuction §.

1.02
Moved the position where the bullets fire.
When a player dies, only that character is now restarted.
Fixed firing through walls.
Complied using JavaFx 1.2.
Fixed a few bugs.
Speed up the bullet firing.
Optimisations x3.
Temporary removed song changing.

Nice music. =)

Can I shoot? I want to shoot!

Yep, I updated the post for the controls.

I can shoot but not move :frowning:

I can do nothing. I see the screen, hear music, but nothing happens if I press those buttons on the keyboards.

Odd, I guess that is a JavaFX bug…
I’ve tested it on firefox 3, chrome 2 and IE 8.
I’ll get webstart version up and see if that solves anything…

I can’t shoot. Neither the mouse button nor f does anything.

Can you try the webstart version?
It’s odd that everything is working perfectly for me :-\

Hmmm - very long load time, then game screen, loud music which kept stuttering and;

Exception in thread "TimerQueue" java.lang.IllegalThreadStateException: forbid thread creation in disposed TG
	at sun.plugin.security.ActivatorSecurityManager.checkAccess(Unknown Source)
	at java.lang.ThreadGroup.checkAccess(Unknown Source)
	at java.lang.Thread.init(Unknown Source)
	at java.lang.Thread.<init>(Unknown Source)
	at java.awt.EventDispatchThread.<init>(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.EventQueue.initDispatchThread(Unknown Source)
	at java.awt.EventQueue.postEventPrivate(Unknown Source)
	at java.awt.EventQueue.postEvent(Unknown Source)
	at java.awt.EventQueue.invokeLater(Unknown Source)
	at javax.swing.SwingUtilities.invokeLater(Unknown Source)
	at javax.swing.Timer.post(Unknown Source)
	at javax.swing.TimerQueue.postExpiredTimers(Unknown Source)
	at javax.swing.TimerQueue.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
JNLPAppletLauncher: static initializer
Exception in trigger:
java.lang.IllegalArgumentException: Contrast must be in the range [0.25, 4]
	at com.sun.scenario.effect.ColorAdjust.setContrast(Unknown Source)
	at javafx.scene.effect.ColorAdjust$5.onChange(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable$4.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable$4.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable.notifyListeners(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable.replaceValue(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable.setAsFloat(Unknown Source)
	at com.sun.javafx.runtime.location.FloatVariable$2.apply(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractVariable.needDefault(Unknown Source)
	at javafx.scene.effect.ColorAdjust.initialize$(Unknown Source)
	at microbotwars.BackgroundLoader.<clinit>(BackgroundLoader.fx:28)
	at microbotwars.RenderWindow.<clinit>(RenderWindow.fx:50)
	at microbotwars.Main.javafx$run$(Main.fx:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet.launchStage(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.lambda(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.Entry$2.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Exception in trigger:
com.sun.media.jmc.OperationUnsupportedException: Invalid stop time specified
	at com.sun.media.jmcimpl.plugins.javapeer.MediaPlayer.setStopTime(Unknown Source)
	at com.sun.media.jmc.MediaProvider.setStopTime(Unknown Source)
	at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
	at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
	at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
	at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractVariable$4.apply(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractVariable.needDefault(Unknown Source)
	at javafx.scene.media.MediaPlayer.initialize$(Unknown Source)
	at microbotwars.RenderWindow.<clinit>(RenderWindow.fx:93)
	at microbotwars.Main.javafx$run$(Main.fx:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet.launchStage(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.lambda(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.Entry$2.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

[quote]java.lang.IllegalArgumentException: Contrast must be in the range [0.25, 4]
[/quote]
Ah there we go. Try it now.

Crap that means I gave a buggy version for the contest.

As for the other error “Invalid stop time specified”, its a bug in JavaFX but things still work fine.

It worked for me in Firefox 3 on vista32. I didn’t think I could shoot either but then I noticed it was hurting the other ball, just no visible bullet graphic.

sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: java.io.IOException: Response is unreliable: its validity interval is out-of-date
at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.LaunchDownload.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.LaunchDownload.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.cert.CertPathValidatorException: java.io.IOException: Response is unreliable: its validity interval is out-of-date
at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(Unknown Source)
at sun.security.provider.certpath.PKIXCertPathValidator.doValidate(Unknown Source)
at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(Unknown Source)
at java.security.cert.CertPathValidator.validate(Unknown Source)
… 16 more
Caused by: java.io.IOException: Response is unreliable: its validity interval is out-of-date
at sun.security.provider.certpath.OCSPResponse$SingleResponse.(Unknown Source)
at sun.security.provider.certpath.OCSPResponse$SingleResponse.(Unknown Source)
at sun.security.provider.certpath.OCSPResponse.(Unknown Source)
at sun.security.provider.certpath.OCSPChecker.check(Unknown Source)
… 20 more

Bullet is small, I might have to make it larger.

CyanPrime I have no idea on that error. Google didn’t help. Anyone know why?

Edit: Bullets are more visible.

[quote]Java Plug-in 1.6.0_07
Utilisation de la version JRE 1.6.0_07 Java HotSpot™ Client VM
Répertoire d’accueil de l’utilisateur = C:\Documents and Settings-DzzD-


c: effacer la fenêtre de la console
f: finaliser les objets de la file d’attente de finalisation
g: libérer la mémoire
h: afficher ce message d’aide
l: vider la liste des chargeurs de classes
m: imprimer le relevé d’utilisation de la mémoire
o: déclencher la consignation
p: recharger la configuration du proxy
q: masquer la console
r: recharger la configuration des politiques
s: vider les propriétés système et déploiement
t: vider la liste des threads
v: vider la pile des threads
x: effacer le cache de chargeurs de classes
0-5: fixer le niveau de traçage à

JNLPAppletLauncher: static initializer
Exception in trigger:
com.sun.media.jmc.OperationUnsupportedException: Invalid stop time specified
at com.sun.media.jmcimpl.plugins.javapeer.MediaPlayer.setStopTime(Unknown Source)
at com.sun.media.jmc.MediaProvider.setStopTime(Unknown Source)
at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
at com.sun.javafx.runtime.location.AbstractVariable$4.apply(Unknown Source)
at com.sun.javafx.runtime.location.AbstractVariable.needDefault(Unknown Source)
at javafx.scene.media.MediaPlayer.initialize$(Unknown Source)
at microbotwars.RenderWindow.(RenderWindow.fx:93)
at microbotwars.Main.javafx$run$(Main.fx:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.runtime.adapter.Applet.launchStage(Unknown Source)
at com.sun.javafx.runtime.adapter.Applet$1.lambda(Unknown Source)
at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
at com.sun.javafx.runtime.Entry$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
[/quote]
even with that exception Applet start and sound is ok but I am unable to move or to do anything

That error comes from not liking one of my mp3’s. But so far that hasn’t caused any problems for me. Not sure why you can’t move… is it a problem with the webstart too?

but… I hate Webstart :’(,

ok… for you … I did a test and unfortunatly seems worse than the Applet

Thanks, though that still didn’t help :-
Not sure what’s going on here.

Applet work here. But it throw that :

Exception in trigger:
com.sun.media.jmc.OperationUnsupportedException: Invalid stop time specified
	at com.sun.media.jmcimpl.plugins.javapeer.MediaPlayer.setStopTime(Unknown Source)
	at com.sun.media.jmc.MediaProvider.setStopTime(Unknown Source)
	at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
	at javafx.scene.media.MediaPlayer$8.onChange(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
	at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
	at javafx.scene.media.MediaPlayer$1.onChange(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable$2.onAction(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.location.DependencyIterator.action(Unknown Source)
	at com.sun.javafx.runtime.util.Linkables.iterate(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractLocation.iterateChildren(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(Unknown Source)
	at com.sun.javafx.runtime.location.ObjectVariable.set(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractVariable$4.apply(Unknown Source)
	at com.sun.javafx.runtime.location.AbstractVariable.needDefault(Unknown Source)
	at javafx.scene.media.MediaPlayer.initialize$(Unknown Source)
	at microbotwars.RenderWindow.<clinit>(RenderWindow.fx:93)
	at microbotwars.Main.javafx$run$(Main.fx:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet.launchStage(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.lambda(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.adapter.Applet$1.invoke(Unknown Source)
	at com.sun.javafx.runtime.Entry$2.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Nice music. Bullet is really too small.

N.B. Please remove the install shortcut with Webstart

Updated, hopefully should work better being JavaFX 1.2.

About the control issue:

[quote]RT-4802: Applet might not respond to user input.

Description: Under some conditions, an applet window loses keyboard focus and is unable to regain focus. When this occurs, the applet is unable to respond to user input. This bug is often triggered in a tabbed browser, after the user has selected another tab in the same browser window and then returns to the original tab. This issue occurs on Firefox 3.0 and Internet Explorer 7 on Windows, on Firefox 3.0 on Linux, and on Firefox 3.0 on OpenSolaris.
[/quote]
Edit: server problems, fixing them…

Ok back up. Seems this server didn’t have the jnlp mime type. Annoying…