Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Conditional tile replacement  (Read 406 times)

TiagoTiago

  • Bay Watcher
    • View Profile
Conditional tile replacement
« on: March 27, 2010, 06:32:15 am »

Special tilesets would have for each tile, a ruleset written with some language, with a syntax kinda like

Code: [Select]
TileDef
TileFilename, ResX,ResY,TileX,TileY
What
Display
RuleType
...
Layer
XXX
X#X
XXX
...
EndRule
...
EndTileDef

where:

TileFilename would obviously be the name of the image file holding the tile in question

Res* is the amount of tiles (the actual number of pixels of the image should be avaiable from the file headers or whatever)

Tile* is the coordinate for the tile

What would identify if this rule is for replacing terrain or some other type of tile (creature, object etc), potentially including further details, like species, etc

Display would indicate how to display the replaced tile if there is more than one thing in that tile (FLIPPING between the different images, FIXED, and perhaps even COMPOSITING  for tiles that have transparency, and perhaps other options if avaiable)

RuleType can be one of the following: MUST, MUST_NOT, MAY, MAY_NOT. The MUST* rules are added together, all of them must be true (the _NOT must not be true), and the MAY* rules may be any of the may rules (at least one).

Layer can be either U, Z or D. U meaning tiles in the Up direction, Z for tiles int he current Z level and D for tiles in the Down direction.

X can be replaced by a character identifying a property of the world tile in that position in relation to the # tile, including terrain properties and properties of objects and creatures on it. There should also be wildcard characters, one for just ignore that position for that rule and other wildcards for each category and subcategory of stuff.

# same as the X, but for itself of course. This in the layer defined by Layer. If Layer is Z # is the tile that will be replaced by the image idetified by the second line, the line after TileDef


Rules can have as many
Code: [Select]
Layer
XXX
X#X
XXX
in sequence as desired (in order to add several patterns under the same rule, specially to have the 3 layers in a single rule, but more of a same layer could be allowed) and also may have indented
Code: [Select]
RuleType
...
EndRule
blocks inside it if you want to combine rules into a single top level complex rule (the indented blocks may have their own indented blocks and so on)



That info would be included in a text file, the game automaticly finding new text files in the folder so people can more easily distribute and install special tilesets, but more than a single tile may be defined in a single file, allowing for several tiles to be defined in a single text file.



The exact details of how to define the special tiles and stuff are up for discussion, the basic idea is to allow special tiles to replace generic tiles under special situations (ramps matching the surrounding terrain, dwarfs holding different tools, or having different facial expressions, curved walls, animals facing the direction they are moving, detailed parts of mult-title creatures etc).

Perhaps if the replaced tile of other tiles can be read, it might even be possible to have tile replacement run Conway's Game of Life :D (would also be useful for things like grass waving in the wind, creatures leaving wake in the water, stealthy creatures leaving waving trails in high grass (like the raptors in JP2) and many other stuff)

edit:another use would be to display a tile that shows all the creatures at once when they are all in the same spot
edit2: also, smooth transitions between different terrain types
« Last Edit: March 27, 2010, 04:35:47 pm by TiagoTiago »
Logged
---
Notification emails don't always reach me, please let me know if you think it has happened (like if i don't reply a thread i'm expected to reply for more than a week)