
Hello.
Work on the creation of a
video mafia is boiling with might and main.
Let me remind you that WhoIsMafia is a new experimental version of the Mafia game, the main idea of ​​which is live communication between players via cameras and microphones. The service is made almost entirely on peer-to-peer technology, the video between clients is transmitted directly, and the clients themselves are responsible for the entire game logic.
Today I will introduce a new update to Habraplice and will describe some of the technological difficulties that sometimes put me in a dead end.
')
Update
- A very important feature for the development of the project has been added - viewing games and “no-camera” mode. Those. even if you do not have a webcam , you can watch the game progress, chat with other viewers and players in between games.
- Optimized server part - the list of rooms is updated faster, more correctly, more timely.
- The start screen has been redesigned - now there are tips that will help users who are not familiar with the specifics of the flash to start the game.
- The chat and system messages have been improved, which makes the game more comfortable and understandable.
- Added network statistics - now you can see how many approximately users are on the site at the moment and how many viewers watching your game.
- Well, as always, a huge job was done to remove bugs, as well as to populate the game with new varieties of bugs :)
So Wellcome - go, test, play for health.
Technological dilemma: to use or not
When I started working on a project, I just wanted to try the p2p implementation in flash. And if everything is clear with video transmission (video is heavy content that should not be chased through the server), then with game messages everything is not so simple.
On the one hand, the use of p2p in the game gives a huge plus when developing. First, instead of implementing the server and client side, we only do the client. At the same time, it can be taken as an axiom that all users of the service have the same client, and therefore they all work according to the same rules. Secondly, it opens up huge opportunities for scaling the application - absolutely no need to worry about the load on the server. After all, the server in this case is only required to introduce customers to each other. Although, in principle, these functions can also be assigned to the client - there are technological possibilities.
But each coin has a reverse side. And the biggest problem is the synchronization of players' actions. I will try to explain on the fingers on the example of the Mafia. The game has an unambiguous initial state - the beginning of the game. No one has received their cards yet. Cards are dealt randomly - how to do it? There are two options - either to appoint the principal by cards, or to do it together, when each client makes his own small contribution to the rend. The second option is difficult to explain, so consider the first option with the lead.
One of the clients is designated as the lead Suppose a web server did this and somehow conveyed this information to clients. After that, the host acts as a server. But:
- The master can disconnect at any time.
- Messages from the host may not reach one of the clients.
- Messages may not go in the order in which they were sent - because the UDP protocol is used for communication over RTMFP, which does not guarantee delivery
- Finally, messages sent by the facilitator may be fake.
With all this you can fight. For the first problem, if the leader does not respond for a long time, although the time has come, you can change it. But how to do that? After all, the fact that the leader does not respond can only “appear” to one player, and taking into account points 2 and 3, it will surely appear. Well, if so - let's make it possible for each client to become a leader, if suddenly it seemed to him that the leader was gone. Then new difficulties will arise - what if the presenter has already sent an important message to all clients, but it has not reached one, he became the leader and again sends this important message, but in his own interpretation? Moreover, he can do it on purpose - paragraph 4.
And this is only the tip of the iceberg in the igrostroi based on peer-to-peer. But I’m absolutely sure that all these difficulties can be solved, I just don’t have enough qualifications and experience. Over the past two weeks, I have repeatedly visited the idea that it would be good to transfer the game to something like XMPP :)
But until I give up, I believe that the future of peer-to-peer games (well, at least casual ones). Therefore, if you have experience in creating peer-to-peer games, please share, everything will be later.
Continued:
WhoisMafia Annual Report