Input handler for strategy games

Thats pretty cool, I didn't know there was there was a complete selection box done. However picking is something I want to keep separate from the handler, because there are many ways to organize your data in the scene graph and only a small selection of objects presented is the gameworld that can be picked. The way you do picking would be closely related to the details of your application and cannot be easily abstracted in a separate class without sacrificing efficiency.

A few minor fixes and speed improvements. Also a fix for compatibility with the new jme update.

Edit: hosting changed to http://code.google.com/p/jmeaddons/

So, what is next?

Next I will keep working on my game :stuck_out_tongue:

A new version, unfortunately with some API changes (don't hate me  XD )

Edit: hosting changed to http://code.google.com/p/jmeaddons/

Hi .



Are you aware that your code requires Java 6 ?

[…]

at org.lex.game.Demo.main(Demo.java:118)

Caused by: java.lang.NoSuchMethodError: java.util.Arrays.copyOf([II)[I

at org.lex.input.mouse.Cursor.getRotatedCursor(Cursor.java:470)



By the way, where could i find the source of your mousemanager classes to try to fix it myself ?

Ah, thanx! Now its fixed…



The source for the mouseManager is here: http://www.jmonkeyengine.com/jmeforum/index.php?topic=5623.0

I am not ready to make a release, so you can apply a patch manually, its a bit trickier than you might think:



                        if (delays != null) {
            cursor.delays = new int[delays.length];
            for (int i = 0; i < delays.length; i++) {
               cursor.delays[i] = delays[i];
            }
         }

Here is a major update:

Edit: hosting changed to http://code.google.com/p/jmeaddons/



I have pushed all the camera update methods into the handler, you no longer need to update your camera manually. The inputFilter library is now finished, though it will remain a part of the strategicHandler distribution.

Also I have added some cool camera effects. Let me know what you think.


Hello there,

I've got a small problem using StrategicHandler AND JMEDesktop.



For our game we use the strategicHandler Library. But now that we need some inputFields (for a serverIp and such things) we need a little Portion of the JMEDesktopState.

This state collides with the Handler as there are 2 different mice-cursors. If I disable the standard mouse and add the strategicHandler Textfields and Buttons are not clickable anymore.



Does anyone have a solution to that problem ? Or a basic idea what to do?



Regards Mimic

Try setting hardware mouse using mouseManager.setNativeMousePreferred(true).



Here is an example.


      MouseManager mouseManager = new MouseManager(CombinedMouse.get());
      strategicHandler = new StrategicHandler(cam, mouseManager, heightMap);
      
      mouseManager.registerWithInputHandler(strategicHandler);
      mouseManager.setNativeMousePreferred(true);

Lex,



Wanted to DL the latest version of this and play around with it but the link above is dead.  Is the stuff in google code up to date or is there an alternate location to get it from?



Thanks!

Thank you for posting this question… you helped me find this thread :slight_smile:



As an answer to your question - there is a link in the original post:

http://code.google.com/p/jmeaddons/



All code seems to be there? I will check it out also once I get home

I grabbed code from there last night but the Demo file bombs out on a NPE - can't recall exactly what right now as I'm at work and can't run it and I didn't want to post any "bugs" unless I was for certain using the most updated code.



From what I recall last night, I just get a black screen - no mouse cursor, nothing, and if I move the mouse around a bit it then bombs out on the NPE.  Doesn't matter if I'm in windowed or full screen or what resolution.  If you can recreate this or if it works just fine for you let me know either way.  I'm hoping Lex hops on here today and can offer some advice.  Thanks.

NPE is very strange. Post the stack trace so it's easier to figure out what goes wrong.



The most likely reason is some resources are missing: to reduce the download size the demo is using some textures from jmetest packages. Make sure you have both jme and jmetest packages in your classpath.

All the code is moved to googlecode, it has the most up to date version.



I might change fly-to-location code to make the effect smoother and maybe add more documentation. Other than that everything else is pretty well polished (hence the lack of updates).

I'll give it a go tonight when I get home and post any results.  Thanks for the update.

ok, tried from the src zip files and straight from SVN.  I'm guessing it's likely a missing dependency as you said but maybe you can point me in the direction of what exactly might be missing.  I am including the jME project (from CVS) on the build path:



Jan 14, 2008 9:20:38 PM class org.lex.game.Demo start()

SEVERE: Exception in game loop

java.lang.NullPointerException

at org.lex.input.mouse.Cursor.getRotatedCursor(Cursor.java:506)

at org.lex.input.StrategicHandler.assignScrollCursors(StrategicHandler.java:939)

at org.lex.input.StrategicHandler.updateCursors(StrategicHandler.java:896)

at org.lex.game.Demo.setupInput(Demo.java:346)

at org.lex.game.Demo.simpleInitGame(Demo.java:149)

at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:503)

at com.jme.app.BaseGame.start(BaseGame.java:69)

at org.lex.game.Demo.main(Demo.java:141)

Exception in thread "main" java.lang.NullPointerException

at com.jme.renderer.lwjgl.LWJGLRenderer.cleanup(LWJGLRenderer.java:1640)

at com.jme.app.BaseSimpleGame.cleanup(BaseSimpleGame.java:559)

at com.jme.app.BaseGame.start(BaseGame.java:97)

at org.lex.game.Demo.main(Demo.java:141)

Maybe the folder with cursors is missing from the build path.

In Eclipse, right click data folder under StartegicHandler project and select Build Path -> Use as Source Folder



NPE seems to be due to a missing url in a textureKey for loaded textures. Are you using a modified version of the TextureManager?

Got it working, though somehow my entire jME build got hosed over some missing lwjgl_fmod3 library or something.  I still don't think everything is right but at least your stuff (and my other projects) are running again.  Thanks for your help.  This is a great tool!  Really good work.  Thanks for making it available.

Your welcome! If you find any bugs or have some ideas on how to improve it, let me know.