Slick Forums

Discuss the Slick 2D Library
It is currently Wed May 22, 2013 6:10 am

All times are UTC




Post new topic Reply to topic  [ 111 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next
Author Message
 Post subject:
PostPosted: Thu Jul 31, 2008 9:27 pm 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
Thanks.

I got Eclipse and I'm now developing in that. Its a bit confusing. I changed all the colors to match JCreator so it would be more readable for me.

I REALLY love the "quick fix" feature! This was EXTREMELY helpful in removing the reams and reams of unused variables and imports that had built up in my program.

I also like the as-you-go compilation, but I spent a very long time searching for a "compile" button only to find that it compiles automatically.

Testing on my friend's mac reveals that the Tab key has a different keycode on macs, so I will add an alternative in the code to open the map editor.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 9:56 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Eclipse rocks. :)

Here are some keys I use a lot...
Organize imports is ctrl+shift+O. Never will you type an import again. It fixes imports for the whole file. You can even run it on your whole project.
Quick fix can be had with ctrl+1.
Rename in place (respecting variable scope but not a full refactor) is ctrl+2, R.
Rename with full refactoring is alt+shift+R.
Format code ctrl+shift+F (set up the formatter in window->preferences). Can run on your whole project.
Open file by name ctrl+shift+R (you can use asterisks in the name!).
F11 run last run program.

I also set up some extra keys that I can't live without...
F12 terminates running program (so F12 then F11 kills and restarts your game).
I set shift+space to be "word completion" which is faster than regular completion (ctrl+space). Hit shift+space multiple times to cycle through the words.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 10:37 pm 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
well this is fairly stupid. I tried to compile a new .jar just to see if it would work with the current .jnlp, and I'm getting the same errors I always was, even with fixed source code. I had to rename some of the resources, and it still crashes unexpectedly, this time with no error message. I will compare the working Jar with the new one to see what the problem is.

EDIT: crap, data on my FTP server is corrupt. I have 5 copies of "RocketPod.jar" in the file system.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 10:43 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Before getting your game working with JNLP, get it working from the command line. Use this...

java "-Djava.library.path=c:\blahblah\" -cp RocketPod.jar;lwjgl.jar;slick.jar;sui.jar RocketPod

"c:\blahblah\" should contain the Slick native libs (not in any zip or JAR).

Once that works, your JNLP should work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:04 pm 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
I feel confident that I can fix this if I can just figure out how to make .jnlp generate a console. I know that the .jnlp loads, and it goes into the game, and crashes immediately on the start screen. What I need is a console that outputs the error messages in my code, so I can figure out exactly what it isn't loading.

EDIT: I thought I found the problem, was not including res. I have the same issue though. Crash with no errors and no console.

I can't for the life of my figure out how to use the command line.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:52 pm 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
Figured it out. Enabled the console through java control panel, found out that it was having trouble with "enemyshot.wav" and discovered that it was named "Enemyshot.wav" in the jar file. I don't get it. I wonder why it works in Eclipse and Jcreator when the name is different.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:54 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Don't try to debug JNLP until you get it running on the command line, JNLP is a pain. That said, in Windows go to Start->Settings->Control Panel->Java->Advanced->Java console->Show console. Then JNLP apps will show you the console.

But get it working on the command line. What can't you figure out? Put these files into the directory "c:\test\" (again assuming Windows):

RocketPod.jar
lwjgl.jar
slick.jar
sui.jar
lwjgl.dll
OpenAL32.dll
jinput-raw.dll
jinput-dx8.dll

Now go Start->Run and type cmd, enter. Type "cd c:\test" enter. Type this command and hit enter:

java "-Djava.library.path=c:\test" -cp RocketPod.jar;lwjgl.jar;slick.jar;sui.jar RocketPod

That says to run java, load native libraries from c:\test, place those 4 JARs on the classpath, and to run the main class RocketPod which will be loaded out of the first JAR on the classpath (RocketPod.jar in this case). This command should run your game. If not, post the error.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 11:56 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Ahh see we posted at the same time.

It works in Eclipse because there the files are not in a JAR, they are on the filesystem. The Windows filesystem is not case sensitive. When loaded from a JAR (whether from JNLP or the command line), case matters.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 01, 2008 12:58 am 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
Ah, okay they have to be in the same directory for the command line. I get it. Didn't know windows file system was not case-sensitive either.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 2:50 am 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
Small update:

*Pirate and player thrusters use more conservative effect to improve frame-rates

*map-editor can now be opened with F1

*When pirates die they are supposed to remove their emitters. Not sure if this works yet though, it will require some debugging.

JNLP is updated:
www.kittsplace.com/klingenco/rockets/rocketpod.jnlp

Anyone know how to get eclipse to include all your resources in a jar?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 9:02 am 
Offline
Regular

Joined: Sat Jun 07, 2008 6:54 pm
Posts: 119
Thatotherguy wrote:
Anyone know how to get eclipse to include all your resources in a jar?


Man I wish I'd had some kind of newbie guide going from:
Installed Eclipse
...to..
Being able to run an ant script which makes a jar just the way you want it.
ALSO, it should explain the catalog structure and where to put res files and stuff like that.
I think I've found a working way but it's all very diffuse and I've been off the programming for a while so I can't remember squat.

What I do know is that Eclipse can find resources in several places when you're compiling. I had situations when I deleted all my resources but it would still compile and run without problem, which caused great confusion. That confusion still exists I'm afraid.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 03, 2008 12:41 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
To make a JAR in Eclipse, right click your project and Export->JAR file. Check the files you want in the JAR, click finish. It builds the JAR. No ant script required.

Thatotherguy wrote:
Anyone know how to get eclipse to include all your resources in a jar?


Anything in a source folder can be included in the JAR. Typically I mount a folder called "src" which contains my Java source files. Then I mount another folder called "resoures" containing images, XML files, etc. I also mount this in Eclipse, which puts these files on the classpath. When I say "mount a source folder" I mean right click a project, properties, Java Build Path, Source tab. Folders here will be processed and copied to the "output folder" which I usually name "bin" on this same dialog.

Look in the bin folder where Eclipse outputs. Here you will see the compiled class files, and other files like those from the resources directory. The bin directory is typically the same as what will be in your JAR. In fact, in the JAR export dialog in Eclipse there is an option "Export all output folders for checked projects". When you check this, then it doesn't matter what resources in the export dialog you check, just check the project and the JAR will contain everything the bin folder contains.

One thing with Eclipse, if you modify files outside of Eclipse (like an XML file), then Eclipse may not see the changes to the file. This is because Eclipse does special processing for files, eg it compiles source files into the bin directory, copies non-source files to the bin directory, etc. To fix this, refresh the project in Eclipse (right click->Refresh, or F5).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 03, 2008 12:54 am 
Offline
Oldbie

Joined: Tue Jun 17, 2008 5:11 pm
Posts: 336
It's probably worth noting that you should have your resource folder be a source folder. To do this you need to right click on the directory and select "Build Path", "Use as Source Folder". After this you're going to need to refresh the workspace any time you update files in the resource's directory. Anyway, if you do this, and if you reference your resources through the Slick ResourceLoader, then you should be able to export the project as a jar as stated before and then the resources will be included.

HTH


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 03, 2008 4:09 am 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
I had some really weird issues with some of my files reverting back to very old versions (the particle systems, for instance.) I had to just remake some of my particle systems.

Changes in this version:
1. New particle systems out of necessity.

2. brand new type of ally called a "Trader" This took me twelve hours to code, and in spite of its stupid AI and extremely limited actions, I am very proud of it. Traders are great big ally entities that follow a simple path of AI Nodes in a loop. Eventually, there will be missions where you protect traders, or attack enemy traders to get gold.

Traders have a giant deflector dish on them that allows them to move asteroids out of the way with a neat effect (this was easier than making them fly around asteroids.) Currently the trader is not placeable in the map editor, but there is one hardcoded into the default map to play with that goes back and forth across the map between two AINodes. The reason it took me so long to code is because it uses a totally different movement system from all other entities in the game. For simplification, I gave all entities four thrusters, one that points down, one up, one left and one right. This made it very easy to have them move around on a 2D map without using any complex trig functions.

Traders, on the other hand, have one big thruster on one side. They turn to move. This was way harder to code, because I had to figure out the origin of the thruster, the direction of the force, and the direction the ship should turn before moving. I also had to give the AI an inate sense of "coasting". Unlike pirates, which accelerate to keep up with the player, the Trader fires its engines until it reaches a specific speed, and then stops firing them. In order to allow the trader to turn around, I had to have it ask two questions, "How fast am I going?" and "Am I moving towards my target?"

If it is going really fast, but it is not moving towards its target, the trader will slow down (unrealistic, I know) , and then once it gets below a certain speed, it will turn on its thrusters. If its going really fast and moving towards its target, the trader will turn off its thrusters and coast to the target. Without this mechanism, the trader would accelerate, overshoot its target, and end up flying off the end of the map.

3. Fixed clipping issues with the mini-map.

www.kittsplace.com/klingenco/rockets/rocketpod.jnlp


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 5:42 am 
Offline
Regular

Joined: Sat May 31, 2008 12:26 am
Posts: 207
Some updates, haven't rendered to .jar yet, but will soon

1. Pirates now target and kill traders.

2. Traders die and create huge amounts of gold when doing so.

3. Player bullets and missiles are now drawn on the mini map

4. Missiles now have PERFECT accuracy. I studied the flocking algorithms of boids in this paper: http://www.red3d.com/cwr/steer/gdc99/ , and they were extremely useful. I will be utilizing more of them to control the behavior of some new enemy types called "interceptors", and giving enemies the ability to avoid obstacles.

Also, since missiles now have perfect accuracy, I will have to devise a method of counter-acting them. I will do this first by allowing a player to drop a set number of jamming beacons to confuse the missiles and have them lock onto a point other than the player, and secondly by devising an automatic "point defense" system which will shoot down missiles or push them away.

Most useful was the concept of having a "desired" velocity, and then applying forces to attain that velocity. I plan to have all of my AI-controlled entities exhibit this kind of behavior in the future.


////

* Camera is now an attenuated follower, rather than a spring. No more screen shake!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 111 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group