This is harder than it looks!!

Started by darkprophet, November 17, 2003, 21:37:24

Previous topic - Next topic

darkprophet

hi everyone,
I have just got fed up with Java2D and its "slowness" so to speak, so Ive decided to join you lovely bunch of people.

I basically have absolutely no idea on where to start!! so if anyone, please, give me some direction, i would be more than abliged. Thanks

PlanetMongo

I'm a newbie and here's what I'm basically doing:
prep:  Teaching myself java.  :)  I'm actually going through Head First Java and find it pretty decent.  Beginning Java2 from Ivor Horton is also good, and Thinking in Java by Bruce Eckel is supposedly really good, but I find as he revises his text more and more, it gets to be a bit more unmanageable.  For instance, in his sample code, while I understand why he does it, you'll have 2 or 3 pages of asserts, which to me obscures the actual concepts that you're trying to learn.  I suppose he does it to try and get you used to unit testing and what not, but I find it bothersome to read through.

1)  Download lwjgl and make sure you can run the demos.
2)  Download the Nehe tutorials from the same site, then head on over to nehe.gamedev.net for the "read through" (I've actually considered interposing the actual tutorial text, changed for lwjgl/java, though, in the comments of the code.. that way the tuturial resides in the source and is easier than trying to read code, flip to nehe if explanation is necessary.. Basically, really in-depth commenting.. :) )
3)  Once you get the hang of the ported NeHe stuff, try porting tutorials 11-newest yourself.   Also, try and find the OpenGL red book online and see if you can port that stuff, too.
4)  Once you get some graphics work down, or when you need to take a small break, I switch gears a bit and try to read through some game programming tutorials, like at gametutorials.com.  Learning flow-structure, data structures and the like.   Or, since I'm a one man "team", I do something else, like goof off with blender + the gimp (need textures and images for sprites), wings3d/milkshape3d (for making models), various audio tools (NI Carbon/Absynth/FM7, still have yet to find a sequencer/audio editor) for making sound effects and music.  I just can't get myself to strictly program for more than a few hours at a time and have to find something else to do for awhile.   BTW, I have Black Art of Java Game Programming, and while its QUITE dated (1996!), it still has a lot of useful concepts.  It covers things like double-buffering, animation, image loading, etc etc.  Again, a lot of the actual implementation of the stuff is no longer any good, but it's the concepts that really matter.  Not to mention that they, along with everyone else in the world, seem to think that Java Games == APPLETS.  I don't want a goddamn applet, I want Full Screen console goodness!  Unless, of course, I'm playing something like mahjonng.

Then try making your own game, I suppose, I haven't gotten that far, yet.  :P  I think cas recommends trying to implement a breakout game, and then something like pac-man.  I'm actually going for something like arkanoid in my first game (a breakout clone), but have quite a few other ideas floating around in my tiny brain that I'd like to explore.  Unfortunately, between my job, 2 bands, 5 cats, and girls, well, it gets tough sometimes to find time to sit down and work on the stuff.

And finally, after you iron out all the bugs and get the game play and graphics spot on, and you've made sure you're not violating anyone's IP or copyrighted material, you should send it to cas so he can put it up on the site.  :)
ife sucks, kill yourself.

princec

I advise you download Basic4GL and play with OpenGL before getting stuck in with the Java. Java's not an easy way to learn OpenGL. When you've got the GL basics sorted, so to speak, turn your code into Java.

Cas :)

Uli

But if you're already used to programming with java it should be no problem to learn lwjgl. I had no idea about OpenGL until a few weeks ago. Normally I'm developing boring web applications for an insurance company. I learned OPenGL from a book (OpenGL Super Bible) which I bought some time ago and never had a look at afterwards until now. It was no problem converting the C examples to java. And I think OpenGL is not so hard to learn.

darkprophet

thx dudes, but I am an experience java programmer who has made several java games, just never in openGL before, I have always relied on using Java2D, but it hogs so much resources!!

i wanted to see how OpenGL compares, and the nehe tutorials for version 8.0 dont work because determineAvailableExtensions() method isn't available, and so is the VSync thing.

ive deleted teh determineExtensions bit and added the Window.setVSyncEnable(true) bit on, the thing compiles fine, but it wont run!
I get a classDefinition not found error!!

thx for the help

cfmdobbie

