Commit 9a22985d authored by Christopher Silva's avatar Christopher Silva

add to update 2

parent 5d4626e6
......@@ -4,6 +4,50 @@ date: 2018-11-15T18:20:52-06:00
draft: true
---
This week I worked to add some actual gameplay elements.
### Items and Effects
The major addition is an item and effect system split among three definition files:
- item_types - whether an item is consumable, has a cost, and what character is displayed
- effects - what stat is affected, is it increased or decreased, is it permanent, and is it cumulative
- items - defines the color, item type, the effects, and their values and durations (ex: "regen 1 10" heals 1hp per turn for 1 turns)
When the game starts it loads these three files and combines them to create a hashmap of item definitions.
### UI Changes
I have also made changes to the main game screen panels.
- Stats - added energy, strength, and defense
- In View - lists enemies and items in view and corpses you are standing on
- Inventory - lists the first few items in your inventory, can be used with f1-f4
- Map - added frame around the map
Because I took the time to write renderer and menu traits these changes were very easy to make.
### Issues with Tcod Algorithms
While playing this week I ran into issues with the pathfinding and field of vision algorithms provided by tcod.
I ended up switching to a different pathfinding library and implementing a fov algorithm.
While the changes weren't fun to do (I spent more than 12 hours translating fov algorithms from c and c# to rust), I am happy to have removed the tcod dependencies outside of the tcod renderer implementation.
#### Pathfinding
I wanted to allow diagonal movement unless one of the two tiles along the diagonal are blocked.
The only real option for customizing the pathfinding is through a callback to determine cost between two tiles.
I could have implemented my changes using that, but I decided that if I was going to have to write it myself anyways I may as well use a different library to remove another tcod dependency and give me more options for the future.
I switched to the [pathfinding](https://crates.io/crates/pathfinding) library which provides many pathfinding algorithms for directed and undirected graphs.
#### Field of Vision
I noticed many situations where enemies would get stuck in doorways and corner while chasing me.
The issue was that the fov algorithms provided by tcod were not symmetric so there were many situations where the player could see an enemy that couldn't see them and vice versa.
I spent a few days implementing different fov algorithms claiming to be symmetric and fast (one of them was neither symmetric nor fast).
The one I decided to use is by Adam Milazzo and is described [here](http://www.adammil.net/blog/v125_roguelike_vision_algorithms.html) in a great comparison of different fov algorithms with well commented code samples.
## Past Week
2018-11-10
......@@ -43,6 +87,10 @@ draft: true
## Next Week
- work on making a map generator similar to the one brogue uses
- make changes to the ai to make it lose interest in chasing the player after a while and have different alert levels
- improve the inventory system: make separate quick use and equipment slots
- make a system for multi step commands (look, move until you hit a wall/see an enemy. etc)
- make "in view" panel only show monsters and what you're standing on
- add mouse move/look
SCREENSHOT GAME, MESSAGE LOG, AND INVENTORY MENUS
VIDEO OF SOME GAMEPLAY
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment