bootable x86 snake game in rust

Overview

SnakeOS

This is the game snake, bootable on a x86_64 CPU, written completely in rust. Its foundation is following the very interesting Writing an OS in Rust blog which I would recommend everybody who is interested in this kind of stuff.

screenshot

Features

  • Play snake on any x86_64 CPU
    • Let's have fun!
  • Dynamic memory management
    • The snake can grow!
  • Interrupt handling
    • We can read the keyboard!
  • Async/Await support
    • We can update the world and read user input at the same time!
  • Only 212kB kernel size
    • You can even put this on a 8-inch floppy disk!

Build it

Use the Makefile to build the game. The only dependencies are podman and buildah which are used to setup the build environment.

make snakeos.img

This will first setup a build container with the necessary dependencies and then build the game.

Alternatively, you can use the rust compiler directly with some tricks applied:

rustup override set nightly
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add llvm-tools-preview
cargo run \
    --release \
    --target x86_64-custom.json \
    -Zbuild-std=core,alloc \
    -Zbuild-std-features=compiler-builtins-mem -- \
        --no-run
ln -sf target/x86_64-custom/release/boot-bios-snakeos.img snakeos.img

To now run the game, you can use the following command:

make run

which will actually run qemu-system-x86_64 --enable-kvm -drive format=raw,file=snakeos.img for you. From here you can use either w, a, s and d or the arrow keys to control the snake.

You might also like...
2d Endless Runner Game made with Bevy Game Engine
2d Endless Runner Game made with Bevy Game Engine

Cute-runner A 2d Endless Runner Game made with Bevy Game Engine. Table of contents Project Infos Usage Screenshots Disclaimer Project Infos Date: Sept

A game for the game jam
A game for the game jam "1-Button Jam 2021"

One click ninja A game for the game jam "1-Button Jam 2021" written in Rust with the Bevy engine. A rhythm game, where you play a soldier that can def

My first attempt at game programming. This is a simple target shooting game built in macroquad.

sergio My first attempt at game programming. This is a simple target shooting game built in macroquad. Rules Hit a target to increase score by 1 Score

A game made in one week for the Bevy engine's first game jam

¿Quien es el MechaBurro? An entry for the first Bevy game jam following the theme of "Unfair Advantage." It was made in one week using the wonderful B

A Client/Server game networking plugin using QUIC, for the Bevy game engine.
A Client/Server game networking plugin using QUIC, for the Bevy game engine.

Bevy Quinnet A Client/Server game networking plugin using QUIC, for the Bevy game engine. Bevy Quinnet QUIC as a game networking protocol Features Roa

Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game
Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game

Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game. Home - Docs - Twitter - Discord 👾 Features Everythi

Simple retro game made using Rust bracket-lib by following "Herbert Wolverson's Hands on Rust" book.

Flappy Dragon Code from This program is a result of a tutorial i followed from Herbert Wolverson's Hands-on Rust Effective Learning through 2D Game De

A Rust wrapper and bindings of Allegro 5 game programming library

RustAllegro A thin Rust wrapper of Allegro 5. Game loop example extern crate allegro; extern crate allegro_font; use allegro::*; use allegro_font::*;

A refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Comments
  • README.md: add missing touch instruction for native build

    README.md: add missing touch instruction for native build

    Hi, very cool project! I've added a missing touch instruction to the instructions for building without docker. Otherwise they worked like a charm. I also had to increase the loop from 10000 to 1000000 (100 fold) to actually see the "welcome" message but probably the nicest fix for this is to implement a timer interrupt (didn't read enough of the code to see if that is already done).

    Alon

    opened by alonblade 4
  • Add game 2048

    Add game 2048

    I once followed "Writing an OS in Rust" blog but didn't find out how to build some interesting somethings based this blog. You did a great job, and following your steps, I made game 2048.

    screenshot: 2048

    opened by MoZhonghua 1
  • Boot from usb stuck at

    Boot from usb stuck at "booting (first stage)"

    I copied the image to a USB dongle with

    lsblk # to identify the device "/dev/sd..."
    dd if=snakeos.img of=/dev/sd...
    sync
    

    but booting from USB just gets stuck at Booting (first stage) seemingly in an infinite loop

    opened by shadiakiki1986 0
Releases(v0.1.0)
Owner
Tino Rusch
Tino Rusch
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
Reimplement the classical Snake game in Rust

Reimplement the classical Snake game in Rust Build cargo build Run cargo run Feedback All kinds of feedback are welcome! Feel free to give me any advi

null 1 Jan 25, 2022
Terminal-based Snake game written in Rust without dependencies (for educational purposes).

RustSnake This is a simple terminal-based Snake game implemented in Rust without dependencies. To start the game type cargo run. Control the snake usi

Florian Wickert 88 Jan 6, 2023
Classic snake in RUST!

rusty_snake Classic snake game built in Rust using Piston Window. Running the game Requirements Rust Cargo Steps to run git clone https://github.com/c

Dev Sharma 2 Nov 3, 2021
Solana Game Server is a decentralized game server running on Solana, designed for game developers

Solana Game Server* is the first decentralized Game Server (aka web3 game server) designed for game devs. (Think web3 SDK for game developers as a ser

Tardigrade Life Sciences, Inc 16 Dec 1, 2022
Victorem - easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust.

Victorem Easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust. Example Cargo.toml [dependencies] vict

Victor Winbringer 27 Jan 7, 2023
2-player game made with Rust and "ggez" engine, based on "Conway's Game of Life"

fight-for-your-life A 2-player game based on the "Conway's Game of Life", made with Rust and the game engine "ggez". Create shapes on the grid that wi

Petros 3 Oct 25, 2021
A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works

rustetris A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it tech

Eric G 3 Oct 15, 2022
Wasm game of life - A Rust and WebAssembly tutorial implementing the Game of Life

wasm_game_of_life Conway's Game of Life in Rust and WebAssembly Contributing | Chat Built with ?? ?? by The Rust and WebAssembly Working Group About T

Rust and WebAssembly 236 Dec 24, 2022
Conway's Game of Life implemented for Game Boy Advance in Rust

game-of-life An implementation of a Conway's Game of Life environment on GBA. The ultimate game should have two modes: Edit and Run mode which can be

Shane Snover 1 Feb 16, 2022