Tuesday, February 12, 2008

TankAPE 1.1 Working!

Heck yeah! Multiplayer APE physics worlds unified via the JAGS 1.4m server.

Check out the TankAPE demo (link is on front page of fireleg.com).

I learned a whole lot about IExternalizable, and then I learned I didn't need to know squat about it. I rewrote the whole APE physics engine so you could serialize any particle across the net.

What I didn't realize was that the particles would be very large to send and they would cause weird problems upon receiving them (like APE would duplicate them upon creation because they do stuff with the engine).

Anyway, I then dropped back to plan B, and that worked way better. Plan B was to send just the x,y and velocity data per update, and only send updates when keystrokes happened.

This reduced the data size from 3000 bytes to about 100 bytes. And to think I was going to send 3000 bytes per tank 24 times per second! Ha! Now I send 100 byte packets when someone changes direction or every 2 seconds per tank just to keep everything synced up.

Have fun with it.

Monday, February 4, 2008

FAQ Running Java Server 1.4 and 1.4m

Here's an example email that I have been getting, so I just wanted to share a higher level recap of how you can run the client/server code.

On Sun, 3 Feb 2008 16:15:54 -0430, xxx xxxxxx wrote
> Hello,
>
> I have downloaded your client/server game at fireleg.com
> I know how to import the Flex project and run it. But I have no idea how to even start with the Java project. I am a newbie at Java. I have downloade NetBeans and I plan to start doing some serious work on it, specially because I need to create games like the want you have made freely available (superb thanks by the way).
>
> So how do I setup the Java project? Also if you can spare the time, what are all of those folders inside the server package? like
>
  • /build
  • /dist
  • /nbproject
  • /src
  • /test
  • /ultraedit32
and the build.xml and manifest.mf?
>
> Please can you explain all of these to me? How to setup the project in Java? and what are those listed items folders for?
>
> Thanks and appreciated.

Jorge,

Thanks for the compliments - that always fuels my release schedule!

I just finished writing a blog on installing the Java portion (the JAGS1.4m server), as several people have been asking.
See http://flexjavagames.blogspot.com/2008/02/jags-14m-source-available.html

Also, I've got the 1.4m server running on fireleg.com:82 (that's port 82 instead of port 81).

So, you can either
1) point to my running server for your tests.
2) double click the jar file mentioned in the blog (for a local test environment)
3) compile and install the server on your own local or public machine
4) point your actionscript to fireleg, and email me some java backend code.

I offer option #1 as the most convenient way for people to make their games live to the world, no charge.
Option #2 is the best for a quick test, especially for games that do almost everything on client-to-client.
Option #3 is great if you are going to do anything server-side.

Option #4 is already a reality, which is to compile a java class that implements IGame and I'll put it up on the fireleg server for you. This option will soon be available without my help, when I open up the right FTP server for everyone.

As far as your question about those wacky looking files, those are generated and maintained by Netbeans and will get written over each time you compile.

/src is what to look inside of to understand JAGS.
/build is where you'll see the complied classes - pretty much can ignore unless you need to copy them.
/dist is where you'll find the runnable jar file (you can double click it and start a local JAGS server)
Note: if you have taken the time to get the server compiling, you'll find starting/stopping from
Netbeans much better, as you will see the log output, can set breakpoints, etc.

Also, that code you have is JAGS 1.4, which is correct if you are going over the pong 1.4 demo.
I'll be getting some 1.4m actionscript client examples out soon as well - that java server is written a little cleaner, but still has many common features with JAGS 1.4.

-Travis

Friday, February 1, 2008

JAGS 1.4m Source Available

Easy binary way
If you just want to start testing my latest game server, the easiest way is to run a local copy. Download the executable jar and double click it.

(In Windows) all you will see is a javaw process running like so:


Ways to see the source


If you are just curious
Poke around the 1.4m server or the client code.

Easiest compilable source
These are the major releases, and will allow you to set breakpoints and follow along. If you are new to Java, pick this route before diving deeper.

Just download my zip files of the ready made projects at fireleg.com

Getting the latest source
If you are familiar with Java and want to keep up with the latest builds, I will show you how to download the source from the google repository into a working project.

Trust me, this setup isn't one of those configuration nightmares, it's just a couple of steps that I document very thoroughly so you can see exactly what I did. Expert users can breeze through this in minutes.

Install Subversion (SVN)
First, let's go get Subversion (aka svn). Download from this link on this page http://downloads.open.collab.net/collabnet-subversion.html



Just double click the download -- the installer does a really nice job of adding 'svn' to your command line.



Now you have two main options for getting the source. The first is to use an IDE like Netbeans 6.0 (or any other IDE) and pull a copy of the project visually. The other way is to just use 'svn' on the command line. I'll go over the svn command line way first, then get into the visual way.

Either way, the google repository page is here http://code.google.com/p/fireleg/source/checkout.

Mainly this page lets you know that the svn command to pull the whole trunk is:
svn checkout http://fireleg.googlecode.com/svn/trunk/

So, to use the command line svn do this:
Start -> Run -> cmd



Type a DOS prompt command ('cmd') like so:


Test that svn works by typing "svn --version" (without the quotes) like this:


From that command prompt, navigate using 'cd' (change directory) command to the main folder that will store the source code.

Then just type:
svn checkout http://fireleg.googlecode.com/svn/trunk/jags_server1.4m/ and it will download all the source code.

Netbeans 6.0 IDE

Once you have installed subversion, you can follow along this path to visually pull the project. You may want to restart Netbeans since you just installed subversion.

In Netbeans, go to the Versioning -> Subversion -> Checkout menu.


The first time you try this, Netbeans will ask where subversion is installed. Just browse to the folder you put subversion in. Mine looks like this (I shortened the install name and picked my own folder):


Now fill out what svn repository you want to pull from:


Leave the user / password blank so you can pull anonymously. This just means you won't be able to check code back in, but you can always mail me your code suggestions or ask to get write access from me (email travis_somerville2000 ~at~ yahoo.com).

Next, tell it what folders you want to check out. Browse and select just the jags_server1.4m folder like so:


Your screen should look like this (or something similar):


Now you should see a fully working project called "jags_server1.4m". I recommend making it your main project before hitting run, just so you know it's running the right project.

To make it the main project, right click the project like this:


We're so close! Just run the thing and your server is ready for Actionscript 3.0 games!

Hit the run button.

When you see the statement "listening on port 81" in the Netbeans Output window, you know it's ready.


Pat yourself on the back! Set breakpoints, go crazy.
The client code
From here, just get the Actionscript client going (listed above) and make contact with the server.

As mentioned above, the source for the client code is here .

In another post, I will detail how to talk to the server from the client's perspective. For now, I'd better go eat some dinner.