survivor

graphical action game for the linux terminal
git clone https://git.ce9e.org/survivor.git

NameSize
.gitignore8B
Cargo.toml203B
README.md3968B
img/axe.ppm4250B
img/bat.ppm3811B
img/bat2.ppm4065B
img/crawl.ppm4746B
img/diamond.ppm5199B
img/eye.ppm4547B
img/ghost.ppm4567B
img/hood.ppm4203B
img/hood2.ppm3825B
img/knife.ppm3968B
img/mummy.ppm4364B
img/plantguy.ppm4316B
img/player.ppm4203B
img/raddish.ppm4188B
img/shadow.ppm4137B
img/skeleton.ppm4013B
img/skeleton2.ppm4393B
img/snake.ppm4348B
img/star.ppm4043B
img/wind.ppm4422B
img/zombie.ppm4011B
ppm/Cargo.toml83B
ppm/src/lib.rs1705B
screenshot.png36859B
src/enemies.rs3761B
src/game.rs12904B
src/input.rs1324B
src/main.rs4492B
src/random.rs1042B
src/sprites.rs1275B
src/term.rs4291B
src/weapons.rs3616B
src/win.rs3851B

Survivor

screenshot

Survivor is a graphical action game for the Linux terminal. It is havily inspired by Vampire Survivors.

The player controls an automatically attacking character, with the goal to survive for as long as possible. At the start the character's only weapon is a shield that damages nearby enemies. Killed enemies drop diamonds that can be collected to gain XP. When the blue XP bar at the top of the screen is full the player receives a random perk:

Installation

The game is written in rust and does not have any dependencies outside the standard library and libc. You can run cargo run to build and execute it.

Controls

Artwork

The sprites are based on artwork from Vampires Dawn 2.

FAQ

Why did you do this?

I had wanted to create a graphical action game for the terminal for a long time. This kind of game felt like a good fit for the particular restrictions that come with the terminal.

Also, Vampire Survivors takes a full minute to load and then full saturates the CPU on my laptop, even in the menu. I wanted to prove to myself that that is not necessary.

Why does the character not stop when I release the movement keys?

Terminals do not have a concept of key release events. That is actually a major reason why it is so hard to create games for the terminal. There are proposals to add proper keyboard events, but so far they have not gained much traction.

Why are there so many graphical artifacts?

Each cell of the terminal is subdivided into 2x3 pixels. This way we can get a decent resolution. However, each cell can only have two colors. Artifacts happen when the game tries to draw more then two colors into a single cell.

I get a bad frame rate. Is there anything I can do?

The game is designed to run on 30fps. The amount of computation that needs to be done scales with the size of the window. So if you get a bad frame rate, there is a good chance that it will improve if you reduce the window size.

Things are stretched in one direction, circles are ovals

The aspect ratio of pixels depends on the font. You can adjust win::ASPECT_RATIO to compensate for that.

Brief tour of the code

Most game logic is expressed as f32. Positions represet the logical center of objects. When drawing to the screen, the f32 positions are converted to usize pixels. Game logic is mostly independent of pixels though. The only exceptions are that enemy spawn and despawn outside of the screen, so they depend on the screen size.

TODO (patches welcome)