Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (427)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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  
  LWJGL Packing-up and Shipping-out  (Read 2135 times)
0 Members and 1 Guest are viewing this topic.
Offline elias4444

Junior Member





« Posted 2004-10-15 01:19:10 »

OK, after my little OpenAL break-through I had today, I'm totally sold on using LWJGL for my game development. Heck, I may even try OpenGL one of these days; but for now, OpenAL and Java2D will have to do until I get smarter.  :-/

Anyway, I've about got a working rough-draft of my very first game completed (SO exciting)! But now that I'm using LWJGL, I have some complicated issues/questions.

1) How do I pack it all up into a jar that someone can just download, double-click, and launch? Do I HAVE to use jnlp (I can't stand the whole security certificate thing for applications)?

2) Is there a way to pack up LWJGL with my game so that it's still cross-platform compatible? (Do I have to include all versions of lwjgl in the jar or something?)

3) Is there a way to pack up the LWJGL .DLLs and .SOs along with the application so that the end-user doesn't have to worry about installing them seperately?

I'm very concerned with keeping it simple for the end-user, as well as cross-platform compatibility (particularly windows and linux, although Mac would be nice once the lwjgl is finished for it).

Any help would be appreciated.

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2004-10-15 05:29:31 »

A webstartable version is only needed if you want to launch over the internet.
If not, it gets rather easy depending on how you do it Smiley
a) jar your files, include the prejared lwjgl, include dlls/so/jnilib, add launcher script for each platform
b) jar classes, add a jar manifest (no expert here) - people should them be able to execute it by double clicking the jar, or typing java -jar <myapp.jar>

I would probably go for a
layout:
\
start.bat
start.sh
start.(mac launch type thingy)

\libs\
lwjgl*.jar
myapp.jar
lwjgl.dll
lwjglaudio.dll

and so forth...


Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #2 - Posted 2004-10-15 07:46:35 »

For a Windows distributable I would go with the following setup:

1. For users that don't know anything about Java and don't want to install a JRE, bundle a stripped down version of the JRE with the game (optional libraries can be removed from the JRE package, to reduce its size). This adds about 15MB to the download size.

2. For users with an existing JRE installation, offer a smaller download package, with no JRE bundled.

