The Construction and Implementation of the iiag Game and Framework

Chris Harding

This semester I worked on an open source project that started in COSI by myself several others which is called iiag. It is an terminal game that uses ncurses and was inspired by Michael Toy and Glenn Wichman's Rogue, the game that spawned the term "rogue-like" and inspired other games of a similiar composure, such as hack, nethack, SLASH'EM, and Dwarf Fortress.

There are a few interesting elements of the game that I implemented. One of note is the mechanism for implementing the line-of-sight of the player, and in addition (although not as obvious), the creatures of the game. A simplistic algorithm would just show the player all squares that are within a specific radius, to give a "fog of war" reminiscent of many real-time strategy games, however, this does not allow for things, such as walls, to block the light-of-sight of the player. The approach that I took, was essentially to draw a line from player the square whcih we are questioning the visibility of. I did this line drawing using Bresenham's line algorithm. I further keep track of which unchanging squares (as of now, just walls) that have been seen so far by the player. This allows for the player to, in a sense, explore the dungeon.

The artifical intelligence implemented in the game as of now is not entirely smart. As of now, it implements a iterative search that on every step that looks for the most optimial actions to take. The actions are prioritized by visible end-goal and then the next step towards their end goal is executed. However, this does allow for some features that could have lasting implications in the game's development, such as the inclusion of factions. Each faction has a disposition towards each other faction, which is 0 by default. a negative value indicates a hostile disposition, and a positive value indicates a friendly disposition. Faction dispositions effect a creatues disposition towards members of other factions. As of now, each creature can only be a member of one faction, although in the future creatures will have the ability to compose multiple factions.

Originally, the data files were written in a language called IML (Iiag Markup Language), the parser for which I implemented within the iiag source. However, with the necessity for trigger code specific to creature types, there grew the rise for arbitrary functions with the world description scripts. IML, being only a markup language, and not a scripting language, could not provide this functionality without a large reworking of the IML parser source and the addition of an evaluator. Not wanting to construct a scripting language in addition, we decided to go with an already constructed solution, which turned out to be Lua. Thankfully, the IML files were easily translated into Lua files with only some subsitution regular expressions.

Iiag can be found on github:
Github page for iiag

To build iiag, you need Lua, usually termed liblua-dev or liblua5.2-dev, or the like for which Lua version you wish to use.
If you cannot compile iiag with simple make, try make LUAV=lua5.2, adjusted, if necessary, to your version of Lua.

If you want to try rogue, which insipired iiag, you can install it on debian with with:
	apt-get install bsdgames-nonfree
Or on ArchLinux:
	pacman -S rogue