There has not been a discussion on this and I have a few questions/comments:
* What will happen internally when I put background material to water at some point in the landscape and rock in front and then blast the rock? It seems that once the normal material is blasted the water at those points in the landscape move to the foreground to create a flood. Some detailed explanation would be nice to have.
* Since we now have 255 indexes free for materials, should we reorder them more sensibly in the TexMap? Also the comment "# Index +128 for underground materials" is obsolete.
* In the editor, the sky texture is greyed out but not set to none, to be consistent it should be set to none. Also, when I select sky as foreground the background is greyed out and equals sky, is there a reason for that? Tunnel can have background materials, which is a bit inconsistent somehow.
* The bucket of paint tool I can't select when drawing a landscape.
I guess that is it after a first round of testing, great feature though! I will definitely use it in some of the existing maps.
> This can be used to prevent flowing liquids to overwrite the tunnel texture, but also to have infinite reappearing of liquids.
Or also infinite gold mines :), or indestructible granite.
> What will happen internally when I put background material to water at some point in the landscape and rock in front and then blast the rock? It seems that once the normal material is blasted the water at those points in the landscape move to the foreground to create a flood. Some detailed explanation would be nice to have.
What happens is that simply when a pixel is cleared, e.g. by digging or blasting, instead of either creating tunnel or sky where the pixel was, the pixel is changed to the background material. Afterwards, both the foreground and background materials are the same. When building loam bridges, or when the MassMover moves liquid around, it only changes the foreground material and leaves the background material as it is.
> Since we now have 255 indexes free for materials, should we reorder them more sensibly in the TexMap? Also the comment "# Index +128 for underground materials" is obsolete.
The index 255 is reserved for internal use, so in fact there are "only" 254 indices available (and 0 is always sky). In order to preserve backwards compatibility, the "index + 128 for underground" is still true for Map.bmp maps. If you want to make use of the full set of 254 indices, use a file MapFg.bmp instead (MapBg.bmp can then be used to specify the background materials). For other map types such as Map.c there is no such restriction (see the documentation for how to draw background materials with Map.c scripts).
> In the editor, the sky texture is greyed out but not set to none, to be consistent it should be set to none. Also, when I select sky as foreground the background is greyed out and equals sky, is there a reason for that? Tunnel can have background materials, which is a bit inconsistent somehow.
Sky has always been somewhat special, e.g. it does not have a texture compared to all other materials. But the major reason I think is just that it doesn't seem to make sense that there could be something "behind" sky. I'm not even sure what would happen at the moment if you have sky with say tunnel as background material and start to dig around in the sky region... but I don't have a very strong opinion on it, and it can be easily changed.
> The bucket of paint tool I can't select when drawing a landscape.
If I remember correctly that tool only works in exact landscape mode, but it has always been like that. Did you try that? Otherwise sounds like a bug...
> Or also infinite gold mines :), or indestructible granite.
That's good! It could be used in Krakatoa so we can remove the wall0kit hack there.
(Although of course preferable would be to have another brick texture instead).
Btw infinite gold mines won't work because the gold will spawn locked into the material, right?
I am on vacation tomorrow and then travelling for work afterwards, but I will fix Krakatoa using the new system afterwards. I think even more worlds can profit from this. like Flooded Veins to ensure water on insane difficulty.
> Btw infinite gold mines won't work because the gold will spawn locked into the material, right?
No, it actually works. The gold spawns at the same location at which the flint exploded, which is still outside the material.
This means that, if I alternate brick and tunnel backgrounds behind a lava lake, the background bricks will always be square (which is OK for the current brick texture, but might look weird if it is changed).
> By the way, one unfortunate "feature" is that when zooming map to landscape, background materials are always drawn with the same shape as the foreground material.
The motivation behind this was basically that for example a goldmine could have tunnel with a different texture as a backgroud, and then after blasting it away one could still see where the goldmine once was.
Do you have ideas how to do it differently, or maybe different options we could provide?
* The background shape must not cover a smaller area than the foreground shape. Otherwise, borders of the outer foreground shape would not be covered with the proper background
* If the background shape is larger than the foreground shape, we do not want to expand it over different materials. Otherwise, e.g. a tunnel background on the top of a flat lake would stick out of the top and become visible under weird conditions, like when someone builds + digs away a loam bridge
One way to achieve this would be the following:
1. Draw background in foreground shape as it is done right now.
2. Afterwards, do a second ChunkOZoom pass over each MatTex entry for the background, where the background is drawn in background shape with an AND operation to the condition that the foreground material is the same as the one of the corresponding chunk.
I don't know if that small feature is worth doing a second ChunkOZoom-pass. It could be accelerated greatly by doing some sanity checks, such as drawing chunks only if one of the borders has a different background mat and if the background shape is larger than the foreground shape, but it's still a bit of coding effort for little gain.
I'd like to use this to loop over some part of the map and use those functions to set the background material of that part of the map.
> How do SetPixel, GetPixel and CreateMatTexMask work in map scripts with the new materials?
Whoops, looks like I forgot something here. There are still some todos in the code that I seem to have missed:
// TODO: Add function to get background pixel
My plan was to add a function GetBackPixel() to query the background pixel value, and add another parameter to SetPixel() to set the background material (can be nil for "keep current"). For CreateMatTexMask I'd either return a 512-bool array, or add a CreateBackMatTexMask.
Actually, for SetPixel something like
SetPixel(x, y, "Brick:Tunnel-BrickBack");
should work already, but it's not yet possible to set the background material by index.
The current workaround in map scripts is to do e.g. this in the beginning:
SetPixel(0,0,"Granite");
var granite_index = GetPixel(0,0);
I never understood what CreateMatTexMask is useful for though.
* Added int GetMaterialTextureIndex(string mattex);
* Added int GetBackPixel(int x, int y)
* Added int GetDefaultBackgroundIndex(string | int);
* Changed SetPixel to SetPixel(x, y, fg, bg); fg and bg can be a string or an integer or nil. If nil, the value is unchanged.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill