Skip to content

A step-by-step example showing how to make a Linux game from scratch with x86_64 assembly and C99 without libc.

Notifications You must be signed in to change notification settings

permutationlock/DumbCycle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

DumbCycle

A commit-by-commit (hopefully) instructional example of how to make a game using the dumb frame buffer interface of the Linux Direct Rendering Manager. The entire game is ~1000 lines of C99 code with a small x86_64 assembly runtime. No libraries or preprocessor directives were allowed, even libc.

The intent is for a reader to step through each commit, starting from a basic executable and building up to a double buffered snake/LightCycle game. I also wrote an article going through the development step-by-step.

Requirements

In order to build the game on an x86_64 Linux machine you will need a C compiler that supports the C99 standard along with make and binutils for the as assembler and ld linker.

To run the game you will need a working /dev/dri/card0 device and a working keyboard device in /dev/input/, and the game must have permission to access these files. The game will take over an entire display as well as the system keyboard, so it will be necessary for you to turn off your window manager/compositor if you usually run one.

make
sudo ./dumb_cycle

DumbCycle

You can also run the game in a virtual machine if you install QEMU and tiger vnc.

make test

The command will download a vm.tar.gz zip file containing a Linux kernel and a basic initial ram filesystem using toybox for a simple shell environment. If you want to build the kernel and toybox yourself a corresponding vm_src.tar.gz is provided.

References

About

A step-by-step example showing how to make a Linux game from scratch with x86_64 assembly and C99 without libc.

Topics

Resources

Stars

Watchers

Forks