00:00
00:00
Yannickl88
yannick @Yannickl88

Age 36, Male

Programmer

Netherlands

Joined on 11/2/08

Level:
11
Exp Points:
1,130 / 1,350
Exp Rank:
60,294
Vote Power:
5.28 votes
Rank:
Town Watch
Global Rank:
50,109
Blams:
52
Saves:
116
B/P Bonus:
2%
Whistle:
Garbage
Medals:
88

Yannickl88's News

Posted by Yannickl88 - August 23rd, 2009


Well now, time to post here what I am currently working on. I doubt somebody will read it so that makes it every easier when this never gets finished :D

First of all, what is the app engine you say? Well it something the fine developers of Google made. It's a framework that allows for a distributed database. Why? Because it scales very beautifully meaning you can handle the traffic of your site/service no matter how many visits you have. You can read a lot more about the app engine here http://code.google.com/intl/nl/appengi ne/.

So my game then, it's gonna be (well already is) a Turn Base Strategy Game or TBS game shorter. What that means is that easy players gets turns to preform actions, like moving a unit or creating a building. When he/she is done the player ends the turn. Then another player can make his moves. It is sort of like chess.

The coolest thing about this kind of game that it doesn't involve real time updating of the game field. The reason that I do not want the battlefield to update real time is because some of the limitations the app engine has. One of the majors is that it doesn't allow for sockets which most multiplayer games use for push and pull of data.

Here is how I made my client and server interact:
Because a TBS revolves around actions the player takes to do certain stuff, I translated this into code. This means that for each possible action the player can do (that needs to be stored on the server) a Action is created. What I do next is store the action locally in an Array and assign it an ID so I know when it happened.
Now to send it to the server. Next thing I did was create a class that handles all the incoming and outgoing actions: the ActionManager. This class send the newly created actions to the server once every couple of seconds. Because there can only be one player at the time preforming actions, I don't have to worry about conflicts between actions from different users.
When it's not the players turn the ActionManagers polls for new actions every so now and then. He sends his latest action id to the server and the servers gives him the actions he is missing. He then executes them so the player can see the other turns that have happened. So in all the clients and the server there should be a complete list of actions order from first to last.

And that is one way of creating a multiplayer game without the use of a complicated socket server. Though switching to a socket server isn't all that hard. All you have to do is make some small changes in the ActionManager ;).

I've got this working currently locally with a development server provided by the folks of app engine. But deploying it to a (free) online server is just a matter of one little deployment script.

You can see the current pre alpha of the game in the screenshot. It has very simple programmer art which saves me the trouble of worrying about that now. Once I've got all the alpha features working I will start looking for an artist that can do this game justice. All he have to do is replace the placeholders ;).

Multiplayer with the App engine