Demilade Sonuga's blog

All posts

Prologue

2022-10-20 · 8 min read

Last Edited: 2023-07-17

Hello there.

We're about to go on a fun ride, an adventure, an ecstatic experience.

But before we do, I would like to introduce myself and what this is all about.

I'm Demilade Sonuga, a computer science maniac addicted to code. A few months ago, I had an idea of building a game from scratch in my favorite language, Rust. I spent the next 3 months doing just that and this was the outcome:

GamePlay

This is a sorry excuse for a game according to modern-day standards, but I had a lot of fun building it. For the full source code, check out the repo. When I started with this project, I had a lot in mind that I wanted to do which I didn't end up doing, mainly because of time.

What comes after this post is going to be a series of tutorials that goes through the creation of this project for x86_64 machines with UEFI firmware. The only external libraries we'll be using are the Rust core library (because without this, Rust wouldn't be Rust) and the compiler_builtins library (because the Rust core library depends on it).

Assumptions

These tutorials assume some familiarity with basic programming concepts (iteration, recursion, pointers, ...) and basic Rust concepts (ownership, references, lifetimes, ...). They are meant for the somewhat "intermediate Rust beginner" (forgive me for my ambiguity but I think you should get the point).

I'm developing this on a Linux Fedora 36 system, so there will be quite some code samples written with the assumption that the reader is on a Linux-based system.

The Plan

My plan for these tutorials is that they should be able to take a Rust beginner from starting this project to finishing it and understand everything involved in the project's creation.

This is my rough roadmap/guideline for the posts that will be coming up:

  1. Prologue
  2. Getting Started I: The basic setup and configuration
  3. The computer startup process
  4. Getting Started II: Printing hello world
  5. Modeling UEFI components
  6. Printing hello world again
  7. Bitmaps: understanding them, loading them, drawing them
  8. Animating bitmaps
  9. Interrupts, event handling
  10. Some math
  11. Sound
  12. Epilogue

Please note that this roadmap doesn't necessarily have a one-to-one correspondence with posts. Just one of them can be three posts, three can be one post. And you shouldn't expect posts to have the same names as the items on this roadmap. This just defines a rough order in which you can expect ideas to be presented. Along the way, there will also be a lot of detours to understand concepts that will (again, hopefully) deepen understanding of the code.

Since this is just the beginning of the blog, I would like to get up to speed quickly. You can expect to see at least one new post every three days.

At the end of every post will be a very (hopefully) brief summary (takeaway), references that will contain links to external sources that I used and a brief description of what the next post will be about.

The Code

All the associated code for each post is in this repo. The code for a post will be in the branch with the post title.

Contact Me

If you have any questions or inquiries, or if you would like to reach out to me in any way, feel free to send me a mail (sonugademilade8703@gmail.com) or you can message me on Twitter at @d_sonuga. Any feedback will be much appreciated.

This tutorial series is inspired by Philipp Oppermann's Writing an OS in Rust.

WARNING: This blog series is a first draft. Some posts are unclear. Some are messy. And there may be some bugs here and there. I hope to resolve all those problems soon. Please, if you encounter anything you consider a problem, tell me about it.

DISCLAIMER: I am not a professional game developer, nor do I have any experience in game development. This is a pure "for fun" project, so you doing anything specified here in a production scenario will probably be a bad idea. Our sole purpose for being here is to have fun.

Alright, enough introduction. Now that we're on the same page, let's start moving.