Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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  
  Sample JNLP files?  (Read 2359 times)
0 Members and 1 Guest are viewing this topic.
Offline Jeff

JGO Coder




Got any cats?


« Posted 2003-10-25 23:46:17 »

Hey Folks,

Can someone with a JNLP that works with JInput post their JNLP file as an example for others trying to do the same?

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 swpalmer

JGO Coder




Where's the Kaboom?


« Reply #1 - Posted 2003-10-26 00:07:37 »

A template for JOGL, JOAL, and JInput use via JNLP should be put in the Wiki and/or shared files area of the games project or relevant sub-projects.

Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2003-11-26 16:11:29 »

Does anyone have a JNLP that works with JInput?

I've been playing around for half hour but don't seem to be able to WS to even notice the plugin jars.

Kev

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

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2003-11-26 18:57:40 »

Everything seems to work apart from the "controller" directory. If I want to package the controllers with my app they'll get put in the java web start cache directory.

However, the "current" directory when you run webstart is the directory where the webstart executable is installed. If I stick a controller directory with the appropriate files in there it works fine.

Now, I could use the property "jinput.controllerPluginPath" (thanks endolf), to point jinput at the web start cache, if I knew where it was. Now, I could just assume the structure of Java Web Start to path to it, but I can't be sure that other JNLP implementations will work that way (or JWS in the future)....

So.. I appear to be stuck. I could hack round it. It seems the plugin directory location needs to be slightly altered.. or rather finding it does (if JInput is to work with webstart).

Kev

Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2003-11-26 19:04:28 »

In addition.. since the plugin jar name and plugin dll name have to the be same, you can't deploy it with web start since it renames jars but not dlls.

EDIT: If this is actually a problem, it might be fixed by having the plugin class be able to report the name of the library it expects to load.

Kev

Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2003-11-27 01:37:21 »

I believe the webstart issues are solved.

There's a past thread  on it, I forget all the details.  Take a look for it and if you still can't make it work pls post back here.

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 kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #6 - Posted 2003-11-27 05:58:13 »

Hey again,

Apologies for the spew above, was getting frustrated. However, the problem still exists. I had actually read all the threads about webstarting with JInput. The only solution provided so far seems to be to have the plugins already present on the target system in a specific location (I believe $JAVA_HOME\controller was the example given).

That sort of negates the idea of deploying via webstart tho.

EDIT: Everything above still applies I think.

Kev

PS. Incidently, I only started to play with JInput yesterday and I'm already finding it easy to get on with. Thanks for making it a clean API. Smiley

Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #7 - Posted 2003-11-27 15:57:18 »

Ok, I have a deployable jinput webstart, but to do this I've had to introduce a bit of code and a property. There are no updates to JInput however.

I implemented a new Controller environment:

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  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
import net.java.games.input.ControllerEnvironment;
import net.java.games.input.Controller;

import java.util.StringTokenizer;
import java.util.ArrayList;

/**
 * A controller environment that will pick up default controllers but
 * in addition will also looks for a property specified plugin.
 *
 * This environemnt will obtain controller specified via the default
 * environment and any environments specified in the "jinput.plugins"
 * property. This allow webstart to simply path through all the files
 * required and then specify the property.
 *
 * @author Kevin Glass
 */

public class DirectControllerEnv extends ControllerEnvironment {
    public static final String PLUGINS_PROPERTY = "jinput.plugins";
    
    private ControllerEnvironment defaultEnv = ControllerEnvironment.getDefaultEnvironment();
    private Controller[] controllers;
    
    public DirectControllerEnv() {
        String plugins = System.getProperty(PLUGINS_PROPERTY);
        
        if ((plugins == null) || ("".equals(plugins))) {
            controllers = defaultEnv.getControllers();
        } else {
            ArrayList trolls = new ArrayList();
            
            addAll(defaultEnv.getControllers(),trolls);
            
            StringTokenizer classes = new StringTokenizer(plugins,",");
            while (classes.hasMoreTokens()) {
                String className = classes.nextToken();
                
                ControllerEnvironment env;
                
                try {
                    env = (ControllerEnvironment) Class.forName(className).newInstance();
                } catch (Exception e) {
                    System.err.println("Failed to instance environment");
                    continue;
                }
                
                addAll(env.getControllers(),trolls);
            }
            
            controllers = new Controller[trolls.size()];
            for (int i=0;i<trolls.size();i++) {
                controllers[i] = (Controller) trolls.get(i);
            }
        }
    }
    
    private void addAll(Controller[] controls,ArrayList list) {
        for (int i=0;i<controls.length;i++) {
            System.out.println("Detected Controller: "+controls[i]);
            list.add(controls[i]);
        }
    }
    
    public Controller[] getControllers() {
        return controllers;
    }
    
}


This environment allows the developer of the application to specify plugins that he/she knows are going to be distributed with the app in a comma seperated class list property ("jinput.plugins").