Class definition not found? :?  I've not seen that personally - any info provided about what couldn't be found?  Make sure you're both compiling and running against the same version of the lwjgl.jar.

To compile an LWJGL application you need the lwjgl.jar in your classpath.  To run an LWJGL application, you need the lwjgl.jar in your classpath and the native libraries (*.dll/so/jnilib) on your Java library path - for example, if the libraries are in a "lib" subdirectory, add the following flag to the execution line: "-Djava.library.path=lib".
ellomynameis Charlie Dobbie.

CaptainJester

Quote from: "darkprophet"i wanted to see how OpenGL compares, and the nehe tutorials for version 8.0 dont work because determineAvailableExtensions() method isn't available, and so is the VSync thing.

ive deleted teh determineExtensions bit and added the Window.setVSyncEnable(true) bit on, the thing compiles fine, but it wont run!
I get a classDefinition not found error!!

thx for the help

I have done NeHe tutorials up to #12 so far and had no problems.  What is the exact error you are getting?  Which tutorial are you working on?

8)
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

darkprophet

im using LWJGL 0.8, but the nehe tutorials haven't changed between 0.7 and 0.8!!

the chman site, ive done the first part (replaced the vsync, and the determineAvailableExtentions() and replaced em accordingly), it compiles fine, but when I run it, i get this:

class not found: org/lwjgl/Display

and it points me to the line:

private DisplayMode mode;

!!

any help is greately appreciated

CaptainJester

First, to get it working.  Remove the DisplayMode class.  You only need it if you want to use a different mode than the desktop is set to.  Second, use window mode instead of full screen.  Window mode seems to cause less problems while you are trying to figure things out.

That could also be a classpath issue.  Even though Eclipse can find the libraries for compiling just by specifying in the project properties, you still might have to set the classpath variable to find the libraries for executing.

Which tutorial are you working on?  Are you porting directly from the C++, or are you using the samples from sourceforge?

8)
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

darkprophet

i am using netbeans 3.5.1! and this tutorial that I am following is from Chman's site (found it from the links section in "http://www.lwjgl.org")

it compiles fine though, therefore it isn't a classpath problem, I do use the

-Djava.library.path="path_to_lwjgl.dll", but still, i get the same error?

should I start using eclipse?

CaptainJester

Try setting your windows path variable to point to the directory with the .dll instead.

It can still be a classpath problem.  If you include your libraries in the build path for netbeans, it will compile fine.  But it may not also include them automatically for running.  That is where classpath becomes more important.  Make sure your classpath is pointing to the lwjgl.jar file and try again.

Which tutorial number are you doing(1-5)?
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

darkprophet

thx dudes, ive done it,

just one more question? how do run the nehe tutorials on LWJGL0.8??????????????????????????????????

CaptainJester

Have you tried to setup v0.8 yet?  I have had no problems.  I make sure my classpath is set as well, I set my Windows path variable to point to the directory that lwjgl is installed to.  By setting the Windows path, you don't have to copy .dll files, they will be found in the path.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

darkprophet

thx dudes everywhere, thanks to you beautiful bunch of people, lwjgl is working at last, except for some Nehe tutorials:

1-5 work fine, 6 and above doesn't because i get an error in loading the texture this is it:

java.lang.IllegalArgumentException: Width (-1) and height (-1) must be > 0
       at java.awt.image.SampleModel.<init>(SampleModel.java:108)
       at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:128)
       at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:69)
       at java.awt.image.Raster.createInterleavedRaster(Raster.java:625)
       at java.awt.image.Raster.createInterleavedRaster(Raster.java:265)
       at java.awt.image.BufferedImage.<init>(BufferedImage.java:303)
       at src.Nehe06.Nehe06.loadTexture(Nehe06.java:234)
       at src.Nehe06.Nehe06.init(Nehe06.java:83)
       at src.Nehe06.Nehe06.main(Nehe06.java:62)

thats it, thats the error I get from executing anything (and including) NeHe6!!

i imagine that the texture isnt being loaded?

CaptainJester

You are correct.  The texture isn't loading.  Watch your paths on:

texture = loadTexture("data/nehe.png");

This only works if the data directory is in the same directory as the NeHexx.class file.  To start, you can code an absolute path to the texture, until you get it going properly, then figure out the directory structure.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)