Saturday, November 6, 2021

Hands-on Rust by Herbert Wolverson Part 1

 

I've been chasing the Rust programming language for well over 4 years now. The language, to me, feels complex but in a fun and rewarding way. Previous languages that I've worked with have done their jobs respectfully but have never felt they are special. The easiest way I can equate it is:

I have a hammer and I use it for hammering nails. I use that hammer and I put it away, done. Most languages I've used have felt like a hammer.

Rust feels like using I'm using my workbench and all the tools on it. I'm not just mundanely pounding with a hammer or drilling with a drill. I am giving thought to what I'm creating, using different tools in their proper manner, and finally have created something that works as intended.

Less about my general rust adventures though and more about "Hands-on Rust, Effective Learning through 2D Game Development and Play" by Herbert Wolverson. I had worked on Wovlerson's previous RLTK tutorial way back in my earlier stages of playing with Rust and trying game development. Games have always been a passion of mine, but I never realized how hard it actually was to build a game. I've written dozens of enterprise applications for business class services but have yet to create a single game...I've come close!

Hands-On Rust takes similar concepts from the RLTK tutorials but cleans it up and polishes it in book form. Additionally, the RLTK tutorials focus on his libraries and roguelike game development, where as Hands-On Rust instead tries to bring you along with general Rust language concepts as well. This is both rewarding and mildly taxing depending on your skill level. A few times I've had to force myself to go back and focus on what he was explaining because I chose to skim and transcribe the tutorial pieces. I did this because I had the Rust knowledge that was being explained, however I was losing out on the game concept knowledge he was also conveying.

The chapters are very well organized and work you through many concepts of programming. A few times he has you do mild refactoring which is good. This is a concept that is always necessary in development but not necessarily developed.

ECS (Entity Component System)

The biggest reason I bought this book was because of two main concepts he conveys to you through the chapters. ECS and minimalist game development. ECS is a new(er) style of game engine development meant for decoupling Entities (things that have components), Components (the attributes that entities posses) and the Systems that dictate what Entities and resources do. The ECS engine that Wolverson uses in this book is Legion ECS, which is part of the Amethyst project. There are various comparisons out on the web of different ECS's. The reason I lean towards Legion is its ease of use. I played with Legion prior to learning about this book and was able to do some really cool things incorrectly. After reading through about half of the book I have a much more solid foundation to use to go back and rework my little simulator I was creating.

The joy of ECS is that you can expand your game without major refactoring efforts. Object oriented game engines require frameworks for inheritance which can potentially translate to unintended consequences if you add new features. ECS assumes that all things are considered individually and that you act upon only the things you care about. This means that if I add features to a player Entity, say I care about their height and weight now, the Systems act on the player character will not care about the height and weight until I specifically tell the Systems about it. Adding height and weight in object oriented approaches means that these values could unintentionally be accessed because they are now made available to all things that inherit the "Player" object.

Minimalist Development

Another joy of this book is that Wolverson introduces how to use his libraries to build out games in a way that modeling and testing ideas is not a major endeavor. Prototyping ideas and expanding on them are easy when you have the basic building blocks to model with. Wolverson's Bracket-lib Rust library leverages all sorts of different ASCII, 2D, 3D toolings, however you're not required to dig deep into the graphics and design requirements to get started. To me this is very important. I have notebooks full of game ideas but I struggle with the larger engines and the need to be a "completionist" with my ideas. This happened with Godot, which is an engine I also enjoy thoroughly. I struggled with Godot though because of the indirect ability to use Rust which seemed more complicated than jumping to Godot's native language or C#. Not that I couldn't use those languages, I just don't want to.

Bracket-lib fills a perfect niche where an idea can be born and developed, shared, tested, and eventually grown into something larger. Using ECS and Bracket-lib, along with the guidance from Wolverson's book, enables basic and advanced developers to create as individuals without the need for a larger production effort.

Final Thoughts

The one thing I would wish more from Wolverson is more accessibility to a side-by-side of the book and online code. This may be a timing or work/effort issue. An example is that the RLTK code and examples are extensive and very thorough, in a sense I don't even need a book there. This does not necessarily translate financially for Wolverson and we all need to be rewarded for our labors, especially labors of love. Wolverson's RLTK/Specs documentation is especially complete. His documentation for Bracket-lib and Legion is somewhat sparse. I am taking for granted that I am not the one that has to maintain either of these efforts and he is only one man. Maybe my take away from this should be expanding his Bracket-lib/legion examples with what I've learned from his book and pushing that to him to review.

Thank you Herbert Wolverson!

Edit:

This will be a multipart post as I want to revisit the topic when I finish the book. I'm about half way through it now.

Thursday, October 28, 2021

A Super Market Store Does an Awesome Thing

