Friday, July 29, 2011

git pre-commit hook and hspec

While working on some hspec stuff, I decided to try out git's pre-commit hook and see if I can make it refuse to commit unless the unit tests pass. It was easy. Here's what I came up with:

echo "Running specs.hs"
exec runhaskell hspec.hs --format=progress --specs specs.hs

Where specs.hs are the file with the specs for the hspec library and the --specs option tells the hspec executable to run it's own specs.

On my Mac I need to make the hook executable by running chmod +x .git/hooks/pre-commit

Wednesday, July 20, 2011

Some roguelike ideas

I've always got a few ideas for roguelikes in my mind so I figured I should write some down before I forget.

Allied chat. Instead of having some command list, telling allies what to do would involve typing out a command like you're talking to another player. If NPC's understand a few verbs (attack, go to, defend, follow, help, get, etc.), adjectives (fire, nearby, weak), and nouns (me, the skeleton, a sword, etc.) then you could give simple commands to specific allies, or whoever is in earshot of you.
  • follow me
  • Mr Wizzard: defend the temple
  • get better armor
  • give me your weapon
  • priests: help the king
  • use frost weapons on fire imps
Allies could be made even smarter by having default ones or keeping a history of certain commands and the most recent ones take precedence. So if you tell your allies "defend villagers" then "attack archers", they will attack archers if there are any visible, otherwise they will defend any visible villagers. Or that may be more frustration than it's worth; I don't know.

Random monsters. Each game has several species of monsters that have random attributes for each game. Identifying what their strengths and weaknesses are is part of the fun, just like with potions and scrolls. So in one game Forest Monsters can fly, are immune to poison, and have strong armor; in the next game they leave poisoned corpses, regenerate quickly, and can summon insect swarms. Imagine if none of the random monsters leave corpses or if they're all resistant to magic.

Nomic. A nomic is a type of game that is played by changing the rules of the game. I've seen some very strange things happen so it would need to be limited and simplified for a computer game. Imagine if a roguelike let you vote on new rules from time to time. Maybe you could make using magic a crime, grant money to players for each rat they kill, create a fee for those who want to use large weapons, or even crown yourself emperor. Influencing the other voters could become a game in itself.