Multi-Platform game Development

Started by kn0t, March 10, 2005, 02:44:53

Previous topic - Next topic

kn0t

Hello,

we are a group of students, working on a Java game, similar to Worms or Scorched Earth.  We are using the lwjgl library, but since one of the aims of the project is to be platform-independent (or almost), we wanted it to run in Windows, Linux and MacOS X.  

Since the library "version" is different for each of these platforms (a different file must be downloaded), we need to provide a win-lwjgl,  linux-lwjgl, and mac-lwjgl directories along with other project libraries.  

Just by changing the -Djava.library.path  directive to the directory with the correct distribution for the current OS, makes everything work.  

What I'd like to know is any ideas on how to "automate" this as fully as possible.   What's better?  An "installation" script, that renames (or makes symbolic links one of those three directories to "lib" (for example) and -Djava.library.path=lib, or should it be better to have a "launcher", that checks the OS, and writes to a file the correct name of the directory to give to the JVM?  

I'd like to be able to do it "on every run", since now that we are still at early developing stage, at the University, it would be preferable NOT to have to "install" the game every time we're working on it on a different machine, but, on the other hand, I don't know if it's possible to run the JVM to "know" the OS, and then re-run it with different parameters...

Sorry for the length of this post, and Thanks in advance!!

talbobo

Quote from: "kn0t"Hello,

we are a group of students, working on a Java game, similar to Worms or Scorched Earth.  We are using the lwjgl library, but since one of the aims of the project is to be platform-independent (or almost), we wanted it to run in Windows, Linux and MacOS X.  

Since the library "version" is different for each of these platforms (a different file must be downloaded), we need to provide a win-lwjgl,  linux-lwjgl, and mac-lwjgl directories along with other project libraries.  

Just by changing the -Djava.library.path  directive to the directory with the correct distribution for the current OS, makes everything work.  

What I'd like to know is any ideas on how to "automate" this as fully as possible.   What's better?  An "installation" script, that renames (or makes symbolic links one of those three directories to "lib" (for example) and -Djava.library.path=lib, or should it be better to have a "launcher", that checks the OS, and writes to a file the correct name of the directory to give to the JVM?  

I'd like to be able to do it "on every run", since now that we are still at early developing stage, at the University, it would be preferable NOT to have to "install" the game every time we're working on it on a different machine, but, on the other hand, I don't know if it's possible to run the JVM to "know" the OS, and then re-run it with different parameters...

Sorry for the length of this post, and Thanks in advance!!

i was under the impression the only difference between the downloads was the native libraries.. theoretically lwjgl.jar should be the same across all the downloads, meaning you should be able to just put the lwjgl jar in a directory with all the native libraries and it should work regardless of the platform (i think)

Matzon

you could just chug all the libs into <game>\libs and then lwjgl will pick the correct in up (they all have different file endings).

The only thing that differ per platfom are the native dll's (lwjgl.<dll/so/jnilib>) you also need to provide the openal dll's. Do avoid fmod & devil, since they're not cross platform atm.

Orangy Tang

If you used Webstart then it takes care of downloading and using the correct native libs for the platform, meaning all you need is a single click to run the app, nice and simple.

Webstart deployment scored me a few extra marks when I was doing a uni project I think - especially as it makes it dead easy for lecturers to run your program as well on their own if they need to. :D

elias4444

I have the same goals, and have been using webstart for Mac and Linux platforms, and JSmooth (check out sourceforge) to compile the Windows version down to an executable. Thus far, it's worked quite well.

If I end up every distributing my games via CD, I'll end up making shell scripts for Mac and Linux (although that can be a bit quirky). Princec has a good thing going with his games (SuperDudester and Alienflux) - he does the executable thing for windows and now has something similar implemented for Macs it looks like.

The other option is to create the JNLP file to run the game from a local URL (i.e., file://). But certain things with java webstart don't function properly when you do that (like icons and splash screens).
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

kn0t

Thanks a lot!!!!

I didn't know the .jar was the same, and only changed .dll, .so and .jnlib.  It's done, and I think everything works perfectly.  Thanks a lot again!!

jam007

I have been using NetBeans to make a game and now realises that I do not know how to run the game with out it  :roll:
I have put all the lwjgl things in ext directory and the dll files under lib. All in the jre directory. This I did when I first started programming. (Something someone on this forum resently used some interesting words to tell us to avoid, something with peeing...) :oops:

OK now I have a jar-file with my game and want to make it run from the command promt. Preferably easy  to distribute also as a zip or something.
The problem is where do i place the lwjgl-stuff and to write as java options to make it work as smoothly as possible.

(IÃ,´m at the moment not interested in webstart as we still develops the game.)

Anders

Matzon

assuming you project is at <project>
then chug all the library files (including native) in <project>/lib
then go to <project> dir and launch with:
java -cp lib/lwjgl.jar;lib/lwjgl_util.jar;(add rest of jar's needed) -Djava.library.path=lib my.class.to.run.Main

jam007

Thanks!

Many thanks for your speedy and clear responce.

Anders

jam007

I found that I have to place ILU.dll and ILUT.dll in the same directory as my class files. Not in the lib path to make it run. Is this a bug in the devil ilu and ulit classes since everything else runs placed in an subdirectory called lib? (I downloaded the windows version of 0.95 4 days ago)

Anders

Matzon

yes, this is a known ...annoyance