Flag-Matcher - a fun flag game that runs in your browser - Devlog 4
(How I spent 2 hours trying to fix a bug that did not exist)
I thought I had discovered a bug in my browser game about flags. The game uses a seed system to generate random challenges as well as daily challenges.
So yesterday, I tried taking the daily challenge and opened the website right around midnight. But, to my surprise, the challenge was the same one as the day before..
After panicking quite a bit, I tried to find the bug. I think I spent like two hours in total trying to find it. But, just as I was about to rewrite the code, it hit me: Maybe I opened the site right before 0:00 (like probably two seconds before). My PC’s clock is a bit out of sync so that was most likely the cause of it all.
But fixing imaginary bugs wasn’t the only thing I did that day as I then changed up the scoring system a little bit:
Previously, I just simply took the difference of the target and the guess HSL values and put them in a non-linear formula. This kinda sucked because HSL works like this: A hue of 0 is the color red, BUT a hue of 359 is also red (kinda like a circle). So, as you can probably guess, that lead to some weird scores in the past.
To fix it, I now convert the HSL to RGB values, take the difference of those and then calculate the scores. I added two parameters to tweak the algorithm: punishFactor and curveFactor. The higher the punishFactor, the harder the game will be and if you lower the curveFactor, it will be more forgiving for close guesses.
Those modifications should make the scoring system feel way better now.
Planned additions for the next day:
- Mobile version
- Finally fix some of those buggy flags
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.