I'm looking for advice on the best way to implement an action where the player plays multiple cards.
In this game (Letter Tycoon), the player has a hand of cards, each with a letter. The player can form a word from these cards and play it. There are also several nuances: some letters in the word can come from a shared "community pool", some letters can be added to the word using special powers, and some letters have options associated with them (the player can choose whether each Y is a consonant or a vowel, which can affect scoring). There is also a special power that allows the player to play two words.
Once the word is played, other players have a chance to see it and possibly challenge it. So, the played word needs to be stored in the database regardless. The question is whether it gets stored only after it is "played", or incrementally as the player is building it up.
Option 1: Player builds up the word (or words) on the client, and sends the whole word as a single action.
Option 2: Player builds up the word (or words) one letter at a time, sending each letter as a separate action.
Here are some pros and cons:
- Sending the whole word, with all the necessary options, in a single action is awkward, given the available arg types. I'd probably need to send several different coordinated AT_numberlist args to capture every property of each letter.
- If the word is sent one letter at a time, then it'll be stored in the database before it's supposed to be visible to others, so I'll have to be careful not to show it to others before it is "played". If it's sent only once it is played, this isn't a risk.
- If the word is sent one letter at a time, then the in-progress word will persist if the active player refreshes their browser. This is probably a good thing, but I'm not sure what the expectations are around this. Might this be confusing to the player? Might they think the word is visible to others when it's not (yet)?
- I want to provide a "clear" or "reset" button to start building the word over, since the user could change their mind once they see all or part of the word, or they might make a mistake partway through. If the word is sent all at once, then this "clear" is pure client-side, and therefore simpler to implement. If the word is sent letter-by-letter, then this would have to be a separate action that updates the database. This is slightly more complex, though not too bad.
- The order of the letters is of course important. I'm not sure if relying on the order of the actions to play each letter could be a problem. Perhaps this is a non-issue, and order of actions is preserved even if they are done quickly. (Formed as a question: is there any chance of actions sent by the same player in quick succession to be received by the game logic out of order?)
Any thoughts or advice you have on this question would be appreciated. Thanks!
In this game (Letter Tycoon), the player has a hand of cards, each with a letter. The player can form a word from these cards and play it. There are also several nuances: some letters in the word can come from a shared "community pool", some letters can be added to the word using special powers, and some letters have options associated with them (the player can choose whether each Y is a consonant or a vowel, which can affect scoring). There is also a special power that allows the player to play two words.
Once the word is played, other players have a chance to see it and possibly challenge it. So, the played word needs to be stored in the database regardless. The question is whether it gets stored only after it is "played", or incrementally as the player is building it up.
Option 1: Player builds up the word (or words) on the client, and sends the whole word as a single action.
Option 2: Player builds up the word (or words) one letter at a time, sending each letter as a separate action.
Here are some pros and cons:
- Sending the whole word, with all the necessary options, in a single action is awkward, given the available arg types. I'd probably need to send several different coordinated AT_numberlist args to capture every property of each letter.
- If the word is sent one letter at a time, then it'll be stored in the database before it's supposed to be visible to others, so I'll have to be careful not to show it to others before it is "played". If it's sent only once it is played, this isn't a risk.
- If the word is sent one letter at a time, then the in-progress word will persist if the active player refreshes their browser. This is probably a good thing, but I'm not sure what the expectations are around this. Might this be confusing to the player? Might they think the word is visible to others when it's not (yet)?
- I want to provide a "clear" or "reset" button to start building the word over, since the user could change their mind once they see all or part of the word, or they might make a mistake partway through. If the word is sent all at once, then this "clear" is pure client-side, and therefore simpler to implement. If the word is sent letter-by-letter, then this would have to be a separate action that updates the database. This is slightly more complex, though not too bad.
- The order of the letters is of course important. I'm not sure if relying on the order of the actions to play each letter could be a problem. Perhaps this is a non-issue, and order of actions is preserved even if they are done quickly. (Formed as a question: is there any chance of actions sent by the same player in quick succession to be received by the game logic out of order?)
Any thoughts or advice you have on this question would be appreciated. Thanks!