Game banner image

I'm Gonna Snap

Brief

This game was made as part of a course on game development programming patterns. We learned and implemented common patterns in Lua and Love2D to create a basic card game.

Card Game Structure

Apart from UI, most of the game is entirely made up of card containers which hold cards and the cards themselves. The card containers keep logical pools of cards such as player/opponent hands, the deck/discard, locations, etc. I separated the card displaying logic from the containers, making a flexible displaying class that allows cards in a particular container to be laid out and shown on screen in a number of ways. Although all cards needed the same basic functionality, they needed to support various different behaviors or abilities. I decided to define separate card behaviors apart from the cards themselves. This way card behaviors could be picked and combined in a spreadsheet then loaded into the game through a CSV file. The card behaviors are more like extremely simple components which can be added or removed at the spreadsheet level.

Card data file defining card values and behaviorsCard data file defining card values and behaviors

Player Interaction

The card displaying class made it simple to enable and define player interaction with cards in specific containers on screen. However I had to make my own implementations of buttons and textboxes and a UI manager to make sure they are all updated and drawn in order. I defined drawables and clickables and had them register themselves to the UI manager in different layers for ordering.

Thoughts on LOVE2D and Lua

I found developing in LOVE2D to be a pretty intuitive and no-frills experience. I enjoyed the freedom (and challenge) of being able to manage the architecture of my game at a lower level in a limited language. Although the Lua and its tables lack some of the OOP guardrails and features I am used to, I found doing it the Lua way gave me more than enough tools to get the job done. I can begin to understand why Lua is such a popular tool scripting language and I look forward to using it in my own tools in the future. I did miss having a GUI to place elements of the screen, however I probably could have invested more time into making a system that allows me to space things more consistently on the screen through code. I would also like to make more LOVE2D projects in the future, perhaps a more complex card game or a word game of some kind.