Making A Dice Game pt 3

January 19th, 2025


Welcome back to another iteration of watching me struggle my way through making a Farkle app! Today we are going to be looking at my progress up until this point. Which is kind of why these posts exist in the first place. Before we go any deeper into this post I do want to say with confidence that I am about 90% done with this game! FINALLY!!! I will also include a link to the current build HERE! and probably also add it in my About Me page. Which is all pretty cool. However, if you have been following me at all you know that I am definitely not actually done with this.


Before getting into what I have done in the last week since my previous update, let's take a detour in to something more personal. So, yeah, I wanted to make a Farkle game. So I made a Farkle game. Like most things that I do everything has to have some kind of deeper meaning. Farkle is like Yahzee or any other silly dice game. Well...a few years ago my brother had a stroke. Immediately following this stroke he was not able to speak or communicate properly. He had aphasia. It was a very difficult time for us all, mostly for him. When I would go visit him it was hard for us to have a real conversation. One thing he was able to do, however, was play Farkle. His lost most of his feeling in his dominant arm due to the stroke but could roll the dice and keep score with his other hand. It was really incredible to see him laugh and smile again, or sometimes get pissed and try to curse out his most recent roll. Whenever I would visit it became routine for us to play Farkle for as long as the visit allowed. I know it doesn't seem like much but for those few hours a week we were just brothers again being stupid and having fun. So, I wanted to make this game because of that. Granted it's been years and my brother is doing very well now, but I will never forget what Farkle did for us during that time.


me and my brother

Me and my brother after his stroke


Well that was tough to write. Anyway...let's get back to the topic at hand I suppose. Farkle, I did it. Mostly. I do still have to work on the styling of the app a bit more. Maybe add a light mode or some way to customize the color scheme, maybe I'll even do it so it can be different per player. I also want to add the ability to play it online against other people so I will probably also have to have a sign in feature or something like that, but that will come later when I start actually working with databases and start dipping my toe into real backend stuff. Okay, so the core part of the app is done, as in the scoring and the many MANY conditionals that come with it. I also want to play a few more test rounds here and there, but yeah for the moment it is ready to launch.


farkle main page

Screenshot of Farkle


This has been a journey. I learned more about coding in the last two weeks than I would care to admit. Well, I already knew some things about coding and arguably I already had all the tools I needed to do a project like this. The issue was that before this project I had virtually no structure. I would just basically throw ideas at the wall and see what stuck. I would jump from file to file, from component to component and element to element CONSTANTLTY. I would very rarely finish something completely before moving on to another part of the project. Worse than that, I wouldn't really have a plan on how to solve what I was actively trying to solve at that time. It was pretty much chaos. I know I spoke about this last week, but it really is night and day how I was coding a month ago compared to how I coded this. Also, I am not here trying to state that my code is perfect or anything, trust me I know it's far far from it. But I am saying that I proud of myself for how I went about doing this.


example of a farkle

How it looks when you Farkle!


Normally I would try to include code snippets in these posts. This time I wanted to try something a bit different. I just went and made my GitHub repo for this public so if you would like to see the code for yourself please go give it a look HERE!. I will be splitting off the main branch soon so that I can work on some more experimental features (I always wanted to say that), but the main branch will always be the most up to date version of the game.


There are a few things I would like to rant about before I go. So a few issues I ran into during this week. Multiplayer was one. I figured it would be simple to set up local multiplayer so two people can play in the same browser/tab. I did this by making different user states with React and making a player state that would hold an array of player objects. This was a bit harder than I'd like to admit. When I first sat down and attempted to work on adding multiplayer I had NO IDEA how to implement that. I hadn't really done anything like that before and I ran into error after error. Keeping things strictly single player is much simpler. Oh and when I first tried to get a muliplayer aspect to the game I tried by making an entirely new component just for multiplayer. This was not my best idea, as I tried to set new state in this component and bring functions back and forth between the new component and my main component. It became really messy and tough to manage. I will likely go back and break things up a bit later but if I can do something in my main component to keep things streamlined I will. Anyway, now that I have multiplayer implemented I would like to keep moving with multiplayer games in the future, or atleast have an option to switch between two or more players. I also did this as I am planning on making this game completely able to be played online and I thought this would be a good foundation for that. I am still not sure how that will go but you'll hear about that process when I get there.


I also learned another valuable lesson. It seemed that in being so meticulous with my code and really trying to break things down to the most simple parts and being so strict with my functions I actually kind of shot myself in the foot. This footgun came into play with the scoring functions that I was perviously so proud of. I thought they were foolproof and strong, and they were, but when I realized I had a gameplay issue with holding specific die I had to go back and actually make two of each scoring function. One for live dice, one for held dice. I then even had to go back into each scoring function and change them again when I added another attribute to my dice object. It got a little more tedious than it had to, but it was a very good learning experience.


I am far from done with this process. That means that yes, one day you will get a part 4 of making a dice game...I honestly thought this could be finished in about a week. Well...here we are...I will be taking a break from this game for a bit as I start to learn about databases and how to use them properly. BUT I will come back to it. Oh and the week week after next, me and my family are going away so I most likely will have to take a week off from this. The perks of being unemployed, am I right? Well that's it for now. I could definitely rant on longer than this, but I think you've read enough, please let me know if you have any questions about this process as I would be happy to share my experiences with you! Thanks for reading and I will be back soon with more extremely entertaining and well thought out content!


Until next time!
Craig

AKA: Virtual Sobriety