General introduction to RPG.XLS Engine
Role playing games are very complex in terms of the data structure and object interactions. Each RPG consists in fact of sever modules responsible for different activities: travel on the map, combat, conversations. The modules may be more universal - for example the same engine is responsible for combat and travel - or specialized.
RPG.XLS will be based mostly on independent (specialized) modules. This is better approach for the first project of this scale, as it permits fast and flexible amendments during the development process, and it is generally faster, making alpha versions of the engine to be released earlier and thus allowing to collect more feedback from the Excel gamers.
The game uses formatted cell graphics to represent the map objects. This both retains "excelness" of the game and give it a remarkable old-school feel. Some cells are transparent and combined with spreadsheet background image, to produce nice seamless rocks or walls. As I showed in my essay on XCell Creative Art, such approach allows to produce very different kinds of terrain.
The game will also utilize shapes, but only for such things like visual effects during spellcasting or small info-screens. Different menus will be based on modal and modeless UserForms, like, for example, conversation window available since version 0.55a of RPG engine.
Generally, cell graphics may be generated in two different ways, by formatting cells on the fly, or by copying pre-formatted cells. I decided to fully base engine on the second method, there is no formatting (not even value changing) during the generation of the map, all possible cells are stored in a worksheet called tileset and each kind of tile assigned a unique integer id to match in with the map array. Below you can see the fragment of the tileset worksheet:
In my essay about Cell Animation I argued that formatting cells may be faster than copying. This is true, but copying has its obvious advantages for very complex cell graphics. First, by copying from pre-generated set, you never create a new cell format, so you are sure you donít exceed the Excel internal limit on 4,000 different cell formats. Second, with unequivocal relation between the values of map cells and tile set, the map generation algorithm is extremely simple and straightforward.
In alpha version of the engine, the entire map is drawn first, then only its fragment of 19x19 tiles is copied to the main game screen. In will change if final version of the engine, only the fragment of the map will be pre-generated, and the rest will be drawn gradually during the gameplay. This is because some stages in actual game will be much larger than in alpha version (209x209 tiles versus 67x67) and I donít want the player to wait too long when entering a new stage.
The Area Map - a very important element in most Role Playing Games - is based on simply coloring interiors of another worksheet zoomed out so the cells look almost like pixels. The map is drawn online, that is, only the area visited by player character is shown, unexplored areas are represented by the blank space.
For some objects, like walls or rocks I use tiles with "no color" interior and the worksheet background image. This can produce very nice visual effects, however, Excel allows only one background image in a worksheet, which is a serious limitation to the method. On the other hand, changing the background image is fast and simple, so there exist a workaround that allows to use multiple images in the same stage of the game.
The game engine could change the background image when the character explores this part of the map, when no background image is used. Apart from a short blink, this is almost unnoticeable. This allows to use different backgrounds for different objects on one seamless map. Version 0.60a of RPG.XLS engine uses this method, as illustrated below.
The standard game window show the area of 19 x 19 tiles. I am not yet decided whether this area will be shrunken by special conditions, for example, by "darkness" when exploring dungeons. This will be decided in later stages of development during the experiments with different settings.
The Map Editor
Map Editor plays very important role in the game development process. Convenient and flexible editor tool not only allows to build game levels much faster, but also encourages to create more complex map, filled with details. Thus, I spend relatively much time programming RPG.XLS Construction Set.
With Excel build-in functionalities like modeless UserForms, worksheet events, ability to make multiple area selections with ctrl + mouse click, the basic design of map editor looks pretty simple. All you need is to select a range, choose a type of fill on the UserForm and relatively simple macro will fill the range will a given set of tiles.
Of course, the process of creating map is not limited to copying a cell tiles. In fact, copying a cell is only a by-product of WYSIWYG editor, to let you see how the graphics will look like. The "real map" is a set of numbers, representing all existing map objects, and stored in another part of a workbook (or in a special binary file). The game engine will use these numbers to draw the screens of the actual game.
In order to enhance the graphics, the tiles used in the game are not "independent" but rather form some patterns. For example, the outdoor ground tiles uses repeated diagonal patterns with three different shades of green. The map editor automatically chooses the proper background from the tileset worksheet (see above) to fill a given area.
Some tiles uses cell borders to enhance the look of objects like walls, water reservoirs or rocks. The building walls are the most complex, as they are construed from the set of thirty-six different basic tiles. Nevertheless, drawing the entire building is quite simple. First, one have to create a floor, and then using multiple area selection choose all possible walls, including those ones that will contain doors and other solid objects.
Then, it is just one click to create all walls using that many different tiles depending on the position of a tile in a wall structure (e.g., wall corner, end of an inner wall and so on). The algorithm responsible for this is based on analyzing the type of four adjacent cells, wall, exterior or interior, to create a unique number of a wall tile for each wall element.
Most objects of the game serve simple like movement-blockers and decorations, e.g., walls, trees, rocks, flowers. There are, however, many objects linked to data modules other than a map, like doors, road signs, containers, and, of course, creatures and items. They are briefly described in chapter two, in the section of the game object model.