• Stars
    star
    331
  • Rank 127,323 (Top 3 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 3 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

bootable x86 snake game in rust

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.

But it's not just snake. Thanks to @MoZhonghua its now possible to add different games to the OS and to play them. So apart from snake you can also enjoy a round of 2048.

screenshot

Features

  • Play snake or 2048 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 226kB kernel size
    • You can even put this on a 8-inch floppy disk!
  • All the infrastructure you need to implement and play a game
    • You can implement your own game!

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.

Screenshots

welcome

2048

More Repositories

1

libbcrypt

A c++ wrapper around bcrypt password hashing
C
95
star
2

passchain

a blockchain based password store for teams
Go
27
star
3

stellarctl

the long missing stellar command line client
Go
24
star
4

jwtd

A single-sign-on JWT server
Go
12
star
5

btrfaas

btrfaas is trusch's function as a service platform
Go
11
star
6

libbson

A library for converting from and to BSON. Also contains a JSON parser/generator based on jsmn.
C++
8
star
7

stackctl

run compose files as rootless podman pods
Go
7
star
8

pki

A tool and library to manage public key infrastructures
Go
6
star
9

rkt-compose

a tool to quickly prepare and run rkt pods
Go
5
star
10

kv

kv is a encrypted and versioned command line key value store
Shell
5
star
11

restless

A model based api framework with Go and JS
Go
4
star
12

boltplus

a wrapper around boltdb supporting compression and result filtering
Go
4
star
13

deadman-switch

Go
4
star
14

frunner

frunner is a http server which runs executables
Go
4
star
15

kiltctl

commandline wallet for the kilt blockchain
Rust
4
star
16

jamesd

A universal packetmanager for heterogeneous fleets of machines with server side version control
Go
3
star
17

storage

a storage abstraction layer in golang
Go
3
star
18

susi

SUSI is a Universal System Interface
Go
3
star
19

caddy-extauth

an external authentication plugin for caddy
Go
3
star
20

authy

authy is a generic JSON Web Token signing service
Go
3
star
21

gitr

gitr is a branching model (and tool) for managing software variants in git repositories
Shell
2
star
22

stellar-market-analyzer

Go
2
star
23

Bro-Chat

Lightweight serverless chatsystem for local networks. Keep the bro's connected ;)
Go
2
star
24

opencore

opencore is the core of your next project
Rust
2
star
25

oqs-cli

a commandline tool to play with quantum resistent algorithms
Go
2
star
26

namegen

random name generator
Go
2
star
27

rson

The RSON data format
C++
2
star
28

pkid

a server for centralized management of public key infrastructures
Go
2
star
29

merkle-tree-rs

Example implementation of a binary merkle tree
Rust
2
star
30

jira

mini tool to show my current jira tasks
Rust
1
star
31

vpntool

A tool to quickly setup and deploy a VPN infrastructure
Go
1
star
32

streamstore

Go
1
star
33

eventsender

a golang http client for sending multiple events via one request
Go
1
star
34

eve

Eve is a Virtual Entrypoint
Go
1
star
35

sha3

simple command line tool to handle sha3 hashes
Go
1
star
36

trusch.io

content of trusch.io
Shell
1
star
37

es6-project-template

JavaScript
1
star
38

labelselector

handwritten parser for k8s labelselectors
Go
1
star
39

horst

Horst is a stream mining framework
Go
1
star
40

ringbuffer

Rust
1
star
41

state-server

Go
1
star
42

spaceships

Rust
1
star