These classes are instanced using the "context" class loader. The libraries likewise are loaded with the "context" class loader.

The DirectControllerEnv does also include any controllers found by the DefaultControllerEnvironment. This way, when running at the command line the controllers directory can be used as normal.

However, when distributing via webstart no user is going to have access to the "controller" directory (since it'll be hidden away in the webstart cache) so the only plugins that are going to be available will be the ones the developer distributes.

In the JNLP the property can be specified to point at the distributed plugins and the jars and native libraries for the plugins can be packaged just the same as any other webstart jars/libraries. So the JNLP looks a bit like this:

1  
2  
3  
4  
5  
6  
7  
<resources os="Windows">
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>    
    <property name="jinput.plugins" value="net.java.games.input.DirectInputEnvironmentPlugin" />
    <jar href="lib/jogl-win32.jar"/>
    <jar href="controller/dxinput.jar"/>
    <nativelib href="lib/dxinput-native.jar"/>
  </resources>


For a full JNLP file that seems to be working check out http://www.newdawnsoftware.com/martian/jnlp/martian.jnlp.example.txt

Kev

PS. For details on how to package stuff for web start I wrote this tutorial that I'm trying to get checked: http://www.cokeandcode.com/info/webstart-howto.html

Offline Jeff

JGO Coder




Got any cats?


« Reply #8 - Posted 2003-11-27 18:50:42 »

Thanks. I thought we had this covered already Sad

Vote time guys:

Should we:

(a) Fold this code into the ControllerEnvironment.
(b) Add it as an additional API class (maybe change the name to JAWSControllerEnvironment ?)
(c) Leaves it as an example and exercise to the reader?

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 #9 - Posted 2003-11-27 20:47:43 »

Hi
 my vote is a, I think it probably belongs with all the other controller discovery, the Idea of it as another controller is a good work around, but I don't think its a permanant solution.
 Let me know and I'll do it tomorrow after work, it should take a few minutes to do Smiley, just got to agree on a property name, jinput.plugins works, which matches the jinput.contrllerPath one, on the other hand I saw jeff with a property along the lines on net.java.games.input.blah at some point, I suggest we make them consistant *before* version 1.0 release Smiley.

Cheers

Endolf

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

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #10 - Posted 2003-11-27 21:00:42 »

Could we stick with the simple property names, i.e. jinput.* . Just find the long ones unwieldy. The other property is the one about using the context class loader which you don't need if you make the change above.

EDIT: Incidently, martian madness now how JInput support. Woo hoo!

Kev

Offline Jeff

JGO Coder




Got any cats?


« Reply #11 - Posted 2003-11-27 23:17:06 »

hmm.  The reason for the long property name is so that there arent potential property collisions with other code.

But I agree its a pain in the arse.

In the end, either direction you guys want to go is fine with me

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 #12 - Posted 2003-11-28 06:04:23 »

Hi
 I understand the reason for it, there are a number of properties in my own code that run something like org.newdawn.darkvoid.starfighter.blah. I'm easy on this one, at the end of the day as long as it's settled before 1.0 we can always change out minds if we want to after it's done Smiley (with maybe a grace period where the outgoing technique, if set, prints a warning to the screen but continues to work). I'm not sure the shorter version will cause problems as it's unlikely that a games dev would have jinput in there project, and then something else called jinput too with a plugins property, but I could be just being short sighted.

I'll start on the short ones as I hate this keyboard Smiley, let me know if you have any objections (apart from my silly reasoning to start with the short ones Smiley).

Endolf

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #13 - Posted 2003-11-28 16:27:19 »

I think we should be consistent with the other core packages.  I don't know if that means I'm voting for long or short properties Smiley

The package name should really be net.java.games.jinput - with a 'j' anyway to be consistent , shouldn't it?  Things that are named a certain way only for historical reasons should be changed before going to 1.0 if it makes sense.
But since CVS doesn't handle directory renames very well, perhaps that isn't such a good idea Smiley

Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #14 - Posted 2003-11-28 17:59:20 »

Quote
But since CVS doesn't handle directory renames very well, perhaps that isn't such a good idea Smiley


Meh.  Before 1.0 stabilises any code history is going to be mostly irrelevant anyway.

Rule of thumb: Anything that will appear in an FAQ a year from now containing the word "historical" should be culled at the earliest possible moment! Grin

Hellomynameis Charlie Dobbie.
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.

Riven (5 views)
2014-07-23 21:16:32

Riven (6 views)
2014-07-23 21:07:15

Riven (6 views)
2014-07-23 20:56:16

ctomni231 (40 views)
2014-07-18 06:55:21

Zero Volt (36 views)
2014-07-17 23:47:54

danieldean (30 views)
2014-07-17 23:41:23

MustardPeter (32 views)
2014-07-16 23:30:00

Cero (47 views)
2014-07-16 00:42:17

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!