Love Letter
Love Letter is a card game where the goal is to finish the round holding the the card with the highest value. Each card has an effect that causes other players to draw or discard. It handles a maximum of 8 players and rounds are over within 5-10 minutes. Because of this, I figured it would be great to adapt it for the Roblox platform, where players can drop in and out at any time.
a proof of concept for in-game UI
❮
❯
Play a test version here
Things that work well:
- Redux for Client-Server Communication: I built a custom client-server replication middleware that observes keys in the store and automatically replicates those keys to individual clients. The actions + reducers model is great for extensibly building a standardized communication channel between client and server.
- Don't trust the Client: the methods for communication between the client and server mean that the server is authoratative over all state changes. Additionally, every communication is verified.
- The Engine:The code is neatly divided with managers handling the deck of cards, the deck handling card specific events, and each card implemented with simple, readable, reusable helper functions.
- Singleton Registration: This was a small bit of code, but I'm pretty proud of a singleton registration library I wrote. It allows a singleton to register itself and its dependencies, then the system will initialize all the dependencies in the correct order.
Stuff that sucks:
- Redux for Event Management: while Redux is excellent at managing state changes, in a game setting, it becomes annoying to trigger events when certain conditions are met. It requires another state observer that is responsible for progressing the game state or propegating events. This structure is clunky and sometimes feels like it is duplicating responsibilities. The Redux Store holds the state and processing of events, but an external observer of the store needs to also manage the state and fire events?
- React for Animations: Roblox's Roact version 12 is great for stateful updates like an app, but adding animated flourishes is a nightmare.
- Writing React Components: Roblox's tooling around visualizing React components is still pretty primitive, so rapid iteration of the components is not a simple process.
- Character Controllers: If I had taken the time to plan out the player interface, I would have built each character controller so that the interface would allow for an NPC to execute those actions as well. Right now, I must emulate other players and that significantly slows play-tests.
Stuff left to fix :
- Add visual feedback for drawing a card
- Add simplified card view for Discard pile
- Add a readable version of the Player Guide so players know what cards do
- Build the rest of the world, the castle courtyard, flowers and stuff, table settings
- Figure out why the crystal is floating at the wrong height
- Card indices sometimes fighting with server? Race condition?
- Cards are occassionally "not selected"
- Cards Left counter not sync'd across players