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.
I love games and am seeking to share my experiences in creating them. So far, I have a bare-bones game server written in java, and it's free to use my fireleg.com server. You can also setup the game server yourself, and I have an example game written in Actionscript 3.0. It's all for the taking, open source.
Tuesday, February 12, 2008
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
>
>
> 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
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
>
> 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.
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.
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.
Wednesday, January 30, 2008
APE Google Blog
I'm always scrambling around for this link to the blog site of APE Physics engine.
http://groups.google.com/group/ape-general
http://groups.google.com/group/ape-general
JAGs 1.4m coming soon!
Eureka! I've done a lot since last post.
I'm close to releasing an alpha JAGS 1.4m.
The 'm' stands for multi game. This means one JAGs server will search an FTP directory, load up all those java games and connect the client to the correct backend game space.
For instance, I can set up an FTP folder and you will be able to upload your java game right along with mine.
This will be fantastic for testing, as I can have my own games going and so can you -- even ones that need java resources on the backend.
And if your game doesn't need backend java resources, JAGs 1.4m will still give you a virtual game space based on your whatever you want to call it in your Actionscript call.
Of course, groups are still supported within your game space. This allows you to further refine who everyone is playing with.
I've also improved the Actionscript client library. Now, it's much cleaner and uses events heavily. This means much lighter integration with any game you want to write = easier in general.
---------
The example I will release soon brings me to my final exciting bit of news: multiplayer physics APE.
Yes, that's right. I successfully sent complete APE "WheelParticle"s across the server from one Actionscript client to another! Yeah.
In this video, you can see two windows running some APE physics. The top window, when refreshed sends its wheel particles to the bottom window. The only way the bottom window gets the WheelParticle is through JAGS.
I hit refresh two times, and you can see where it made a couple of sets of wheels and sent them over the wire.
I'll have to post the code and write up how to make use of the IExternalizable interface so you can go crazy with sending any object you want over the net too.
Just need to sleep a little right now...
I'm close to releasing an alpha JAGS 1.4m.
The 'm' stands for multi game. This means one JAGs server will search an FTP directory, load up all those java games and connect the client to the correct backend game space.
For instance, I can set up an FTP folder and you will be able to upload your java game right along with mine.
This will be fantastic for testing, as I can have my own games going and so can you -- even ones that need java resources on the backend.
And if your game doesn't need backend java resources, JAGs 1.4m will still give you a virtual game space based on your whatever you want to call it in your Actionscript call.
Of course, groups are still supported within your game space. This allows you to further refine who everyone is playing with.
I've also improved the Actionscript client library. Now, it's much cleaner and uses events heavily. This means much lighter integration with any game you want to write = easier in general.
---------
The example I will release soon brings me to my final exciting bit of news: multiplayer physics APE.
Yes, that's right. I successfully sent complete APE "WheelParticle"s across the server from one Actionscript client to another! Yeah.
In this video, you can see two windows running some APE physics. The top window, when refreshed sends its wheel particles to the bottom window. The only way the bottom window gets the WheelParticle is through JAGS.
I hit refresh two times, and you can see where it made a couple of sets of wheels and sent them over the wire.
I'll have to post the code and write up how to make use of the IExternalizable interface so you can go crazy with sending any object you want over the net too.
Just need to sleep a little right now...
Thursday, January 10, 2008
Setting up Java Game Server 1.4
Couple of main points.
Project is ready to be opened in Netbeans 5.5.
Go to Trace.java class and take comments off of this one section.
In my production code I had the System.out.println(s); commented out.
Next, realize that once you fire the program off inside Netbeans (or from command line), you have to use Windows Task manager to stop it.
It's not like a regular java program where you can push stop. You'll find it floating around as a 6-8Meg java process in the task manager.
JAGS runs on port 81, so I you try to fire two of them off, or don't notice the other one still running, you'll get a startup message saying address already in use.
Here's a successful startup:

Here's what happens to me all the time when I try and run two of them (bad thing):
java.net.BindException: Address already in use: JVM_Bind

Once you've got your server running, and you've modified your Actionscript Client to point to your localhost, fire that Flex program off.
You should see messages talking about starting connections like this:
And this...
Now the arbitrary commands in the Actionscript Client project will start to make a little more sense.
Good luck! I've got to get some sleep...
Project is ready to be opened in Netbeans 5.5.
Go to Trace.java class and take comments off of this one section.
public final class Trace {
public Trace() {
}
public static void out(String s) {
System.out.println(s);
}
In my production code I had the System.out.println(s); commented out.
Next, realize that once you fire the program off inside Netbeans (or from command line), you have to use Windows Task manager to stop it.
It's not like a regular java program where you can push stop. You'll find it floating around as a 6-8Meg java process in the task manager.
JAGS runs on port 81, so I you try to fire two of them off, or don't notice the other one still running, you'll get a startup message saying address already in use.
Here's a successful startup:

Here's what happens to me all the time when I try and run two of them (bad thing):
java.net.BindException: Address already in use: JVM_Bind

Once you've got your server running, and you've modified your Actionscript Client to point to your localhost, fire that Flex program off.
You should see messages talking about starting connections like this:
LISTENING on PORT 81
CONN # 0 :127.0.0.1
CONNECTION STARTED: 0
# Conns:1
And this...
--------------------
SECURITY POLICY SENT
--------------------
IN conn_0c: 1199952686796>no id0.17506256978958845>!server>Hello.
MESSAGE:
TIME: 1199952686843
FROM: no id0.17506256978958845
TO: !server
Action Verb: Hello.
COMMAND not found.Hello.
IN conn_0c: 1199952686859>no id0.17506256978958845>!server>!whats_my_name
MESSAGE:
TIME: 1199952686859
FROM: no id0.17506256978958845
TO: !server
Action Verb: !whats_my_name
OUT: !your_id:conn_0c
IN conn_0c: 1199952686859>no id0.17506256978958845>!server>!auto_match:2
MESSAGE:
TIME: 1199952686859
FROM: no id0.17506256978958845
TO: !server
Action Verb: !auto_match:2
:conn_0c looking for up to 2 total players.
OUT: !name_group:group_0g
OUT: !you_host:conn_0c
NEW GAME: group_0g
Now the arbitrary commands in the Actionscript Client project will start to make a little more sense.
Good luck! I've got to get some sleep...
Wednesday, January 9, 2008
JAGS Google Code Site
Just wanted to keep an easy link back to the google code site.
Go here to download code or see the code project page.
Project page
Download page
My site fireleg.com/jags.html also works, but I think I'll be switching over to the google code to post any new code.
Go here to download code or see the code project page.
Project page
Download page
My site fireleg.com/jags.html also works, but I think I'll be switching over to the google code to post any new code.
Subscribe to:
Posts (Atom)