We generally shop at Giant Foods because we like the selection. Ever since the pandemic we started ordering our groceries online through the Giant Foods app. This process has stuck with us because it saves us so much time. Normally a grocery shopping trip for a family of four takes us roughly 2 hours from start to finish. This includes driving, shopping, paying, loading, and finally unloading. Using the app it takes us minutes and then time to unload when the delivery arrives. The time we save we put, financially, towards the tip for the driver.

We could never tell if we were doing worse or better with the plastic bag situation. In some cases we ended up getting more bags which was frustrating. The online delivery would give us a single bag for an onion, as an example. Recently though the deliveries started showing up with compost-able bags! At first I assumed them to be the "industrial compost" only bags which means they go into our recycling and probably get thrown out. However these bags were different, they had stated they were compost friendly for home composts!

I have taken these bags and mixed them with my compost pile and will continue to track the efforts here to see how well they do.



Sunday, October 10, 2021

Manjaro Day 4

I've been really excited about using Arch Linux's Manjaro and things have been going well. No Man's Sky installed easier and runs better with Steam's tool set.

The challenge now that I'm trying to resolve is the mouse. My mouse is a Logitech G300s and it just feels...off. I can't place what exactly is happening but I find that its harder to actually click on small or exact locations. It feels like the mouse is over-sensitive which may be the case with the default interface loaded with Manjaro. I have not found another form of drivers or even logitech specific drivers for my corded mouse.

My hunt will continue into the xinput library and see if there's a way to treat the read bit rate and lower it so the mouse is not as sensitive.

Wednesday, October 6, 2021

First Night With Manjaro

I intended to try installing a Steam game sooner but was interrupted by a snake sneaking into our house. Fortunately for us a sticky trap caught before it could get to where it wanted to go. After some olive oil and patience, its unstuck, inside a plastic bin, where it will hang out until I release it far from our house tomorrow.

Tonight I wanted to test No Man's Sky on Steam in Manjaro. I had to enable the Steam Play feature in Steam before it would allow me to install the game. This is found under the Steam menu button at the top -> Settings -> Steam Play and "enabling Steam Play for all other titles." After a quick restart of steam, I was able to then install No Man's Sky.

The installation is proceeding like it would in a Windows environment, I'm typing this up as it downloads all the necessary files....Maybe I'll go check on the snake while I wait.

The installation went off without a single issue. I didn't even have to deal with those annoying additional dot.net installation requirements! The game loaded with the same speed as my Windows installation and runs just as well, if not a tad bit better frame rate.

Tuesday, October 5, 2021

Tonight It Starts

I played around with Arch Linux and I liked it enough that I'm going to go with Manjaro Linux. There's just a snappiness and crispness to Arch based distros that I really appreciate. There is solid NVidia driver support as well as straight forward ways to install Steam. I'm backing up my data now to prepare for full flat wipe and re-install.  I am installing the Gnome 21.1.4 release because I know Gnome the best.

Dear Windows,

It's been fun but, you're just not who you used to be though! We've both changed but I feel I've changed for the better and you're just, well, still the same with regards to lack of concern for user experience and security.

Monday, September 27, 2021

MeatRetreat and Distro Selection

Just spent the past four days with my buddies out in West Virginia. We all met at a cabin and essentially disconnected from cell service and the Internet in order to play video games and board games! The cabin was amazing and the event was awesome. 

What started out as a joke in our Discord server soon became reality. Because of the pandemic my friends and I found ourselves expanding our network of friends using Discord. Because of this I thought it would be fun to suggest maybe a retreat of some sort. This ended in laughs and fun ribbing but in the end it proved to be an awesome idea.

We played games like Dice Throne, Captain Sonar, Villagers, Magic the Gathering, Chess, Texas Hold'm. Everyone brought what they wanted to play and we gave tons of games a shot. 

However, that gave me little time for doing more research on distro selection. I did give it some thought on the way home and my course of action is going to be this:

My main PC will be Pop!_OS and my laptop that I hack around on (where this post is coming from) will be Arch Linux. I really feel that Arch is a good intermediary step to better understand the nuances with the linux environment. If the Steam Deck is really going to be all that it is sounding like it is, knowing the Arch structure and ecosystem will be important to taking full advantage of the hardware to do more than just playing Steam games!

Wednesday, September 22, 2021

Steam Deck

One of the intriguing thoughts about using Arch Linux as my primary distro is that it would prepare me for my Steam Deck when its released. This device is going to be more than just a way to play Steam games. I believe Valve is really stepping up to make a major evolution in the gaming industry and open up a new market for developers. 

Since the Steam Deck uses Arch Linux as its underlying system, knowing the inner workings of the setup can potentially unlock more advanced features or use cases for the console.