Swapping in additional tilesets using patch
Posted: Wed Sep 22, 2010 8:30 am
I am working on a modification for the ACK mega-patch which will allow multiple tile sets to be swapped in for both the standard and extended (animation) tile sets.
Basically how this works is there would be one or more subdirectories underneath the normal game directory, named TILES<n>, where <n> is the number of the tileset (starting at 1). Each subdirectory would contain the shell of an ACK game (to allow its tiles to be edited/imported using the standard ACK editor), but the only files that would really be used would be the standard tile (TILES<n>.GRP) and extended tile (TILES<n>.GR2) files.
From your game, you would use an extended macro command -
DRAW 999 100 TO <n> 0 OF 0 0
which would cause the engine to reload the standard tile set with \TILES<n>\TILES<n>.GRP. A similar command could be used to reload graphics for the alternate tile set.
This still would not allow you to have more tiles in your game at a given time than the existing engine allows, but it would allow you to have different *sets* of tiles that would be used in different parts of the game. Here are a couple of possible examples.
1) Different graphics in different regions
Let's say you have a number of different dungeon areas in your game, and they all contain common elements such as doors, walls, burning torches, and so on. Now, a stone wall in one dungeon is the same as a stone wall in the next, but you would like them to look different in different dungeons, so dungeon A can have a different visual theme from dungeon B.
With the existing engine, there are two ways to do this. First (and simplest) you create multiple wall objects, multiple door objects, etc. Wall A works the same as wall B, but it uses a different tile. Then, you build dungeon A using wall A, door A, etc. and dungeon B using wall B, door B, etc.
Of course, you rapidly run out of objects doing things this way. You also have the option of using 'set later' graphics, which means that you get away with only using one 'wall' object, one 'door' object, and so forth. But this gets very tedious, because every single time you lay down a dungeon wall tile, you will have to go and select the set later graphic for it.
With the tile-swapping mechanism, you only need one dungeon wall object, but you change the way the tile looks. In your game, there would be a 'common core' set of tiles that look the same in all the tile sets. These tiles would be used for things that travel across regions, like the player, things the player carries, creatures, and common objects that are used in all regions.
So for example, let us say you have decided that tiles 1-100 will always be identical in all your sets. However, tile 101 will represent a dungeon wall. So you only need one dungeon wall object, which uses tile 101. But when you enter dungeon A, you load tile set 1, which contains a tile 101 that looks like a red wall. When the player enters dungeon B, you load tile set 2, which contains a tile 101 that looks like a blue wall.
2) Creatures
You can do the same thing with creatures. If region A contains a certain set of creatures, and region B contains a different set, then when the player enters a region you simply load the tileset that contains the tiles used by creatures in that region.
--
Obviously, this is an optional mechanism and would definitely increase the amount of record-keeping needed when designing games that use it. However, it would also allow an enormous amount of additional flexibility when creating graphics for ACK games.
One potential issue is that if the player saves and restores the game, the default tile sets will always be reloaded. I will need to figure out a straightforward way to ensure that the game has the chance to reload tile sets for a particular region when the game is restored, possibly by calling a dedicated macro.
Basically how this works is there would be one or more subdirectories underneath the normal game directory, named TILES<n>, where <n> is the number of the tileset (starting at 1). Each subdirectory would contain the shell of an ACK game (to allow its tiles to be edited/imported using the standard ACK editor), but the only files that would really be used would be the standard tile (TILES<n>.GRP) and extended tile (TILES<n>.GR2) files.
From your game, you would use an extended macro command -
DRAW 999 100 TO <n> 0 OF 0 0
which would cause the engine to reload the standard tile set with \TILES<n>\TILES<n>.GRP. A similar command could be used to reload graphics for the alternate tile set.
This still would not allow you to have more tiles in your game at a given time than the existing engine allows, but it would allow you to have different *sets* of tiles that would be used in different parts of the game. Here are a couple of possible examples.
1) Different graphics in different regions
Let's say you have a number of different dungeon areas in your game, and they all contain common elements such as doors, walls, burning torches, and so on. Now, a stone wall in one dungeon is the same as a stone wall in the next, but you would like them to look different in different dungeons, so dungeon A can have a different visual theme from dungeon B.
With the existing engine, there are two ways to do this. First (and simplest) you create multiple wall objects, multiple door objects, etc. Wall A works the same as wall B, but it uses a different tile. Then, you build dungeon A using wall A, door A, etc. and dungeon B using wall B, door B, etc.
Of course, you rapidly run out of objects doing things this way. You also have the option of using 'set later' graphics, which means that you get away with only using one 'wall' object, one 'door' object, and so forth. But this gets very tedious, because every single time you lay down a dungeon wall tile, you will have to go and select the set later graphic for it.
With the tile-swapping mechanism, you only need one dungeon wall object, but you change the way the tile looks. In your game, there would be a 'common core' set of tiles that look the same in all the tile sets. These tiles would be used for things that travel across regions, like the player, things the player carries, creatures, and common objects that are used in all regions.
So for example, let us say you have decided that tiles 1-100 will always be identical in all your sets. However, tile 101 will represent a dungeon wall. So you only need one dungeon wall object, which uses tile 101. But when you enter dungeon A, you load tile set 1, which contains a tile 101 that looks like a red wall. When the player enters dungeon B, you load tile set 2, which contains a tile 101 that looks like a blue wall.
2) Creatures
You can do the same thing with creatures. If region A contains a certain set of creatures, and region B contains a different set, then when the player enters a region you simply load the tileset that contains the tiles used by creatures in that region.
--
Obviously, this is an optional mechanism and would definitely increase the amount of record-keeping needed when designing games that use it. However, it would also allow an enormous amount of additional flexibility when creating graphics for ACK games.
One potential issue is that if the player saves and restores the game, the default tile sets will always be reloaded. I will need to figure out a straightforward way to ensure that the game has the chance to reload tile sets for a particular region when the game is restored, possibly by calling a dedicated macro.