📜 ⬆️ ⬇️

Mafia online

image

We recently caught fire with the idea of ​​creating an interesting and fascinating application for the scribbler project, but one that everyone liked ... But first of all, I wanted emotions, experiences, team spirit, excitement. We finally agreed on the idea of ​​doing Mafia.

Well, the idea came, it remains only to implement it. First of all, I had to dig across the expanses of the runet in order to understand what the mafia is on-line and to decide on at least some rules.
')
Oddly enough, but the biggest problem was the rules of the game. How many people, so many opinions, each has its own mafia. In the end, we decided only on the characters and their actions. Further more: how many days will the game have? Nights? How will the voting take place? To address these issues, we had to meet every day at the office of Mafbatly. In real life, the advantage of the Mafia is that emotions play a key role. Girls make eyes, players get accustomed to each other trying to figure out the evil mafia. In the online version, everything is a little different, but for communication we have screwed up a convenient chat.

Developer Comments:

Initially it was assumed that the client would work through http requests, but this method would significantly increase the load on the server, and the choice fell on a permanent connection to the server through sockets.

So, I started to develop the server as a language I chose C ++ and used the Qt library, as it is easy to understand, easy to develop, and besides, cross-platform.

The server landed on port 5190 (it also uses ICQ), i.e. it turns out that who does not have this port closed, he can play mafia.

With the choice of the protocol, I did not suffer for a long time and sent the data in the form of XML, in which there was the name of the command and the values ​​transmitted with the command, something like:
image
The server also sent a response in the form of XML with the same structure.

Yes, the protocol in the form of XML in this case is of course redundant, but the game is also not a 3d shooter). Accordingly, all game processes occur on the server side, and the flash client only displays the current state of the game, through the data obtained.

We invite everyone to play and express their opinion on the game!

Source: https://habr.com/ru/post/84046/


All Articles