Hot-swapping graphic tiles w/replacement tiles

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, Chris H

Post Reply
rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Hot-swapping graphic tiles w/replacement tiles

Post by rld » Wed Jul 20, 2011 12:48 pm

I am currently figuring out how to implement a hack that will allow more flexibility in the way that graphic tiles are displayed. The 'swap out tile sets' hack allows the number of graphic tiles that can be used to be expanded; this hack would give the designer the option to have a bit more fine-pitched control of tile display.

Basically, the idea is to set up an optional 'replacement table' which could have values set on a tile-by-tile basis. Single entries would be set in the table using an expanded DRAW command, like

DRAW 999 103 TO <tile> 0 OF <replace> 0

So, for example, if you set <tile>=100 and <replace>=101, you would be telling ACK, "Until I tell you otherwise, any time that you would normally display tile 100, display tile 101 instead." This substitution would only go one level deep, so if you have a similar entry for tile 101, it would not be applied at this point, to prevent recursion problems.

How would this be useful? One example would be to change the appearance of all objects of a certain type at once. For example, if you had a castle with lots of torches on the walls, and you wanted to change the torches from unlit to lit. You don't want to have to actually change the objects one at a time, and you can only change objects on the map in close proximity to the player anyway. What you want is to change how the objects are displayed. Or if you wanted to allow the player to see certain objects only after a condition has been met (for example, displaying a hidden sign after the player has put on some magic spectacles), this would be another way to accomplish this.

Note that we are changing the display at the tile level, not the object level. This could be used for anything - objects, creatures, etc., as the ACK engine won't know or care at the layer we are modifying what the tiles represent.

Additionally, with a slightly more complicated version of this, we can expand the animation facilities available for tiles. Let's say we have the command

DRAW 999 104 TO <tile> 0 OF <base> <rand>

This is similar to the previous command, but instead we are saying "Instead of drawing tile number <tile>, draw a tile given by the number <base> + random(<rand>)".

So, for example, if you do

DRAW 999 104 TO 100 OF 100 8

whenever the ACK engine would draw tile 100, it will instead draw a random tile from 100 to 107.

Why is this useful? First, you can now have terrain objects and/or creatures with more animation frames than the ACK engine currently allows. And if you want to change how the animation runs on the fly (for example, if you have a 'boss' creature that might show different animation sequences at different points during a fight), you can change that too.

One note: This would only affect tile display when ACK normally draws a tile. It wouldn't make the engine redraw the tile at any point that it would not normally do so. For example, when the inventory list for player-carried objects is shown, the tiles are just drawn once and then left alone, so you couldn't use this to make objects animate in the inventory display. But on the map, animated tiles are drawn and refreshed continuously anyway, so the replacement effect has a chance to happen.

And if you redraw the tiles repeatedly yourself, it will happen at that point. For example, this could be used to make tiles in a mosaic animate, if the mosaic is drawn repeatedly by a macro while waiting for the player to press a key (or for a delay to pass).

Garth

Post by Garth » Sun Jul 24, 2011 3:09 am

*Jaw-drops*

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld » Tue Jul 26, 2011 9:14 am

Another cool use of something like this would be if you were implementing a spy/thriller kind of game, and you wanted to have countdown screens everywhere in the bad guy's fortress that were showing an autodestruct countdown as the hero tried to escape.

Experimenting with this a little bit, the random tile replacement feature has a slightly different effect on non-animated tiles. For these types of tiles, the map is redrawn each time the player moves/takes a turn, which gives a different kind of animation effect that is still interesting.

Not sure yet if you have a mix of animated and non-animated tiles on the map if the *whole* map is redrawn repeatedly, or only the tiles that have animation enabled.

Post Reply