The LCTHW Weekly..ish Update #4
The LCTHW Weekly..ish Update #4
At this point these updates are Monthly but I've been busy on one more project that I want to finish in 2025. I'll be announcing this project next week so stay tuned for that.
You can read this email at:
https://learncodethehardway.com/emails/14-lcthw-weekly-update-4/
Year End 20% Off Sale
I'm running a sale on everyting until the end of the year. If you've been considering getting a course then grab it before year end. Also, if you know anyone who wants to learn to code then please send them this link:
https://learncodethehardway.com/courses/
This includes my Epic Supporter Pack, and that bundle is pro-rated based on what you've already bought. That means you can possibly get all remaining courses and any of my future courses (which I have one more announced next week) for a possibly very low price.
Learn C++ the Hard Way Updates
NOTE: There was a bug in the game-dev-starter-pack used in Exercise 1: Gearing Up. You should run
git pull
and run thescripts/setup.ps1
script if you're on Windows and that script failed before. If you're on any other platform then justgit pull
to update.
I finished the following exercises for LC++THW since last we talked:
- Exercise 14: while-loops
- Exercise 15: Basic Functions
- Exercise 16: Basic Containers
- Exercise 17: Classic for-loops
- Exercise 18: Range for-loops
This closes out a major section on looping before getting into input and output from the user before then getting into making your first game.
Blog Post: Rogue is The Best Beginner Project
This week's blog post is a modest proposal that making a little text based rogue game is one of the best beginner/intermediate projects you can attempt. The TLDR is that rogue removes most of the graphics so you can focus on the important algorithms that are in every game. It's also fun to interpret the text in fun ways. Give it a read if you're looking for a fun longer project to attempt in any language:
https://learncodethehardway.com/blog/33-rogue-is-the-best-beginner-project/
Roguelike Game Update
Related to the above blog post is some progress on my little educational project Roguish. As I said in the blog, this has been probably one of the most educational projects I've ever done. I've learned to implement a ton of game features:
- An Entity-Component-System
- An ECS is just a database, or kind of like the Model-Controller part of Model-View-Controller. I studied a bunch of ECS systems then wrote this one to be something simple anyone could study. It's not fast or has tons of features but has about 90% of what you need in a little Rogue game.
- A collision detection system
- In a Rogue game you don't allow entities to overlap, and everything fits in one cell so "collision" is fairly easy. I actually got this code straight from Google's AI answer so I decided to see how well it'd work. I had to modify it a bit to get it to work, but otherwise pretty good.
- An ANSI terminal code parser and graphical renderer for SFML.
- I'm using FTXUI to actually code the GUI, but I want to render it with SFML (or any graphics library) so I can push the "text only" design with as much graphical interaction as possible. To do this I create an ANSI Terminal parser with Ragel and then hooked into an SFML renderer. Once this is solid I'll be "extending" the ANSI codes to instruct the renderer to do other effects.
- A simple events system
- One thing I found was that the ECS system needed a mechanism to notify other parts of the game that something happened. Since I already had components I just added a way to queue up events sent to components into the DinkyECS. Here's where they're used currently to notify the GUI that certain things happened to an entity which needs a GUI update.
- A configuration system
- Nothing fancy, just a JSON config system that I'll most likely have to improve in the future. For now it works well enough to configure the game.
- A save file system
- It's definitely overkill but I used the tser serialization library to add serialization to all of the components that need it then it's a simple matter of serializing a SaveData structure to save a copy of the world. It's rough right now but seems to work, and eventually I'll study tser enough to replace it. Then again I could just blast the structs directly to disk but this is more fun.
- A map generation system
- Really rough but it makes some interesting semi-random maps already. There's a couple bugs and I'm making the maps way too large, but it's fast enough.
- A basic combat system
- Very simple combat system but easy to push farther once I have a concept of what weapons do and other elements of the combat.
The eventual goal for this project is a small enough game someone could study and replicate, and so far it's going pretty well. Most of the functionality above is written with very little C++ and in mostly straight forward code. If you're looking for something to study, just grab one of the above random files and try to understand how it works. Bonus points if you can make your own version of it in another language you already know.
Twitch C++ Streams
If you'd like to see me go through the process of making this game then come on over to https://twitch.tv/zedashaw and watch me live. It's a relaxed stream with mostly Classical, Jazz, or Ambient music. No drama, just good programming and a small group of people who like to code.
I'm aiming for a more "ASMR/Bob Ross" feel to my streams, so if you want something cosy and laid back that's what I want. I mean...assuming I don't get mad at C++ for random dumb stuff.
Got Any Job Openings?
Times are tough out there so I'm looking to collect links to jobs available for the next newsletter.
If you're hiring hit reply and drop me links to your openings. I'll only post jobs that meet the following criteria:
- Must post salary compensation.
- To prevent Ghost Postings (which should be illegal) you should list the number of candidates you've accepted in the last 30 days. If it's zero then you're posting ghost jobs.
- List location and whether you support remote work.
- Benefits must be listed as well, but I think that's dependent on the location and local laws.
If you've got jobs, I'm looking to help people find work, so send them on.
Insanely Useful Links For You
- https://github.com/eyalz800/zpp_bits
- A C++ serialization library I like because you can study it.
- https://github.com/KonanM/tser
- Another one you can study, but is aimed more at C++17 so not so many modern features. This is the one I eventually used and will replace in the near future (once I understand its magicks).
- https://gamegen-x.github.io/
- Very cool research project to use generative AI to generate many aspects of open world games. It looks like they're only generating videos for concepts rather than full game assets, so probably best for ideas and prototypes.
- https://aartaka.me/c-not-c
- An awesome blog post about abusing the hell out of the C macros until you make C behave like a nicer language. Sure to make the C purists out there die in horror while trying it out.
- https://sophiebits.com/2024/10/30/everyone-is-wrong-about-that-slack-flowchart
- Relates something I also thought about that infamous Slack flowchart that really it's just an overcomplicated smaller flowchart. Also, flowchart? Really?
- https://flutterfoundation.dev/blog/posts/we-are-forking-flutter-this-is-why/
- Looks like Google redirected most (all?) of the Flutter team to other projects so the Flutter Foundation is going to fork it and do the work they can't do. Honestly not sure why they didn't do this sooner.
- https://www.forceflow.be/2013/10/07/morton-encodingdecoding-through-bit-interleaving-implementations/
- Old post, and there's a series, but this is what I read to get some ideas for the simple collision detection I made. Really interesting how interleaving the bits creates a z-ordered list.
- https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3477r0.html
- Hold onto your ponies people, C++ is actually--and I can't believe they're taking such a huge risk--going to decide that a byte is 8 bits. I know! Think of all those Unisys programmers who will probably never update their code or compilers and how this will impact their code they never change! It's madness!
- https://github.com/chjj/blessed
- Want to make a TUI with JavaScript? Blessed is an awesome TUI library with some amazing features. Just check out the demo.
Thanks Again
I just wanted to say thanks to everyone who's supported me over the years again and I hope to see you at my streams. I really just do them because I want to hang out with more of you, so come on by. Until then, have a great day and I hope you're doing well.
More emails we've sent.
LCTHW Newsletter #7: Go is One of The Languages of All Time
LCTHW Newsletter #7: Go is One of The Languages of All Time
The LCTHW Weekly Update #6: July 8, 2025
The LCTHW Weekly Update #6: Free Upgrades to Some Courses Coming
The LCTHW Not-Really-Weekly Update #5: May 14, 2025
The LCTHW Weekly Update #5: Where I've been, and cool new stuff in my game development journey.
The LCTHW Weekly..ish Update #4
The LCTHW Weekly Update #4: