Royfuss Games 3.0
I am always improving my Python skills. Recently, I read through Beyond the Basic Stuff with Python, which serves as a nice sequel to Automate the Boring Stuff with Python. Both are by Al Sweigart, and I recommend both if you want to get into programming with Python. A lot of programming books are heavy on math, but these books are more focussed on practical automation. I appreciate this approach.
Beyond the Basic Stuff made me realize I have developed a lot of bad habits. Python is a very readable language, and it is very forgiving. It’s great, but my code is only readable by me. Reading Beyond the Basic Stuff showed me inefficient code snippets I used as “go-to’s.” I decided it was time to refresh my Python scripts for Royfuss Games. This time, do it in a way where I don’t feel ashamed to show my code to other people.
I rebuilt my original 18 python scripts from the ground up. I aimed for two goals. One, make the code readable. Two, make the code efficient. Ruff is the perfect tool for making my scripts readable. It is a linter and a formatter. The linter picks up errors in my code that just running the script might not find (the lint). For example, it found when I created a variable and never used it. It finds so many of these small things, and does a great job at it. As a formatter, it really helped me stick to PEP 8 styling standards. This found really long lines, and recommended ways to shorten them. Also, it made sure I stuck to using double quotes instead of single quotes for strings. I ended up condensing all of my Python scripts down to 14 scripts. I re-wrote over 12,500 lines of code.
A big reason for the re-write was to make some updates to Royfuss Games I have been wanting to make. The number of changes became significant, and so I dub it “Royfuss Games 3.0.” You can view them now, here!
You probably won’t notice any changes on the home page or the about page. However, you might notice “Played” is missing from the navigation. I decided to get rid of the page, since the Journal does the same thing, but with more detail.
Search looks the same, but I made some changes under the hood. Selecting “Platforms,” “Stores,” or “Launchers” returns the same results, but I made it more efficient. Before, searching for a game name only searched in the main game name field in my database. Now, it searches obtain names and played names. You can search for “Valhalla” and it will return “God of War Ragnarök.” This only works if I entered DLC separately as a session or if I purchased it separately. So, searching for “Assault on Dragon Keep” won’t return “Borderlands 2,” because I bought that DLC as a season pass. Still, it is a big improvement.
The Data pages pushed me to make a whole new version of the website. The old Python scripts would spit out CSV files, and I used those to create the charts. I had to do this manually in Excel. This took too muich time, so I did not do it very often. The new scripts automatically generate the charts for me. On top of that, I was able to customize the colors to make them match the website’s theme. I am happy with the results.
I decided to tweak how to interpret the data on the Data pages. On the Owned By Release page, I used to count game copies owned. So, Super Mario World was counted three times since I owned a physical copy, Wii copy, and WiiU copy. Now, it is counted as one game. It is something I went back and forth on, and I still don’t know if I like it this way. I did a similar thing with Owned By Platform page, but it is also messy because of the PC launchers. In this case, the first “Overall” chart has a lower PC count than the “Total PC Games” chart count, since I own games across multiple launchers.
The Obtained By Year page is mostly the same. However, Played By Year is significantly different. Before I had two pages: before 2015, and after. Now, they are combined. I added achievement count into the data, which created a bunch of fun scenarios where I did not have any play hours, but I had achievements. This happened for various reasons, and they were annoying to figure out. I ended up adding a bunch of comments under several of the years to explain the numbers.
The Games By Status page is pretty much the same. I need to go through the list again and decide what games I actually want to play.
The Top pages are mostly the same. I did change the criteria for games where I have earned all of the achievements. I decided to only include games with all achievements unlocked for the entire game or just the base game. I have excluded DLC now. It was weird seeing Burnout Paradise Remastered on the list because I got all of the achievements for the Party Pack DLC. Otherwise, the rest of the pages are the same.
The overall Achievement pages are a little different. I added a background visual to each game row that is based on the percentage of achievements earned. I think it adds a nice flare to it. The Achievement pages for each game are the same.
I stream lined each Game page. I got rid of “NA” from each page; I kept it for tabular data, like unknown archive hours. I tried to replace it with more natural language, like “unplayed” or “unknown.” Sometimes, I just eliminated the field. It makes the pages look and reader nicer.
I made other significant changes. I updated Pico CSS. I whittled my own CSS file from almost 1,000 lines down to a little over 600. I obliterated PHP from the website. All pages are now basic HTML files. I had to update links on the blog, but I think I got them all. I’m very satisfied with the results.
I wanted to change my Royfuss Archives site to HTML only, too. I did not completely re-write every script like I did with Royfuss Games, but I did do the main script that outputs the website files. I re-wrote over 2,800 lines of code for that. The most important thing I did was document everything. Every time I added a post to the main blog, I had to remember which scripts to run and in what order to get Archives updated properly. That is now fully documented, as well as some details in each script. This will help when I make any changes in the future.
I started all this right after publishing Games of 2025, and just finished yesterday. It was a solid month of work. It is nice to have it done, but there are a few web design things I still want to do. I wanted to do a complete re-write of the Archive scripts, including adding automatic uploading. However, I knew I was going to be tired of writing code after Royfuss Games, so it was out of scope for now. I want to convert the Games of Appendix and Games of Remaster pages to HTML only. At the same time, I want to update those posts with additional data and formatting. I think this will be the next project I tackle, but I am done for now.
I thought I was ready to play some video games, but Donkey Kong Bananza gave me motion sickness yesterday. I am hoping things will be different today. I’m going to give it a try. Bye.