DesignOverview
Note: The content on this page is very old and is likely outdated. You may want to check on the irc channel #arianne.
Introduction
The following text is not complete. Please add network protocol TCP instead of UDP, Client no more in C if necessary.
What is Arianne?
Arianne is a multi player online game framework and engine to develop turn based and real time games. It is designed so you can easily create your games on our portable, robust server architecture. The server is written in Java and Python is used for writing game rules. A mySQL backend powers the server and the server communicates with players using a UDP transport channel. Our reference clients are coded using Java and C in order to achieve maximum portability. Arianne's server is totally client agnostic making it very modifiable.
Arianne has been in development since 1999. It has evolved from a tiny application written in pseudo-C++ to a powerful, expandable server framework running on the Java platform and a portable client framework written in bare C to allow total portability of Arianne's clients. However, since 1999, the key concept of Arianne has always been KISS: Keep it simple, stupid. Our goals are: simple, small, and fast.
Arianne has always been an Open source project and always will be. Each version has been written and released as GNU GPL software. We believe the right way is to give you the power to change, edit and configure whatever you want, both on clients and the server. Arianne always welcomes your contributions and modifications to the code to make this the open source reference platform for game content providers.
Arianne is playable. Arianne now supports several test games:
- a TicTacToe game
- a multi player Gladiators fighting game
- a multi player Pacman game
- a multi player Zelda like game
You can read more about them on our main page http://arianne.sourceforge.net.
Please note that the games are out of date at the moment and do not run. Please be patient until we can fix them.
What is Marauroa?
Marauroa is our portable, robust, and multithreaded server architecture. The server is written in Java and uses Python for writing your games rules. A mySQL persistence engine powers the server and allows it to communicate with dozens of players using a UDP transport channel.
Marauroa is based on a philosophy we call Action/Perception. Each turn clients can ask the server to do any action on their behalf using action requests. A Perception is then sent to the clients explaining to them what they perceive of the world around them, and hence the result of their action. Marauroa is totally game agnostic and makes very little assumptions about what you are trying to do, allowing great freedom to create whatever type of game you want.
Bugs are a fact of life, they just happen. However, Arianne is fully tested using Test Units with JUnit and cppunit. All modules are tested for most common cases, allowing better quality software to be deployed. Your cooperation in reporting problems is simply invaluable: You are our best developer and we want to hear from you.
Marauroa is based on very simple principles:
- Clients communicate with the server and vice versa using a UDP portable network protocol. It has been designed with reliability in mind to allow a more stable experience in online games when lag occurs.
- You can develop an Arianne client on anything that is able to compile C code using the Arianne client framework.
- In order to play a game everyone needs an account on the server that is identified by a username and password.
- Players use their account to login to the server and choose a character to play the game with from one they have available in their accounts. The server checks the login information using the mySQL backend and loads the player into the game using the persistence engine.
- Players cast actions to the server in order to play. The action system is totally open and nothing is hard coded thus allowing one to fit it totally to ones game style. The server sends information at regular time intervals, called turns. Each turn a perception is sent to the clients to inform them of the state of the game and any relevant state modifications. Marauroa's perception system is based on Delta^2: an algorithm which simply sends whatever has changed.
- The server executes code each turn to move game status from one turn to the next. Using this hook it is simple to code triggers, time outs, conditions and whatever kind of behavior you need.
- The server transparently and automatically stores players and game status modifications on the persistence engine. Exactly what is stored is also configured by the game developer using the scripting language.
- Server side game rules can be written in Python to allow simple and rapid development of the game rules engine without recompiling or knowing anything about Marauroa internals. Game rules can also be coded in Java if desired.
- The server can be run with zero administration.
- Another feature are statistics of usage. These are generated by the server and then stored on a mySQL database so you can later generate fancy statistics from the information. If you do not require them they can be disabled so you don't waste CPU time and disk space. Marauroa is built around modules that can be changed and disabled without affecting others.
- Both the server and the client are fully documented. The documentation includes specification and design and not just API documentation.
Basic Design of Marauroa
Marauroa is an arianne server application with an UDP transport.
Marauroa server is and it is built using threads. marauroad has the following set of threads:
- 1 thread to receive data from clients
- N threads to send data to clients
- 1 thread to handle the data into server actions
- 1 thread to handle RPG itself.
To denote the active behavior of the thread classes their names include the word Manager. So marauroad has:
- NetworkManager
- GameManager
- RPManager
NetworkManager is the active thread that handles messages that come from the clients and converts them from a stream of bytes to a real Message object. See the Message Types document to understand what each message is for.
The pseudo code behind NetworkManager is:
forever { Read stream from network Convert to a Message store in our queue }
One level (conceptually) over NetworkManager is the GameManager, this is the part of the server that handles everything so that we can make the server work. Its main task is to process messages from clients and modify the state on the server to reflect the reply to that action, mainly related to:
- Login
- Logout
- ChooseCharacter
- Actions
- Transfer Content
See GameManager for a deeper understanding about what it does exactly. The hardest part of the Manager is to consider all the special cases and all the exceptions that can happen. The main pseudo code of the GameManager, if we skip exceptions, is:
forever { Wait for Message to be available if(Message is Login) { check player. ask for character } if(Message is Choose Character) { check character add to game } if(Message is Action) { add action to game } if(Message is Transfer Request ACK) { send client the content requested } if(Message is Logout) { remove from game } }
And finally RPManager is the active thread that keeps executing actions. Marauroa is, as you know, turn based, so actions when received are queued for the next turn, and when that turn is reached all the actions pending on that turn are executed.
The idea in RPManager is to split up complexity as much as possible: we have 2 entities to help it: Scheduler and RuleManager.
forever { for each action scheduled for this turn { run action in RuleManager } Send Perceptions wait until turn is completed next turn }
Scheduler handles the actions as they are sent by the GameManager. RuleManager is a class that encapsulates all the implementation related to rules.
Basic Design of ariannexp
Ariannexp is arianne client. It doesn't matter if you use Java, C or Python, you have an interface for connecting to an Arianne server.
The basic interface allow you to create a client like:
connect to Server login with username and password Show available characters choose Character while game keeps running { Get perception apply perception to world render world get inputs send actions } logout