i am writing a simple poker game
i think nakama is very suitable for tiny room pvp game and turned-based card game.
flow the framework’s rule, i always have to re-create a GameLogic instance which may contains the game logic and game flow control process etc. and restore the state from the state data that saved in match handler scope.
I have a gut feeling that is only ok with tiny games, if the game is complex and the state data is massive, Is this still an appropriate approach? i mean re-creating GameLogic instance and run a tick-like method in loop. if the tickRate is more high frequency, it would be a challenge of performance.
it is hard for me to image use Nakama serve as a MMORPG server side
Yes. When I started the game it looked simpler just to serialize and deserialize it every time the tick runs. but its not viable solution for complex games with 100s of class objects. Dont know why nakama not opted for single VM per server with state of the server logic.
I am working on a similar game, 4 vs 4, turn based card type game. I do not serialise the game data. At the beginnings of the game, the server creates the initial state and sends it to each client. Then I track the game state within the match_loop using the minimum amount of data. For example, I would only store the card id rather than the full card object. When a card is discarded, I send a opcode for the card discarded action along with the card id and process that. I am not storing the full match state, only the key info that I can use to validate the game state.
This may not be the best approach but seems to be working for me.
I do the same, Also I faced difficulty building AI logic with this math loop. long running AI gameplay behaviour is impossible to do the conventional way. Is there any workaround for this? Now I run the entire AI logic in one tick and I handle the flow in the client using the data flushed from the server.
Hey @Sathyaraj did you manage to implement AI logic on the server side? I need to implement some form of AI logic on the server side as well for bots. What route did you take?
Yes, But its not the optimal method. Its very difficult to build AI logic which involves longer operations like different actions. What I do it perform them all at once, send to the client and show the actions one by one along with animations.
Thank you. I came up with 2 ideas because my game is a turn based game so it’s slow paced so it’s a bit easier to deal with this.
Let one of the clients perform the AI logic and send the result to Nakama, which will then validate the result and apply it to the game state. The idea is that we’ll use the client to do the heavy lifting.
Use a second server purely for this. We’ll make a server to server request, apply the AI logic and get the results back and update game state.
Or just keep the AI logic very simple and use GO rather than Lua (GO will be faster).
I haven’t decided which route to take yet. Good luck with yours.