Commit graph

8 commits

Author SHA1 Message Date
Griffin Smith
b6f170c02c Generate more reasonable doors
Generate doors at more reasonable positions, by:

- Only generating doors at the *ends* of hallways, where there's a
  tee-shaped opening
- Never generating two doors adjacent to each other
2020-01-08 23:15:32 -05:00
Griffin Smith
14997bc1a3 Fix ambiguity error in Opposite tests
For some reason cabal wasn't properly recompiling this file locally to
pick up the introduction of an ambiguity error.
2019-12-31 11:28:51 -05:00
Griffin Smith
e76567b9e7 Add dungeon level generation
Add a dungeon level generator, which:

1. generates an infinite sequence of rectangular rooms within the
   dimensions of the level
2. removes any duplicates from that sequence
3. Generates a graph from the delaunay triangulation of the centerpoints
   of those rooms
4. Generates the minimum-spanning-tree of that delaunay triangulation,
   with weights given by line length in points
5. Adds back a subset (default 10-15%) of edges from the delaunay
   triangulation to the graph
6. Uses the resulting graph to draw corridors between the rooms, using a
   random point on the near edge of each room to pick the points of the
   corridors
2019-12-30 11:31:56 -05:00
Griffin Smith
8a4220df83 Implement speed and ticks
Gormlaks now move 1/8th the speed of the character, which means we can
run away from them - yay!

Unfortunately this also introduces a bug where they'll eventually get
stuck and not do anything, so I'll be tackling that next.
2019-10-13 12:37:08 -04:00
Griffin Smith
6ab7cdfdc9 Only allow adjacent gormlaks to attack
Previously the isUnit function was falsely returning `True` for
positions that were one tile off in *either* direction from the
character, when it should've been *both*. Oops.
2019-10-06 13:13:00 -04:00
Griffin Smith
05da490185 Gormlaks attack back
When gormlaks see the character, they step towards them and attack
dealing 1 damage when adjacent. Characters have hitpoints now, displayed
at the bottom of the game screen, and when the game is over they die.
2019-09-29 10:54:52 -04:00
Griffin Smith
4d270712ae Add raws, loaded statically from a folder
Add raw types with support for both creatures and items, loaded
statically from a "raws" folder just like in the Rust version.
2019-09-02 13:59:28 -04:00
Griffin Smith
4ef19aa35a Add entities, and allow walking around
Add support for entities via a port of the EntityMap type, and implement
command support starting at basic hjkl.
2019-08-31 13:18:51 -04:00