Detailed explanation of the playing process of “game playback” of mahjong Analysis series of room card

Detailed explanation of the playing process of "game playback" of mahjong Analysis series of room card

Yesterday, red boy told everyone about the data recording and processing of "card game playback". With the storage of data, the following is the display of data.

To be honest, I haven't used SQL server as a database for a long time. The server of netfox is based on win, IOCP and SQL server. After configuration, you can see three game related tables in the qptreasuredb database.

Among them, dbo. Privategamerecord is a record that stores the room, player and final winning and losing information of the current game.

Dbo. Privategamerecordchild stores the playback of each game of the current game, that is, the details and operation data of each game described in the previous article.

Dbo.privategamerecordeuserrecordid is the corresponding relationship between record ID and player ID.

When we open dbo. Privategamerecord, we can see that a property field UserData stores a pile of binary data. That is, we passed the stream in the previous section_ Value to fill the structure data into a byte stream and store it.

When the client enters the battle record interface, it will send sub to the login server_ GP_ GAME_ RECORD_ The list message requests all the participating room data of the current player, that is, the data list related to the player in dbo.privategamerecord. This can be found in the CB of cgpgamerecord.cpp_ See in the getgamerecordlist function.

In attemperinginesink.cpp of the login server, we can see that the login server will forward the database request after receiving the message, and the database will pull out the data through the stored procedure. Then return to the client.

After receiving the data, the client parses the data stream into the structure tagprivaterandtotalrecord through streamvalue and displays it.

When the player sees this message, if he wants to view the battle situation of each game, he will click the "details" button again. At this time, the client will send sub to the login server again_ GP_ GAME_ RECORD_ The child message is basically the same as the above process. After such a round trip, the client will get the detailed data of each bureau in the room. After receiving it, the data stream will be parsed into the structure tagprivaterandrecordchild through streamvalue and displayed.

The player can now see the details of each game. If he wants to watch the game playback, he will call the startrecord (datastream kdatastream) of gamescene to convert the data stream in tagprivaterandrecordchild into the current player's game information and operation information. After that, the game scene and playback operation button menu are displayed. With specific data, the playback speed can be controlled through the button menu. The previous step and the next step are not complicated. In the nextrecordaction function of gamescene, we can see how to perform corresponding operations according to the current operation type to reproduce the player's cards and operations.

Therefore, a wonderful card game was played back completely.

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
分享
二维码
< <上一篇
下一篇>>