Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  a working jinput game  (Read 4245 times)
0 Members and 1 Guest are viewing this topic.
Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Posted 2003-10-21 18:40:07 »

This is just jinput thrown into my tetris game. its not finished, and im not sure i will finish it, i just wanted to try out jinput in a game.

it even makes the keyboard control feel nicer than how i'd done it using AWT key refresh but i think i need to play with the speed to get it just right, it's a little touchy.

i tested it with keyboard input, and analog joystick input.

differentiating between x or y axis + or - was one thing that caught me... you'll find with the way i've done it that you can't set right to left and vice versa on an analog controller. digital axes may not work at all, but that's my fault. and buttons do work.

to fix this i need to do some more work, but i never have much time.

http://www.adam.com.au/kellyjones/java/InputAlpha.zip

Just unzip it somewhere, and run JMTetris.jar in the usual way. i included the jinput binaries. (i havent tested it without them in the same directory though). can someone who has jinput1.1 properly installed try running it on its own and let me know if that works too?
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #1 - Posted 2003-10-22 03:11:58 »

*cough* Web Start *cough*
Wink

(now that the WebStart/JInput plugin issues are resolved)

Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #2 - Posted 2003-10-23 19:30:03 »

ran into this problem:

Use of native libraries requires unrestricted access to system

i have <all-permissions> set
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2003-10-24 03:14:44 »

Very cool!

I'm glad you're seeing positive results.

if you find issues with either the APi or the plug-in(s) while working on this be sure to post them here Smiley

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #4 - Posted 2003-10-24 05:52:52 »

NOO!!!, don't post issues here, i'm trying to get back into coding my own stuff, don't post them anywhere, wait a few months Tongue

Seriously, post them here, and/or raise an issue over on the jinput.dev.java.net page.

Cheers

Endolf.

Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2003-10-25 04:10:26 »

Quote
ran into this problem:

Use of native libraries requires unrestricted access to system

i have <all-permissions> set


You need to decalre the native libs properly in the jnlp file.  Folks here have done it maybe one can give you an example...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #6 - Posted 2003-10-25 19:03:25 »

this is my first Webstart experience ever

ok, i messed up with some signing. fixed that, so it all loads and runs but the plugin isn't found, i'll look into it more later.

i noticed that my high scores file was being saved to the location i run the JNLP file from, and i dont know what happens when it's run from the net as my ISP hasnt got it set up for JNLP. what's the best solution in the case you want to save hi scores etc for the user?

Strangely enough it works if the controller folder is in the same location the jnlp file is launched from, but that's of no real use when it comes to web deployment.
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2003-10-25 21:44:56 »

Do you want individual user's high scores or competitive high scores across all users?  If the former I believ you should just be able to open a file on the local system as  long as the user has given you permissions.  If you want it to be a competitive high scroe board across users, you'll need to connect back to soem kind of server.  Typically this is done with a servlet.

As for your jnlp, I'm going to post a seperate thread asking for people to contribute their working examples.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #8 - Posted 2003-10-26 17:43:38 »

thanks.

meanwhile i fixed it so that the game knows which way the axis was pressed when the controls are being set so that left and right digital axes work correctly.

so now you can make it more challenging by setting right to left and left to right.

single jar if you have jinput installed into JRE:
http://www.adam.com.au/kellyjones/java/proto/jinput.jar

webstart that wont work due to ISP:
http://www.adam.com.au/kellyjones/java/proto/JMTetris.jnlp
(open it from addy line in webstart, works if jinput is installed to JRE)

ZIP with everything combined:
http://www.adam.com.au/kellyjones/java/InputAlpha.zip


Quote

Do you want individual user's high scores or competitive high scores across all users?  If the former I believ you should just be able to open a file on the local system as  long as the user has given you permissions.  If you want it to be a competitive high scroe board across users, you'll need to connect back to soem kind of server.  Typically this is done with a servlet.


i dont want a hi score server as i dont have a permanent connection or an isp willing to host a hi-score servlet.
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #9 - Posted 2003-10-26 20:19:56 »

There is a major problem with how you are bundling JInput.

Loading Tiles
Loading Graphics
Graphics Loading Done
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load /Users/scottpalmer/Desktop/InputAlpha Test/controller/libdxinput.jnilib
       at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1384)
       at java.lang.Runtime.loadLibrary0(Runtime.java:788)
       at java.lang.System.loadLibrary(System.java:832)
       at net.java.games.input.DirectInputEnvironmentPlugin.<clinit>(DirectInputEnvironmentPlugin.java:62)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
       at java.lang.Class.newInstance0(Class.java:306)
       at java.lang.Class.newInstance(Class.java:259)
       at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(DefaultControllerEnvironment.java:183)
       at net.java.games.input.DefaultControllerEnvironment.scanControllers(DefaultControllerEnvironment.java:164)
       at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultControllerEnvironment.java:57)
       at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultControllerEnvironment.java:108)
       at java.security.AccessController.doPrivileged(Native Method)
       at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:106)
       at InputManager.<init>(InputManager.java:20)
       at JMTetris.<init>(JMTetris.java:78)
       at JMTetris.main(JMTetris.java:637)

