Trading Card Game Online : How to store and use card stats

Hi, I’m making a kind of TGC (not a big project, just to train myself with online management).
So my player 1 have a server and a client and my player 2 only a client, connected to the player 1’s server.

My question is how can I store all the effects of all cards and trigger them on both computers when a player play a card ?

I’m sending and receiving data with clients and server thanks to a switch statement like :

switch(data[0])
case “S:ON”:
//Do things
break;

I have to make a case for each card ? like case"CARD1" … is this bad for the computer ?
Or I have to store cards data in another place ?
Thank you for your help !

Martin Hell

unity has an build in save system that saves int float or string on the local pc

maybe you can look at this?

Yes, I know it, but is this a good way to store as much data as all card’s stats, instructions, (even images) and to interact with all those things ?

You could “store” a lot of the data on both the client and the server. I can’t be 100% sure what you mean by what you wrote, but if it’s stats, for example, both would want to know those. The client, would want to be able to “see” what cards can do, at least, and the server needs to know how to process them. If it’s “visual” effects, that could maybe be just on clients, if you want.
As for triggering an event, on the card’s play, I would imagine that you can handle that by telling the server the card you want to play, it takes that information and processes it… then returns the result(s) to the other player(s).
My response is a tiny bit vague, but I couldn’t be sure I understood your inquiry. :slight_smile: Elaborate if you’d like some more input.