Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / OpenGL Development / LWJGL native compilation with GCJ success on: 2006-02-08 20:58:26
I managed to natively compile a game that uses LWJGL via GCJ for linux.

The steps for a full native compilation are:

1) Compile lwjgl & jinput into object files using gcj

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
Neotokyo:/tmp/lwjgl# l
total 528
-rw-r--r-- 1 root root  26493 Feb  8 22:31 Shmup.java
-rw-r--r-- 1 root root 104782 Dec 18 22:05 jinput.jar
-rw-r--r-- 1 root root 396822 Dec 18 22:05 lwjgl.jar

Neotokyo:/tmp/lwjgl# gcj -c -fjni jinput.jar
Neotokyo:/tmp/lwjgl# gcj -c -fjni lwjgl.jar -Ijinput.jar

Neotokyo:/tmp/lwjgl# l *.o
-rw-r--r-- 1 root root  730396 Feb  8 22:32 jinput.o
-rw-r--r-- 1 root root 3996880 Feb  8 22:34 lwjgl.o


jinput is needed because lwjgl references some jinput classes by name. If jinput is not included,
AOT compilation will break with undefined references even if jinput is unused by the project.

2) Compile and link the application

1  
2  
3  
4  
Neotokyo:/tmp/lwjgl# gcj --main=Shmup Shmup.java jinput.o lwjgl.o -Ijinput.jar -Ilwjgl.jar
Neotokyo:/tmp/lwjgl# l a.out ; strip a.out; l a.out
-rwxr-xr-x 1 root root 4033104 Feb  8 22:36 a.out
-rwxr-xr-x 1 root root 2336820 Feb  8 22:37 a.out <-- final executable, contains lwjgl & jinput, size can be reduced to ~500kb with upx


3) Create deployment archive
Assuming that the target users do not have libgcj (libjava) installed, we must create a fully self-contained deployment archive
that will execute with no problems. The users do not have to download and install anything.

In order to do that we have to ship the following libraries with the application. First libraries that are part of libgcj:
lib-gnu-java-awt-peer-gtk.so
libgcj.so.6
libgcjawt.so
libjawt.so
pr13212.so

Then, extra native libraries used by our program, in this case the lwjgl native ones:
liblwjgl.so

These files can be grouped in a separate directory lib within our package. Use of the LD_LIBRARY_PATH linux env variable
will ensure that they get loaded properly.

The final size of our self-contained 100% native lwjgl application package: 6 mb
Most of this comes from the size of libgcj which is 16mb by itself. This solution only works on linux for now because the awt implementation
of gcj (and classpath) currently only supports gtk/x11 peers. Windows, Cairo, QT peers are in their todo list.Once mingw
is updated to reflect the latest versions of classpath and gcj, cross-compilation of completely native windows lwjgl applications
will be a reality.

The promising part of this article is that libgcj follows the GPL license with an exception that allows linking
with proprietary code without tainting this code. This means that someone could hack libgcj to pieces, create a mini
library containing only needed functionality and further reduce the filesize of his deployment package. The license would only
require that these changes to (only) libgcj be made public.

Versions used:
GCJ version 4.0.3 20060121 (prerelease)
LWJGL 0.99
2  Game Development / Artificial Intelligence / Re: Back propagation algorithm on: 2005-12-20 16:58:44
When it comes to neural networks, there are no definite answers. Empirical studies
and techniques are frequently used. Replying to your question about momentum and
learning rate, the situation is as described in previous answers. I would suggest
you start with low values for both (in a typical feedforward MLP, 0.3 for learning rate
and 0.2 for momentum are 'nice' values to start with). Monitor your network and estimate
its performance over a separate testing set (kept hidden from training) in order to
see what values will work best for your case (tune accordingly).

Moreover there are a couple of other things you can do to combat the local minima problem:

Try using the stochastic approximation to gradient descent which traverses multiple
error surfaces (distinct for each training example) and uses the average in order to converge.

Train multiple neural networks using different parameters (rate, momentum, initial weights) over the same
training set. Evaluate and choose the best performing one.

Use a separate validation set in order to stop training in time and avoid overfitting.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (24 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (69 views)
2014-11-07 19:57:14
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!