I've been working full time on a pretty big project for myself, but I've lost interest lately. Street Fighter doesn't help. Neither does Tribes Ascend, which is a new Tribes game. It is pretty sweet, but has lots of balance and other issues
. I decided to try my hand at making a FPS similar to Tribes. This will keep me busy enough that I can ignore feeling bad about neglecting my much more important project.
For those unfamiliar, Tribes is a FPS with jetpacks. You can hold jump to "ski", which is where you slide frictionless over terrain. The main weapon is a medium speed projectile that inherits some of your speed. This makes it different that most FPS, as it becomes about maneuvering and taking carefully aimed shots, and less about twitch. Tribes Ascend adds a bunch of "hitscan" instant hit type weapons, like those in most FPS, and these ruin the game IMO because Tribes is wide open so you can ski and fly around.
I started with Ardor3D, because it has nice clipmap terrain. It has some interesting APIs. Some of it seems pretty clean, other parts don't, such as using the Google collections predicate rubbish for input event handling. I tried rolling the physics myself and got the basics working, but I kept occasionally having a problem where my ray cast wouldn't hit the terrain and I'd fall through. This reaaaally pissed me off, and I couldn't figure it out. I verified the terrain was morphing, at least during the first couple frames. A ray cast straight down from a static position would read different values after a few frames! I'm not quite sure this was also happening later as that is hard to verify. I posted on the Ardor3D forums but my post was moderated. It's been 2 days and still hasn't gone through. I give up on Ardor3D!
So, I moved to jMonkeyEngine. The terrain stuff isn't as nice, but the examples are cleaner. It seems to have lots of... framework. It does lots for you, which is good, but it has a number of pretty thick layers, I'm sure at some point you are at their mercy. This is a lot different from the libgdx I'm used to, but then I don't have time to write a whole terrain system.
jME has support for Bullet, so I decided to use that. I was up and running pretty quickly.
Once I had my guy flying around like I wanted, I used KryoNet to slap on some networking. The server is ~100 lines of code and is a passthru for events. It trusts the clients 100%. The networked client is ~150 lines. The events are: add player, remove player, update player, shoot, respawn, and damage. The client sends update player 30 times/sec and the server sends update player to all clients 30 times/sec. If a client registers a hit, it tells the server, who broadcasts to the others. This is all kind of ghetto, but it works and it was quick. Start to finish, including the Ardor3D mishap, it took me probably ~20 hours of coding over 2.5 days.
I know that no one wants to download a JAR, but it's late and I'm tired.
Get it here:http://n4te.com/temp/duel.jar
Sorry it is 11.9M, but jME, LWJGL, Bullet, etc adds up, especially the natives. To run it double click or:
java -jar duel.jar
I have a server is running, so just click ok. Or you can run your own server and connect to localhost:
java -cp duel.jar duel.DuelServer
Controls are WSAD, space is jump/ski, left click shoots, right click jets. Escape exits, K suicides.
To make up for the JAR, you get a screenshot!