Wednesday, October 8, 2008

Hello World Login with JAGS 1.4m

I've had this demo sitting around for months, thinking I'd had posted it.

This hello world template will help anyone learn how to convert their Actionscript 3 game into a multiplayer game using the JAGS 1.4m server. Physics don't complicate this example like the Tank game, so it's much easier.

The client shows how a login request might be handled, what messages are flowing, and how game names spaces and groups within your game space works.

Typical built in commands save you the grunt work of making a multiplayer game a reality. Not only do you get a nice foundation, but you can easily direct who the messages are going to (everyone in the game, just that players group, or to a single player):

Plus, I give you a simple class called to extend your own game events and commands. Take a look at this simple Actionscript code:

You can put as much or as little logic into the Java server side. The java code demonstrates how you would pump the game messages through your java code, giving it a chance to alter what a player can do, what the message contains, who its going to, and of course affect your java game state.

The JAGS 1.4m server has a really cool way of checking for any (optional) java code you may have put on the backend. Just plop as many classes onto the JAGS server, and it will match your AS3 client with the right java resource.

That way, all you have to do is put stuff in the doAction method and you've got a complete server backend. Check out this that is in the public_ftp.login.v1_1 folder:

All the code can be easily ran without installing anything, and then can be downloaded as full projects with source code when you want to get into it.

Just visit and look at the Login 1.1 links.

Thursday, April 24, 2008

Possible AI game

I can't release the details yet, but JagsM may be used for an AI game being developed by a university.

They are going to put together the single player version and I'll go back in and connect it for multiplayer.

This will be quite exciting. I'm sure I'm not giving away too many details if I mention that the game takes human input and creates a knowledge base.

Tank has primitive bullets

The tank demo now has bullets. So what, you can't aim them, and they only collide with the ground, but hey, they're bullets.

Yep, and I believe I even have code that introduces an example constraint on how to keep the tanks from ever leaning more than 45 degrees in APE.

Sorry the JagsM server was down for 27 days. My virtual host restored an old backup and which took my java process down, probably because I had messed around with my CentOS linux kernal and didn't know what I was doing.

It's back up now, better than ever.

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

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


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.

Also, I've got the 1.4m server running on (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.


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

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

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

Mainly this page lets you know that the svn command to pull the whole trunk is:
svn checkout

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

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.

Wednesday, January 30, 2008

APE Google Blog

I'm always scrambling around for this link to the blog site of APE Physics engine.