Creating a complex card game

I want to create a game that is a simulator of the card game Yu-Gi-Oh. There are other Yugioh games on Roblox, but what I want my game to be different in, is the gameplay. In the Yugioh games that are currently on Roblox, they are manual labor. There is no automation of the gameplay. I want my game to be automatic like the application “Ygopro”.

There are multiple hurdles I will have to go through, but the largest one will be manipulating the cards. I’m currently using OOP to handle cards and store the values of each card. The two problems I will want to crush are 1) Client to Client interaction and 2) Client to Server interaction

  1. Because it is Yugioh, I want to make it where two players are “synchronized” and play on the same field. I don’t know what are the most effective methods of achieving this. My current method of syncing the players was making a player stand on a part and fire an onTouch event which creates the board object, and assigns the players’ names to either player1 or player2. Then, I will change an IntValue instance value to the board value (because the board objects have to correspond to an actual field in the workspace the players can see). I am handling all the data on the server. I feel like my method of syncing the players is inefficient and could be improved, but I’m not seeing how I would go about improving it.

  2. What are the most efficient methods of having multiple client to server interactions? My current code involves a function which indexes the cards in the players hand, and duplicated an ImageLabel and changes its ImageId to match that of the cards ImageId. Then, I have each card’s conditions checked for possible functions that could be done. An example of this would be when the player draws the card “Mystical Space Typhoon”. The conditions would allow the card to be Activated or Set. Afterwards, a new instance for each function is created. Right now, I have in each of those function buttons a local script that will Fire a RemoteEvent. Would it be more efficient to have one script that connects every function possible for every card to one RemoveEvent, or have separate RemoteEvents created for each card object?

Other concerns / questions:

a) For those who have played Ygopro, or are familiar with the card game, what would be the most efficient way to go about implementing card effects into my game. As you know, there are some effects that are passive (That don’t need to be activated by the player), and some that must be activated by the player. Also, as you may know, effect chains and spell speeds can affect the order in which effects are handled by the players. My current idea is to create a BindableFunction or BindableEvent which Fires whenever anything happens on the field. This may be called “onAction” for example. Then when onAction is fired, the game will check all possible criteria which could activate a function. These criteria would be stored in a table which is located within the board object.

b) Data storage. My current solution for storing cards is using a ModuleScript in the ReplicatedStorage which stores the data of each card in a dictionary, and when a card object is created (when a game is started) a card just indexes the dictionary according to the unique id of the card. I believe this is the most efficient way I can store the data for each Yugioh card, but as the game gets larger, the ModuleScript will get much longer. Is there an actual limit to how many bytes a script can be in Roblox studio?

Sorry if this post is poorly formatted, as I’ve been up for way too long, and I’m a new member. I will also probably start a Dev Log (not sure if this is a good idea) :laughing: so that other scripters may follow along and help or even learn from my experience and mistakes. I’m in the process of cleaning up some of my code now, but it is poorly written, so I will probably restart anyway. Any help / constructive criticism is appreciated (please don’t be easy on me). Thank you.

5 Likes

I am also working on a card game and facing some of the same challenges. The biggest challenging being the client to sever interactions.

I’m working on the same project. Let me know if you came up with anything different from what you did here. Once I’m done setting up the duel for a few of the cards I’ll clean up my code and release a description of what I did.