Split documentation into multiple files and document gameplay

master
Elias Fleckenstein 2021-06-14 11:10:58 +02:00
parent 3432efe823
commit a084f521e9
4 changed files with 101 additions and 7 deletions

View File

@ -1,12 +1,14 @@
# Dungeon Game
A small but flexible dungeon crawler written in C. The loader needs GCC to compile (`__USE_GNU`). Renders directly into the terminal using unicode and escape sequences. Enlarge font size to see what's happening ingame better. The game supports changing the font size or window size of the terminal emulator while running.
A small but flexible dungeon crawler written in C. Renders directly into the terminal using unicode and escape sequences. Enlarge font size to see what's happening ingame better. The game supports changing the font size or window size of the terminal emulator while running.
You can easily create plugins for the game by putting a new folder into plugins/ with the name of your plugin and then compiling your code into a shared library placed inside this folder named "<plugin name>.so" (`-shared -fpic`).
You might want to include the game.h file from plugins/game/game.h. Have a look into it to see available API. See the existing plugins for examples.
## Building
Controls: WASD to move, Q to quit, Space to shoot.
For info on how to compile the loader and the plugins, see doc/BUILDING.md
To build the loader and the plugins in the plugins/ folder, simply type `make` or `make all`. There are separate targets for the loader (`dungeon`) and the plugins. All Makefiles that are placed in plugin directories, so you might want to include a makefile in your plugin. The plugins target simply depends on ${PLUGINS}, so just add things to this in your plugin Makefile to add them to the plugins target (usually your plugin.so)
To run the loader, type `./dungeon`. It will load all plugins including the game itself dynamically and run the game.
## Gameplay
If you want to make a plugin that depends on another plugin (including the game itself), make sure to depend on that plugin. To add dependencies to a plugin, create a file named dependencies.txt in the plugin folder. Put the names of all plugins your plugin depends on into that file. You can use spaces or newlines as seperators.
For info on controls and a complete gameplay documentation, see doc/GAMEPLAY.md
## Plugins
For info on how to create plugins, see doc/PLUGINS.md

7
doc/BUILDING.md Normal file
View File

@ -0,0 +1,7 @@
# Building
The loader needs GCC to compile (`__USE_GNU`).
To build the loader and the plugins in the plugins/ folder, simply type `make` or `make all`. There are separate targets for the loader (`dungeon`) and the plugins.
To run the loader, type `./dungeon`. It will load all plugins including the game itself dynamically and run the game.

74
doc/GAMEPLAY.md Normal file
View File

@ -0,0 +1,74 @@
# Gameplay
## The Basics
You are in a pixely dungeon. There is no exit, the goal of the game is to survive and to collect XP (score). There are monsters and items in the world; you have to collect things and defeat monsters.
## Controls
You can use WASD to move up / left / down / right. Use Q to quit and Space to shoot fireballs if you have them in your inventory.
To navigate the inventory, use the arrow keys (up and down) to select an item and then press enter to use it.
## The map
The map consists of nodes and entities. The nodes are static; they cannot move and you cannot break or replace them. They are automatically generated on startup. Some nodes are solid, which means entities collide with them, others are not.
Entities are things that can move or be removed / spawned dynamically. The player is an entity themselves. Some of them collide with other entities, others don't.
The player emits light that has a radius of 10. You can't see anything outside of this radius.
### Nodes
There are two types of nodes, wall and floor. Entities collide with walls and do not collide with floor.
## Entities
#### Food
There are some collectable food sources, like apples and cherries. Collecting them gives you XP (apples 1, cherries 2). The main difference between apples and cherries is that the player will eat apples immediately, while cherries will be collected and go into the inventory. You can then use them to eat them. Apples heal 1 heart, Cherries 2.
#### Monsters
Some of the entities are monsters. There is currently only one type of entity, the alien monster. It has a very basic AI and cannot walk around obstacles. It walks 1 node per 0.5 seconds and also attacks at that rate. An alien monster attack deals one heart of damage. Killing a monster gives you 5 XP.
#### Projectiles
If you have fireballs in your inventory, you can shoot them (See Controls) or selecting them in your inventory and using them. They are shot into the last direction you moved or attempted to move into. Fireballs move at a speed of 1 node per 0.1 seconds and deal 3 - 5 hearts of damage to any entity they collide with (they are removed on collision).
## Inventory
The inventory is a list of things you carry on you. Some items can be used, meaning a specific action depending on the type of item is performed and they may be consumed by using them.
### Items
#### Cherry
Cherries are consumed when used. They are stackable. See Food for an explination.
#### Fireballs
Fireballs are consumed when used. They are stackable. See Projectiles for an explination.
#### Swords
Swords are not consumed when used, but they have a 1 / 100 chance to turn into a Broken Sword. They are not stackable. They need to recharge for 1 second before being used again. They hit any entity that collides with other entities and stands directly next to you in the direction you last moved or attempted to move into.
#### Broken Swords
Broken Swords are consumed / destroyed when used, but using them does nothing else. They are not stackable and they currently have no real purpose.
## UI
### The health bar
In the lower center of your screen you can see 10 hearts. Depending on whether they are red or gray they are active (red) or gone (gray). If you have 0 hearts you will die (game over). You screen turns red every time you take damage.
### The recharge meter
If you use an item that needs to recharge after being used, a recharge meter will show. It tells you the recharge percentage and visualizes it using a bar. You cannot use
### The score count
In the upper light corner there is a display that tells you your current score.
### The inventory
The inventory is rendered at the left half of the screen. It tells you which items you have; some items can be stacked, meaning e.g. a stack of 7 cherries will only be one entry in the list. However if an entry in the list is a stack, it will display the count after the name.
There is also an arrow in front of the currently selected item (See Controls)

11
doc/PLUGINS.md Normal file
View File

@ -0,0 +1,11 @@
# Plugins
You can easily create plugins for the game by putting a new folder into plugins/ with the name of your plugin and then compiling your code into a shared library placed inside this folder named "<plugin name>.so" (`-shared -fpic`).
You might want to include the game.h file from plugins/game/game.h. Have a look into it to see available API. See the existing plugins for examples.
## Dependencies
If you want to make a plugin that needs to use ABI from another plugin (including the game itself), make sure to depend on that plugin. To add dependencies to a plugin, create a file named dependencies.txt in the plugin folder. Put the names of all plugins your plugin depends on into that file. You can use spaces or newlines as seperators.
## Makefile inclusion
All Makefiles that are placed in plugin directories are included by the main Makefile, so you might want to include a makefile in your plugin. The plugins target simply depends on ${PLUGINS}, so just add things to this in your plugin Makefile to add them to the plugins target (usually your plugin.so)