The main problem with conditioning on surrounding tiles is the inevitable combinatorial explosion.
This means we have to generate the combinations in realtime, which is impossible in 2D mode and.. hard, in most of the opengl modes. In practice, it'll pretty much have to require shader mode, and probably also involve bundling shader code with the tileset in question. Not
really a big deal, but more work than you're used to; I'll help, of course.
It'll also be useful to have textures that aren't associated with individual tiles, in order to blend them with ones that
are.
So, ignoring graphics-mode's extra tiles for the moment, I'm envisioning a system something like this:
- Instead of a tileset, you supply a tarball/zipfile containing lots (and lots) of numbered PNGs. 0.png, 1.png, etc. Current tilesets would still be readable (backwards-compatibility is nice), but wouldn't get the extra bonuses.
- You can supply *any number* of those numbered PNGs.
- In the shader, you have four inputs:
* The current time (in milliseconds since DF start)
* The absolute location of the current tile, i.e. relative to the entire map
* The relative location of that tile, i.e. to the window
* The background/foreground color and CP437 index of *all* the visible tiles. You'd access the data for your current tile by using the relative tile-location as an index.
Additionally, you have access to a texture array, where
each texture in that texture array matches up with the same numbered texture in the supplied tileset zipfile.
At that point.. well, you can do pretty much whatever you want. There will be a default set of shaders in data/art that act about the way it works today, which are overridden by any shaders in the zipfile; I'll be using both vertex and fragment shaders, as anything that's calculated the same way for every pixel in a tile (like, its foreground/background color and texture index) shouldn't be calculated per-pixel.
Sound good? This way, you won't get a slowdown almost no matter what you do.