Card games are weird. You can have such a simple set of rules, and yet such wildly different outcomes happen with a shuffled deck. Programming Blackjack has been a similar experience with game rules like doubling down, instant blackjack, and splitting pairs making everything extra convoluted (Especially that last one!).
To me, I consider this Blackjack mod to be a spiritual successor to my Roulette mod. From that mod I learned a lot about Cyberpunk's code, script integration, and project scope. The lesson of mine was to fully embrace modularization of my own codebase. Roulette used a lot of community libraries, frameworks, etc. to function and I knew my own modules would 'borrow' all of the same syntax for linking files together. It was a big move for me to start designing everything for object oriented programming. I've dabbled with OOP before, but functional programming has always been more comfortable to me and it always got the job done for my small python script projects. Of course, this project had its own fair share of hair-pulling challenges and bugs. . Finally the last major change during this project was developing everything with git in mind. I've been using Github for some time already, but never actively for my own development. Now I've got this as well as other projects set up with git and I've been practicing committing early and often!
While making Blackjack I encountered a major problem that kept recurring, I kept getting confused. By my own code too! I was often getting bugs that were caused by referencing the wrong variable, similar names with confusing meanings, local vs global objects, and more. Initially I wasn't sure how to split up all the code I would need, so I created some broad categories; menu, 3D physics, money display, world interaction, and gameplay round logic. Since I wasn't sure what the logic would look like at this point, I kept it as broad as I could while separating what I expected to take a lot of lines to code. Evidently, Once I began developing I found some missing functionality from my groups as well as some over-grouping from before. I did add 2 more modules to my project, however I found the round logic to be excessively long. If I were to start from scratch, that would be my target for a new structure. Overall, OOP helped a lot! My code is much easier to read now, so future changes aren't as dreadful as they are with the roulette mod. That said, there's space for improvement. Object functions is something I barely touched, which could help more in the long run as well.
Gameplay decisions were very fun for this project! I knew from the beginning that I needed the absolute essentials: Hit, Bet, Stand, Bust. If I can handle that while accounting for the dealer's hand, most of the difficulty would be completed (or so I thought haha). Once I had simple logic working, I added pair splitting. This made it complicated quickly... oh so many bugs! For those unaware, if a player is dealt 2 of the same number in Blackjack they have the option to split. This creates a second hand, both of which are in active play against the dealer's 2 cards. In a way, I was adding multiplayer to the game. (If Cyber MP ever comes out, a port would be possible. I would NOT attempt MP support with roulette, lol) I also had a lot of assets to create and edit. The table design was copied from CDPR's Phantom Liberty DLC, then I edited the table model and textures to fit the aesthetic and function of my mod. I chose an animation, broke the game for a bit (see image below), placed an NPC as a dealer, and
Another thing I started using a lot more is AI assistance. A lot of the issues I learned from roulette were caused by my inexperience with Cyberpunk and its scripts. Now that I've got some experience, I found LLMs to be much more helpful. I will say this; I'm trying to not use AI to solve all my problems. The term "Vibe coding" has been used a lot this year to describe fully embracing AI coding and giving it large amounts of control. Personally I don't believe AI is at the level to make this work yet, but the models are still getting better. All that said, at this time I'm still fairly inexperienced with many deeper programming topics. So if I don't know for sure when AI is hallucinating, I don't know when to trust it. So with that in mind, I've been using AI specifically to find and explain problems to me. If I don't understand the code, I don't add it to my codebase.