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.

Monday, September 20, 2021

Application Considerations

I was notified by Google today on my Windows machine about an update to Google Drive and how they are changing over to a new version. This got me thinking about all the secondary applications I use that I didn't think about. So I've compiled a non-complete list below:

  • Google Drive

  • Dropbox

  • 7zip

  • Discord

  • Zoom

Hmm, now that I look at the list, its a lot smaller than I thought. I have purposefully not added applications that I know will be available such as Visual Studio Code, various programming language SDKs such as Python, Rust, Java. Video editing and image editing are native to Linux.

Office applications are through Google. I left the Microsoft office product eco system years ago when I was no longer a student and then had to pay the fees to write word documents.

Sunday, September 19, 2021

Pop!_OS and NVidia

It should be noted that Pop!_OS offers 2 downloads, one standard and one with NVidia drivers packaged. Windows users may not care much of this but this is significant. One of the largest frustrations with transitioning to Linux or even operating Linux is a graphics driver failure. For those not accustomed to the command line, doing a driver upgrade/installation and having it go wrong could end a user up in the console with no immediate recourse for a fix.

Ubuntu does provide NVidia drivers, however they need to be enabled in the settings as a 3rd party driver.

It's still a three way mental gymnastics between Ubuntu, Pop!_OS, and Arch Linux. Right now Pop!_OS and Arch are the front runners with a heavy lean towards Pop!_OS. The ease of access to software, drivers, and enabling games from Windows makes Pop!_OS more intriguing. However the sheer snappiness and responsiveness in Arch Linux still makes it very appealing. Sometimes its also good to just know that there isn't a whole bunch of crap installed along with your operating system. Arch gives you this very minimalist setup that helps reduce software bloat.

Saturday, September 18, 2021

Linux Versions

In Criteria, below, I alluded to determining whether Ubuntu or Arch would be the ideal distribution  of Linux to use. In the fast few days, as I dig further into the benefits of both, I've come to realize, there is a third distro I should consider. Pop_OS is a version of Debian maintained and curated by System76. I've used this distro in the past with some work laptops and enjoyed it, however because they were work laptops, I really could not take full advantage of the OS and its market space.

Of all the distros I am most familiar with, Ubuntu is the most. I've used this distro since before release 10 and have seen it grow and mature. The primary focus of this effort for me is to be able to continue my gaming on my PC though, and the more I read, the more Pop_OS sounds positioned to support it the most "out of the box."

Some of the games I'll be evaluating in this experiment will be No Man's Sky, Magic the Gathering: Arena, and Battletech. Two of the three are available directly through Steam so we will see how they are handled with Steam's Proton overlay. Magic the Gathering: Arena or MTG Arena will be a bit more of a challenge. MTG Arena is distributed directly and will require some sort of secondary support like Wine and/or Lutris.

Wednesday, September 15, 2021

Criteria

My majority personal use of Microsoft Windows is for gaming. Through the years the gaming services have become advanced, consider Steam for example. They've developed consoles leveraging Linux and tools like Wine. This leads me to believe that, if anything, I can get the core games that I enjoy working within a Linux environment, hopefully with minimal effort.

The graphics card in my computer is an NVidia card (but who's isn't amirite?) so managing the graphics card also needs to be easy. I can't have the GUI I chose suddenly bonk out on me cause of a driver update.

Finally there needs to be easy access to install software, whether from a market place or directly from a vendor. Essentially this limits me to Debian or Redhat package manager (RPM) distributions. I lean more towards Debian as its the OS I know better, the question is do I go with raw Debian or Ubuntu? Ubuntu has to be, by far, the most supported and well rounded distro I can think of. If I were to suggest to someone to try Linux, I would suggest Ubuntu. I work with Redhat at work and I've tried Arch Linux (which impressed me with its sheer speed and responsiveness on my older systems.) 

Redhat is not an option for home though considering there's a fee for service with the solution. Arch Linux is a strong possibility but there's much to take into account if I'm going to use this as my distribution. There is more work in Arch to get things up and running compared to a Debian distro, but I am going to ponder it over the next couple of days. As I said before, I was very impressed by the speed and responsiveness of Arch Linux.

Tuesday, September 14, 2021

An Acceptable Challenge

 
I've thrown the gauntlet down, more so to myself than at others. After administering and using Microsoft operating systems for many years, I've never truly cut myself away from the operating system. See there's a very strong hold on Microsoft's ability to provide a gaming platform, AKA Windows. Steam has recently changed this playing field as well as the explosion of indie developers that do not want be held to AAA game engine standards and publisher requirements.
Windows 11 is released Oct 5, 2021. At that time I will wipe my hard drive and install Linux. I'll cut myself from Microsoft completely and see how it goes, documenting it all here.
I will provide information about potential distros and build details as I start to figure them out.
The purpose of this effort is not to malign Microsoft or Windows. The recent discussions about Windows 11 though have made this effort all the more viable as I look to leave that ecosystem to something more freeing.