Use Bootstrap (http://www.g0dmode.com/javastuff/bootstrap-1.0.zip) or similar utility to smooth out the starting of the application/game. This adds a nice polishing touch to your product, compared to ugly batch scripts (with no icons, etc...).

Package the whole thing with a nice installer, like NSIS2 for Windows (http://nsis.sourceforge.net/).

Cheers

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Middy

Junior Member




Java games rock!


« Reply #3 - Posted 2004-10-15 07:57:12 »

/me awaits 3*blah to come and bash nnevatie with a big webstart

When do I get my makeMyGameAsILike() extension?
Offline nnevatie

Junior Member




It is slightly better to be simple than correct.


« Reply #4 - Posted 2004-10-15 08:03:45 »

Quote
/me awaits 3*blah to come and bash nnevatie with a big webstart


/me joins Middy and waits for the great bashing to start - while preparing his arguments of why Webstart is not good for Everything(tm)

Awards:
- Nobel Prize in Physics for inventing his Doomsday Machine
- Nobel Peace Prize for not using it

http://www.g0dmode.com -- a collection of things not real
Offline elias4444

Junior Member





« Reply #5 - Posted 2004-10-15 15:51:04 »

Matzon,

How would you call the startup script from within the jar? And how do you tell your application which lwjgl set (dll or so)  to use?

Do you have to extract the appropriate lwjgl somewhere first?

Sorry, I'm a complete newbie  on this - I've been focused so much on just making a game, that I failed to think about packing it all up in the end (packing was easy until I started using LWJGL actually).


Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2


Make it work; make it better.


« Reply #6 - Posted 2004-10-15 18:05:39 »

If you are creating a distribution, then on your installation you can check for the property "os.name" to find out what is installed.

You also have the option of using IzPack(http://www.izforge.com/izpack/) to create your distribution.  It is a full featured installer written in Java.  This way everything is in one package.

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #7 - Posted 2004-10-16 01:20:47 »

Quote
A webstartable version is only needed if you want to launch over the internet.


<innocent>Why not just use Java 5 and use the install-from-CD-webstart? Ease-of-install of webstart, coupled with CD distribution</innocent>

malloc will be first against the wall when the revolution comes...
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2004-10-16 01:26:50 »

Quote
I'm totally sold on using LWJGL for my game development.


Java? yep. LWJGL? yep. So now we just need to sell you on webstart too... <ducks and runs for cover>

Quote

1) How do I pack it all up into a jar that someone can just download, double-click, and launch? Do I HAVE to use jnlp (I can't stand the whole security certificate thing for applications)?


Learn JNLP. Make JNLP your friend. Achieve nirvana. Then get pissed off when you discover that one teensy little thing you want/need to do just doesn't work because of some incomprehensibly obvious oversight or bug in Sun's design/implementation.

No, seriously: webstart is worth learning, once, because in most situations its as close to perfect as you're going to get. It only takes  minutes to get the hang of it and from then on you can make your own educated decisions.

For your situation, it's easy:
 - you have your game code in JARs (as many as you like)
 - you put a line in webstart for each platform (linux, windows, etc) that tells it to use the official LWJGL webstart, and don't even have to worry about how it's all packaged up!

Oh, sorry - is there no official LWJGL JNLP extesnion? Roll Eyes. Well, in that case you need to make a JAR for each platform, with different names Wink, and put a line in the JNLP for each platform, telling webstart which JAR has that platforms specific stuff.

Could it BE any easier?

malloc will be first against the wall when the revolution comes...
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #9 - Posted 2004-10-16 09:17:41 »

Quote
How would you call the startup script from within the jar?
I wouldn't. I would let the bat fil (or shellscript) call the the java runtime, specifying commandline parameters.

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

Junior Member





« Reply #10 - Posted 2004-10-16 11:32:18 »

Ok, thank you guys for all the help. I think I will dive into jnlp, but for the meantime, I've got it all in a zip file, running with a .bat (on Windows) and .sh (on Linux).

I'm having one big issue however: On linux, it won't even launch. I keep bombing out with a SIGSEGV Hotspot VM error as soon as I try to start it. Anyone else see this before? I didn't have this issue until I started using LWJGL for the audio.


Oh, and for the JNLP stuff, is there a way to have it NOT check for a security certificate when launched locally? And will it work with LWJGL if the user is offline?


Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #11 - Posted 2004-10-16 12:10:47 »

>is there a way to have it NOT check for a security certificate
>when launched locally?

Not really, but you can use a selfcert.

>And will it work with LWJGL if the user is offline?

If offline mode is allowed, yes. However, using offline allowed during beta/test phase isn't recommended, because you would need to start the app twice (in a row) in order to get it updating.

弾幕 ☆ @mahonnaiseblog
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #12 - Posted 2004-10-16 12:23:55 »

Quote
Ok, thank you guys for all the help. I think I will dive into jnlp, but for the meantime, I've got it all in a zip file, running with a .bat (on Windows) and .sh (on Linux).



A quick warning: like many linux users (I have no idea what percentage, but when I mention it I get a lot of "me too" comments), I will deliberately not run a .sh file (...for a java app).

The landscape is changing now that people have to accept Sun's JVM's crappy initialization requires a runtime JVM parameter (e.g. -Djava.library.path=.), but at least 3 in every 5 java games I've ever tried to run with a sh file had broken shell scripts, and often did stupid things like trying to mess with my classpath settings - insult to injury! No. Refuse.

Shrug. Maybe people don't mind any more. Maybe authros are much better at shell scripts now. But personally if it's not webstart I simply can't be bothered (not evangelism, just laziness) to run it any more.

malloc will be first against the wall when the revolution comes...
Offline elias4444

Junior Member





« Reply #13 - Posted 2004-10-16 16:12:21 »

OK, please tell me there's a simpler way to sign jars now. Please, please, please?

Offline elias4444

Junior Member





« Reply #14 - Posted 2004-10-16 19:03:05 »

Ok, I'm impressed with the JNLP stuff. I just got the thing working on Windows and Linux without any hassles... EXCEPT for asking for that security certificate authorization. That could kill someone trying to release a pro app. How much does a "trusted" certificate cost these days? And how long does it last?

Offline DrBizzar0

Junior Member




Raj raj!


« Reply #15 - Posted 2004-10-16 22:21:55 »

Still too expensive for hobby use at least, we are talking 100eds of $ a year.

You can get one for free from Thawte, it's not as good as a certificate you pay for, but it's free Smiley

The certificate will be shown as being distributed by Thawte Freemail Member and if you live in the USA it seems like you can get your own name shown by joining the Thawte Web of Trust.

Here's a good howto

http://www.dallaway.com/acad/webstart/

scroll down to the Certificates section.
Offline elias4444

Junior Member





« Reply #16 - Posted 2004-10-18 18:21:55 »

One more oddity that I've noticed with the JNLP stuff - my game doesn't perform as well as it does running straight from Eclipse.  Huh

Any ideas? I don't have any solid benchmarks or anything, but I've noticed that when I run it under eclipse, it's smooth, and there's no clipping of my sprites as they redraw. However, after packing it into a JNLP, I noticed skipped frames and clipping. Is there something I'm missing in my JNLP file?

<?xml version="1.0" encoding="utf-8"?>

<!-- JNLP File for BallBounce -->
<jnlp
 spec="1.0+"
 codebase="file:."
 href="ballbounce.jnlp">
 <information>
   <title>BallBounce 0.6 alpha</title>
   <vendor>TommyTwisters.com</vendor>
   <homepage href="http://www.tommytwisters.com/"/>
   <description>Catch the red balls!</description>
   <description kind="short">Catch the Balls</description>
   <offline-allowed/>
 </information>
 <security>
     <all-permissions/>
 </security>
 <resources>
   <j2se version="1.5+"/>
   <jar href="game.jar"/>
   <jar href="lwjgl.jar"/>
   <jar href="lwjgl_test.jar"/>
   <jar href="lwjgl_media.jar"/>
   <jar href="lwjgl_util.jar"/>
   <jar href="lwjgl_fmod3.jar"/>
 </resources>
 <resources os="Windows">
   <j2se version="1.5+"/>
   <nativelib href="lwjgl-windows.jar"/>
 </resources>
 <resources os="Linux" arch="i386">
   <j2se version="1.5+"/>
   <nativelib href="lwjgl-linux.jar"/>
 </resources>
 <resources os="MacOS">
   <j2se version="1.5+"/>
   <nativelib href="lwjgl-mac.jar"/>
 </resources>
 <property key="java.library.path" value="." />
 <application-desc main-class="game1.Game1"/>
</jnlp>

Offline elias4444

Junior Member





« Reply #17 - Posted 2004-10-18 20:18:06 »

Ok, Murphy's Law is at it again... as soon as I post my problem, a solution pops into my head.  Embarrassed

I was using a timer that was "limiting" my frame per second to 60. For some reason, it was obvious when run via jnlp, but not eclipse (perhaps Eclipse gives applications a higher thread priority when run?). I simply took out the hold, and use nothing but a thread.yield at the end of my animation loop.  I'm using Java2D with createbufferstrategy, and I have to wonder if it's handling all of the frame synchronization and stuff for me automatically (I seem to remember reading something about that somewhere).

I figure, since everything in my game is based on elapsed time with the nanotimer, that should be fine (so long as Java2D really is handling it all automatically).

Offline elias4444

Junior Member





« Reply #18 - Posted 2004-10-18 23:01:54 »

MURPHY STRIKES AGAIN!!!!

Now I have a different problem. I can launch my game with absolutely no problems via eclipse, or the command line java.exe. However, if I launch from a JNLP I'm all of a sudden getting "Unable to Launch" "Width (0) and height (0)  cannot be <= 0". I was cleaning up code, but I kept testing it and running it successfully from command line. Ugh. Anyone know what could be causing this?

It's always hardest to have the rug pulled out from under your feet when you're right at the top of the stairs.  Cry

Offline MickeyB

Senior Member




my game will work, my game will work!


« Reply #19 - Posted 2004-10-30 15:35:28 »

ok elias444, and others...

what was your jarring process?  I cant get my game to find any of the lwjgl stuff when running from a jar.  I though I had it working, but when I move the jars to a fresh directory...no go.

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
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.

xsi3rr4x (78 views)
2014-04-15 18:08:23

BurntPizza (69 views)
2014-04-15 03:46:01

UprightPath (81 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (82 views)
2014-04-14 15:48:38

tom_mai78101 (106 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (262 views)
2014-04-05 13:34:39

trollwarrior1 (212 views)
2014-04-04 12:06:45

CJLetsGame (221 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!