You see, I'm trying this on a Mac - and because of the way the windows JInput is bundled it simply doesn't work.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #10 - Posted 2003-10-26 23:04:41 »

i dont have a mac, so didnt know how to bundle it. the jmtetris jar on it's own will work as long as jinput is installed in the JRE... at least it does on windows.

is it possible to make a jinput bundled app that has jinput working on any OS like this? or does there need to be 3 separate downloads? it looks like the JARs from the other OS's would conflict.

i have never tested if the first situation is possible, but the best case scenario is to get webstart working so that it's all downloaded as needed, so im just waiting for now. i cant take any active part in the project, time's short recently.
Offline Jeff

JGO Coder




Got any cats?


« Reply #11 - Posted 2003-10-27 18:57:51 »

It *should* be possible with the JNLP to specify different configurations for different operating systems.

At worst you could make seperate JNLP files, but I don't think thats necessary...

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #12 - Posted 2003-10-28 03:09:19 »

I was testing the ZIP version when I posted the problem above.

Testing the JNLP I get:

Unable to load resource: http://www.adam.com.au/kellyjones/java/proto/HIDWrapper.jar

The structure of the JNLP looks ok at first glance.

Offline Jeff

JGO Coder




Got any cats?


« Reply #13 - Posted 2003-10-28 07:22:50 »

If you are zipping then you might need seperate zips.

We *could* theoretically make the plug-ins OS aware and have them default to empty controller sets if they are  on the wrong platform.

Arguments for or against?

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #14 - Posted 2003-10-28 08:31:06 »

For: It makes some sence, you can bundle all built plugins in one app and not worry about what platform it's on that way, larger download, less customisation.

Against: The linux plugin was broken again last time I played (joystick hat axes reversed and no hat working on my logiteck gamepad), it's broken enough, are you really wanting me to break it more? Smiley

Endolf

P.S. the linux plugin is in my list of things to fix, but unless someone other than me reports it, it can stay fairly low on said list. This is a vote for yes Smiley

Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #15 - Posted 2003-11-03 06:22:16 »

trying to make my code more adaptable by using an interface that specifies booleans for the 6 keys or buttons that i want to use, and generic methods (setKey (int keyNumber 1-6) and such), it's becoming quite complicated. though i never imagined i'd be replacing the input, let alone have the user able to choose which method to use at startup (awt or jinput).

about half way done but not working on it a heck of a lot. the game i posted here was a big hack. it didnt even make use of the original set keys dialog, just painted that over the top.

i used serialization with the awt input method, and it will be interesting to see what happens when i try to load or serialize stuff from jinput.
as long i make sure there's a catch for when the device is no longer plugged in etc. i'm assuming it should work OK. but we'll find out soon enough.

here's my interface, any suggestions welcome:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
abstract class InputInterface
{
      boolean
            up = false,                  //1
           down = false,            //2
           left = false,            //3
           right = false,            //4
           a = false,                  //5
           b = false;                  //6
     JMTetris owner;
      
      public InputInterface()
      {
            
      }
      
      public void setOwner(JMTetris in)
      //use this after loading from serialized.
     {
            owner = in;
      }
      
      
      abstract String setKey(int keyNum);
            //return ("key that was pressed");
           //only returns after the key is set.
           //used to display the key or button name in the game dialog.
}

Offline Jeff

JGO Coder




Got any cats?


« Reply #16 - Posted 2003-11-03 20:07:25 »

So this confuses me some...

What necessitated you put in AWT input as a backup?  If theres something we need to fix about JInput I'd like to get clear  on what it is.

Thanks

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline JuddMan

Senior Member


Medals: 1


Your Ad Here


« Reply #17 - Posted 2003-11-03 22:54:34 »

the game originally had AWT for the input, and it's a 'just in case'

also i really dont think i'd like to see any kind of AWTKeyboard becoming a part of jinput, this basically shows that they can both be used when needed.

for example im still going to use awt input for the keys such as the F1 - F8 that do certain things and escape for the menu in case diferent keyboard layouts result in jinput reporting diferent button numbers or names.
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #18 - Posted 2003-11-04 04:47:23 »

Hi
 ESC and the F keys should be ok, it's things like @ # and " that all go funny, some of the letters are in different places if I recall on french/german keyboards too, but it's been a while since I saw one, all I remeber is that they were a pain to use Smiley. But the point is ESC and F1-F8 are safe.

I believe under windows that the keyboard layout is handled under directx so it's not a worry on windows, under linux it is a problem, I'm not sure about OSx.

Cheers

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (26 views)
2014-09-07 01:12:14

Longarmx (33 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (39 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!