You have to create Zappy, which is an entirely automatic game where some AIs play amongst themselves. It is about creating families/teams, surviving by eating food and collecting stones in order to level up. Each level has different requirements for a ritual, which makes the adventure more and more difficult for the AI players, which play on their own, without any help form their creator. The game is over once six members of one family/team reach the highest possible level (8).
- The game consists in managing an entire world and its population. That world, "Minerth" is geographically made of plains, there won't be any obstacles on it.
- The world is spherical and the game board is represented as a map. So if a player leaves the board from the right, he will enter again from the left.
The place where we are contains many resources that can be used for your survival, what you have to do is just look for them and get them before other players do. Here you will find some stones and food that you will need if you want to survive and evolve.
- Only one player starts the enchantment and the others go to him and join.
- Only after two or more players are on the same square, they can start the enchantment.
- If one of the members dies, the others will continue the enchantment, unless the player is left alone, if that happens he has to start the process of enchantment again.
For the player to know what's around him, the `client` sends the command `SEE` and the server responds the following chain of characters (for level 1):
It is impossible to distinguish two objects of the same class. Only the class of an object can be identifiable, that is, two 'ambers' will have the same denomination, as they belong to the same class, but 'garnet' will have a different class than 'ambers', that way you are able to identify the resources.
Each player starts with 10 food and is controlled by a `client`. The `clients` cannot communicate or exchange amongst each other data outside of the game, in any way.
Once the call has been made, the player can proceed with his life while waiting for the "ship" to arrive. When the `ship` arrives, a new player will appear and will receive a random direction. This operation allows a new player to join.
The `inventory` command allows you to see what objects the player has and how much time he has left. The server will send back, for example, the following line:
A player can kick all the players sharing the same square. It pushes them in the direction he is looking at. When a `client` sends the `kick` command to the server, all the `clients` in that square receive the following line:
With K indicating the direction the player is looking to, which is where the other players will be kicked. The kick only works for players, you can't kick food or other resources and you can't kick during the evolution ritual.
All the players listen to the broadcasts without knowing who broadcasts them, what they understand from it, is only the direction from which the sound comes and the message.
The number of squares traversed by the sound before reaching the player indicates its direction.
This numbering is done by assigning '1' to the square in front of the player, then counting down the squares around the player in a trigonometric (counterclockwise) direction.
Remember, sound is a wave that moves in a linear manner and the world is round, so we'll choose the shortest path for sound between the transmitter and the player we calculated for.
The following example indicates the sound trajectory that we must choose, as well as the numbers of the squares around the player. The player "A" is the source that sends the broadcast through the square 4 and "B" is the receptor witch receives the broadcast through square 2.
The server is the main engine that will interfere between the AI and the GUI. It will exchange all data with the AI and execute these instructions. At the same time, it send the information to the GUI. It can be written in one of these languages [C, C++, Rust].
For this part, you must create a TCP server to make a connection between clients and manage the entire world. There is no need to host the server as the game will run in one machine only, a localhost will be enough for now.
- You can implement a non-blocking architecture with a circular buffer for every player action, allowing the data to be stored while performing the actions. The approach you take is up to you to decide.
The client will send its requests without waiting for their execution, and the server sends back a message confirming the successful execution of the requests.
The `nb-client` indicates the number of clients that can still be accepted by the server for the team `team-name`. If that number is greater than 1 a new client connects. `X` and `Y` indicate the world’s dimensions.
There is no chat room or sharing of data between players. Still, the Player can broadcast a message through a command-line sent to the server, which will be broadcasted to all players; All details are in the sound transmission part.
To have a better vision of the game, which is simple, clear and ergonomic, the project will need to have a graphic visualization client. That client will propose a real-time representation of the world as it is on the server.
- The interface must be at least in 2D with the use of icons allowing a representation of the world.
- You need to make sure you can see the in-game items.
- You need to implement the ability to click on a square to see its details, such as how many items of each are inside the square. It should look like a floating window, tooltip or something else.
- You need to make sure that the visualization of sounds is included.
The graphic part can be developed in a language of your choice [Javascript, Python, C, C++, PHP, Perl, etc]. This will communicate within the network with the `server` to retrieve the contents of the `map, teams, inventories, etc`, everything that is needed to see what is happening in the game.
- Add a flag to for a log mode when running the server.
- Add a flag for the number of resources and food density (could be different levels for example).
- Implement a seed in the server and client so that specific scenarios could be reproduced.
> Attention: `siege` is a stressing tool, use it ONLY to test your own server. Do **NEVER** use it on any server/website without the owner's permission. If you do so you would have illegally DDoSed a server and could face serious troubles.