This is a simple 2d exploration game written in OCaml.
It is intended to be a learning project and in time will hopefully serve as an example of how to write simple [terminal-based] games in OCaml.
- Build
dune build @install
- Launch
2d-exploration-game
- Use vim-style movement keys h, j, k, l (left, down, up, right) to move
- Esc, Ctrl-C or 'q' to quit
- Terminal graphics
- Single-player
- Movement using vim-style direction keys (H,J,K,L)
- World generation with procedural psuedo-randomness
- Entities - Humans and Trees
- Items - Rocks
- Players inventories
- Centered game window
- Worlds are not persistent and can't be saved
- Multiplayer
- World item interaction
- Inventory item interaction
- World entity interaction
- Persistent worlds / save game
- World size > 128x128
- AI for world entities
- User interface
- Many more entities and items
- Wearable and weildable items
- Key binding configuration
- Terrain
- Turns
- Optional high-res mode using GL
For those interested in how this program is written/structured:
- Uses notty for terminal graphics
- Uses core.command for CLI parsing
- World is stored in a list with items referenced via association
- Everything is immutable
- Modules are used and inherited
- result and option types are used heavily to avoid exceptions where possible
- No use of imperative language features
- Refactor randomness which is not really random
- Use a better suited container (other than list association) for World
- Move modules to their own source files
- Define and use module interfaces
- Use functors to generate various types/modules
- Refactor rendering logic which feels a bit clunky
- Logging with levels and UI/file output
If you have any work or suggestions that improve the way this program is written, feel free to contact me or make a PR.