Detailed explanation and example of data design of room card mahjong Analysis series “card game playback”

Data design of room card mahjong Analysis series "card game playback"

In recent months, "room card" chess and card game has become a hot spot in capital pursuit. Based on the majority of users and social attributes of wechat, "room card" chess and card has developed rapidly. Due to the experience accumulated in relevant projects in previous years, in view of the broad local chess and card market and the development prospect of the "development room" mechanism in the future, the red child team also began to turn to the project development based on "open room" chess and card games. In order to better communicate and learn with developers, the "room card Mahjong Game Analysis series" is specially opened.

Hongzhong mahjong, the "big winner" developed by honger team

This set of mahjong analysis is based on the mahjong source code of "Internet Fox" room card circulated on the network. According to the functional modules, it is divided into "erection guide", "server framework", "background system", "Hu card algorithm", "client interface", "anti cheating function" and other details to do some analysis and guidance, so as to help the majority of chess and card game developers quickly master the "room card" Mahjong research and development principles and skills design. Also hope that interested friends pay more attention.

The first time we opened the official account, we picked a simple start. First, let's talk about an important function of mahjong in the house card: "game player replay". We all know that chess and card games focus on fairness and reality, and do not cheat. If players feel that the game is cheating, I believe he will lose interest in this game. However, it is not easy for players to judge whether they cheat or not. At this time, it is particularly important to provide a "game playback" function for players to analyze.

"Netfox" and other enterprises that have long worked in the field of chess and cards have complete experience and framework in this regard. Through reference, I found that it completes the "game playback" function through the following set of processes.

First, a gamerecord structure is required in the room class ctableframesink of the game server. This structure can record player information, cards and actions of each step:

In datastream. H, there is a set of macro to get data stream, which can put data into or take out data stream.

Well, with such a structure, we can start recording this game at the beginning of the game.

Then we began to record operations, adding records when players play cards and when players respond to operations such as eating, touching, bar and Hu.

In this way, the basic operation record is also completed. Finally, when the game is over, we need to submit the records to the database.

In the private farm server, the writesocre of privatetableinfo will be called through the writetablescore function, which will record the flow of data.

And finally at the end of the game, disassroom (ptableinfo); Sent to the database.

Finally, the database will complete the warehousing of data flow through the execution of a stored procedure. The specific code is no longer displayed, you can refer to it

CDataBaseEngineSink::OnRequestPrivateGameRecord()。

In this way, a complete set of playback data flow is over.

OK, that's all for today's analysis. Red boy, welcome to continue your class next time~

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>