Where should I write my game logic?
Comments
-
I would do it server-side. One deck, managed by the server, communicated to the clients. Clients should probably only be around to accept input. Server would validate input as legal actions and respond back to client to initialize proper animations, etc.0
-
A card game could almost all be written with operations to and from the game server. Check out how the event system and operation system works inside the server.
After that you just create the operation stuff, do an oprequest pass in the right stuff, server gets it and examines everything and either sends and operation or event back.
Client sends a play card operation
Server gets operation and looks it over, if it succeeds it triggers and event so all clients in the room know the card was played.
If its not valid then it sends an operation back to the client to tell it the play was invalid.0 -
But how do I use Photon Cloud? I'm confused
Also, I have another question, my card game will be like hearthstone in gameplay.. I mean, if the user leaves, he loses the game.. It's not fully async.
Is better for me to use Realtime or Turnbased?0 -
Ok, so one thing to keep in mind, is using the cloud services. Each player owns their own game objects. So it would be easy to get a card game set up this way.
Realtime or turn based is your option based on the kind of game you are making. Ask yourself questions about your design and decide which architecture is right for your game.0 -
Hi, there
big thanks you to all who answered.
Turnbased by design assumes that it may happen that only one player right now is online. if nobody online game state may be saved to continue game later. if player left game by default he is still in game
Althogh realtime also supports game state saving/loading you have more options. using them you may get same behavior as turnbased.
now about Game Logic: if you are going to use cloud then it is not possible to modify our server code. but you still have an options:
1. host your self
2. write plugin and use enterprise cloud
3. use web hooks.
with First and Second everything more or less clear. Lets talk about webhooks
web hooks allows you to setup call to your web server where your logic may make desigion and respond with some answer. clients will get this answer and handle it.0 -
Is it possible to use Webhooks with Realtime?chvetsov said:Hi, there
big thanks you to all who answered.
Turnbased by design assumes that it may happen that only one player right now is online. if nobody online game state may be saved to continue game later. if player left game by default he is still in game
Althogh realtime also supports game state saving/loading you have more options. using them you may get same behavior as turnbased.
now about Game Logic: if you are going to use cloud then it is not possible to modify our server code. but you still have an options:
1. host your self
2. write plugin and use enterprise cloud
3. use web hooks.
with First and Second everything more or less clear. Lets talk about webhooks
web hooks allows you to setup call to your web server where your logic may make desigion and respond with some answer. clients will get this answer and handle it.0 -
yes0