Multi-player RPG Turn and Event Based Networking for TGB
by Jules · 07/29/2011 (2:02 am) · 13 comments
I've been working on a RPG Turn and Event based networking solution for a flash game that has been on the back burner for a while and it worked really well. It's now starting to see the light of day again but with Torque being the main focal point, even more so now that I have invested more time and money into Torque 2D/GB/iTorque and really wanted to create a multi-player TGB game, but needed the tools to create and manage it all with TGB handling all of the visuals/gameplay.
So far I've created;
Admin Panel to handle the management and configuration.
Turn & Event Based Networking (Keeping track of the players location in the game, this data is then stored on a remote web server/database and can be saved every 5-10 seconds if the web server / database is held locally on the same machine or every 30 seconds to 1 minute if remote based, but is totally down to personal preference/kit/bandwidth used and depends on how many players are to be supported in each game). There are two ways of keeping track on what the player is doing (Turn and Event) - The player can have a set number of turns/or unlimited per game session/day or based on what they are doing in the game it will then report back to the server and trigger an event. I went for the remote approach to allow clustered web servers or a cloud based solution. But really this solution is only limited by the hardware.
Chat System / Lobby (tested with about 200 simulated players on one web server) with a chat log, stores up to (x) number of chats before purging old entries. I've decided to make the chat system flexible enough so that it can be configured to use a second/third/fourth/... web/database server to avoid any lag on the main game web servers by defining what the purpose of the server is (hub for everything, game, chat, inventory, battle, AI, world etc), so all of the games management can be cut up into segments for load balancing, or just run it all under one until the game expands enough to afford extra physical servers.
To add:
Chat Moderator Powers (block players, ban players etc)
Player Inventory (stores items that everyone is carrying)
Character Creator (creates and defines the player classes and abilities)
Object Creator (creates and defines what purpose the object has)
Item Tracking (tracks the location of items in the game world)
Battle System (handles all of the battles in the game) - Live Player vs Player / Off-line Simulated Player vs Player
AI System (define AI players to walk on a set path or small brain AI giving them logic to make decissions on the route they take).
World (defines one or more worlds in the game, giving users world creator ability to expand on the worlds or levels in the game, they could then have their own place for players to visit).
Security (lock downs to servers, password hashing / ssl / encryption).
Safeguards (what if's - player losing connection, save present location etc - this may be difficult without having a live state or socket based server that then records the information to the game) - something I'll be considering. Without it, last known location would be saved, battle system would need to be arena or zone based.
I'll be creating a series of blogs on the development of this project that will also be tied into the game I'm going to create from it. Difficult to say when it will be finished as there are other projects in the works but as some of them are nearly completed I'll be balancing the workload fairly well over the next 6 weeks to see how much I can get done. The list above may seem quite large, but the majority is fairly simple to create on the back end, its the front end interfacing work that may take a little bit of time to work out. Time to crack open a new A4 pad :)
Anyone interested in having this as a pack? If there is interest then I'll put in the extra mileage to create it for selling it as a pack, instead of just using it for my own game development use.
So far I've created;
Admin Panel to handle the management and configuration.
Turn & Event Based Networking (Keeping track of the players location in the game, this data is then stored on a remote web server/database and can be saved every 5-10 seconds if the web server / database is held locally on the same machine or every 30 seconds to 1 minute if remote based, but is totally down to personal preference/kit/bandwidth used and depends on how many players are to be supported in each game). There are two ways of keeping track on what the player is doing (Turn and Event) - The player can have a set number of turns/or unlimited per game session/day or based on what they are doing in the game it will then report back to the server and trigger an event. I went for the remote approach to allow clustered web servers or a cloud based solution. But really this solution is only limited by the hardware.
Chat System / Lobby (tested with about 200 simulated players on one web server) with a chat log, stores up to (x) number of chats before purging old entries. I've decided to make the chat system flexible enough so that it can be configured to use a second/third/fourth/... web/database server to avoid any lag on the main game web servers by defining what the purpose of the server is (hub for everything, game, chat, inventory, battle, AI, world etc), so all of the games management can be cut up into segments for load balancing, or just run it all under one until the game expands enough to afford extra physical servers.
To add:
Chat Moderator Powers (block players, ban players etc)
Player Inventory (stores items that everyone is carrying)
Character Creator (creates and defines the player classes and abilities)
Object Creator (creates and defines what purpose the object has)
Item Tracking (tracks the location of items in the game world)
Battle System (handles all of the battles in the game) - Live Player vs Player / Off-line Simulated Player vs Player
AI System (define AI players to walk on a set path or small brain AI giving them logic to make decissions on the route they take).
World (defines one or more worlds in the game, giving users world creator ability to expand on the worlds or levels in the game, they could then have their own place for players to visit).
Security (lock downs to servers, password hashing / ssl / encryption).
Safeguards (what if's - player losing connection, save present location etc - this may be difficult without having a live state or socket based server that then records the information to the game) - something I'll be considering. Without it, last known location would be saved, battle system would need to be arena or zone based.
I'll be creating a series of blogs on the development of this project that will also be tied into the game I'm going to create from it. Difficult to say when it will be finished as there are other projects in the works but as some of them are nearly completed I'll be balancing the workload fairly well over the next 6 weeks to see how much I can get done. The list above may seem quite large, but the majority is fairly simple to create on the back end, its the front end interfacing work that may take a little bit of time to work out. Time to crack open a new A4 pad :)
Anyone interested in having this as a pack? If there is interest then I'll put in the extra mileage to create it for selling it as a pack, instead of just using it for my own game development use.
#2
Multi-player TGB is a great idea for a series of blogs. Looking forward to reading more about this! :-)
07/29/2011 (7:27 am)
Good stuff! Multi-player TGB is a great idea for a series of blogs. Looking forward to reading more about this! :-)
#3
07/29/2011 (9:05 am)
Thanks Guys. I agree - TGB can be used for large scale multi-player games, you just got to look at it from an outside perspective / capabilities are awesome! I'm looking at creating the above and using a socket based approach for the battle and close contact zone elements so that its semi-real time. Having a few thousand players in a game at once would be pretty cool.
#4
07/29/2011 (12:13 pm)
I think you'll find that feature list will be very appealing to users. It sounds like an exciting and ambitious product. Definitely keep the scope focused and consumable. I've been helping with a turn-based project for iTorque 2D, so it's been a learning experience for sure.
#5
07/29/2011 (2:41 pm)
Thanks Mich. I've not even touched the sides with iTorque 2D yet, so what you have been working on sounds pretty awesome. Not even sure what the portability of it would be with TGB to iTorque in terms of web based connectivity. Does the same principles apply?
#6
They are very old school in that you just send raw data pointers through messages.
07/29/2011 (2:48 pm)
@S2P - If you want to use built in networking technology for iOS, the principles will not be the same. Apple wants networking to be done through GameKit's framework, which essentially offers two different modes: real-time and turn-based.They are very old school in that you just send raw data pointers through messages.
#7
07/29/2011 (2:56 pm)
@Mich - cheers. I'll do some more R&D, and maybe port the TGB game I'm working on with this project over to it by the end of the year.
#8
07/29/2011 (6:12 pm)
Sounds good. If you have an iOS Developer license, you should have access to the iOS SDK 5. This contains the code and docs on using turn based events. It's a good way to figure out how other systems want to act for that kind of networking.
#9
08/02/2011 (2:18 pm)
We might be interested..if we don't get it done before you do. :) We have four programmers now and they are working on a similar task for our game. But it could save us time.
#10
@Mich - thanks for that.
08/03/2011 (12:04 am)
Telia - Good luck with it. 4 developers vs me.. I'm sure you'll get there before I do :) although I have been known to crank out several projects quite fast (as if I were a team of 4 or 5) so you never know. The next few blogs should show some more detail to see if it's something you are looking for.@Mich - thanks for that.
#11
It was interesting how they did it, Perhaps it will help you cut down on your development time.
08/08/2011 (4:37 pm)
I think I saw something like that scripted out in torque script in a Tribes 2 mmo thing.It was interesting how they did it, Perhaps it will help you cut down on your development time.
#12
08/10/2011 (9:45 am)
Cheers Jesse. I'd prefer to develop my own, just makes it easier knowing what everything does and how to fix things when they go wrong.
#13
08/20/2011 (8:07 am)
Crossing off the Chat Lobby :) all core chat and moderator functionality is there now. 
Torque Owner Kevin Mitchell
12 CatBlack Studios