Sand Storm Terrain
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Sand Storm Terrain
Hello everyone,
I want to include a new "sand storm" terrain type in my upcoming campaign, that works an an overlay like shroud/fog and slows down units.
I took the sand storm graphics by Attila for my UMC, but i quickly ran into problems when I tried to code the terrain and its interactions. Thus, I'd like to ask whether somebody can help me out with those 2 questions regarding my terrain:
1. Is there a macro that I can use for fog/shroud-like overlay terrain, if I have all its variants and borders? I tried using the shroud-terrain graphics from data/core/terrain-graphics.cfg:973 (TRANSITION_RESTRICTED_LF), but that one produced broken borders that overlap with each other: 2. Is there a way of modifying the mp costs of ALL units in a specific terrain? I tried to change the mvt_alias to water (Wst), so that land-based units would be slowed down by that terrain. I felt that this was an ugly solution (besides breaking flying and water-based units) and that adding a new mvt_alias with fixed movement costs for all units would be more appropriate.
However, I have no idea whether this is even possible, so I am asking anyone with terrain coding experience to help me out a bit
I want to include a new "sand storm" terrain type in my upcoming campaign, that works an an overlay like shroud/fog and slows down units.
I took the sand storm graphics by Attila for my UMC, but i quickly ran into problems when I tried to code the terrain and its interactions. Thus, I'd like to ask whether somebody can help me out with those 2 questions regarding my terrain:
1. Is there a macro that I can use for fog/shroud-like overlay terrain, if I have all its variants and borders? I tried using the shroud-terrain graphics from data/core/terrain-graphics.cfg:973 (TRANSITION_RESTRICTED_LF), but that one produced broken borders that overlap with each other: 2. Is there a way of modifying the mp costs of ALL units in a specific terrain? I tried to change the mvt_alias to water (Wst), so that land-based units would be slowed down by that terrain. I felt that this was an ugly solution (besides breaking flying and water-based units) and that adding a new mvt_alias with fixed movement costs for all units would be more appropriate.
However, I have no idea whether this is even possible, so I am asking anyone with terrain coding experience to help me out a bit
Default L0 Era - Level 1 leaders with level 0 recruits!
Re: Sand Storm Terrain
About the first question, I think you need to change terrain graphics by using Gimp or Photoshop, but you can try using fake shroud in the map editor.
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
The terrain graphics are not the problem, as I have all variants for every border situation concerning the sand storm terrain. I simply do not have enough experience with coding the respective border transitions. Currently, my custom terrain sets up border transitions in all 6 directions without problems. But when 2 hexes of my terrain are nearby, these border transitions overlap. The problem is finding an appropriate terrain rule macro or creating unique terrain graphics rules specifically for the sand storm terrain.
The following image should clarify the case of overlapping in borders, not deficient graphics:
The following image should clarify the case of overlapping in borders, not deficient graphics:
Default L0 Era - Level 1 leaders with level 0 recruits!
Re: Sand Storm Terrain
You should try to look into other terrain macros.
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
UPDATE: The first question is solved (more or less)
Still unable to use any of the existing macros, I've decided to check out some Tutorials on Terrain Graphics, and I ended up writing the border transitions myself. The code works on a basic level, but it would be infinitely cleaner if I finally found a fitting border transitions macro. Everyone is free to contribute. In case somebody wants to use the terrain, I will provide the graphics and coding below:
EDIT: The [terrain_type] has been updated as to fit josteph's solution concerning the second question
Still unable to use any of the existing macros, I've decided to check out some Tutorials on Terrain Graphics, and I ended up writing the border transitions myself. The code works on a basic level, but it would be infinitely cleaner if I finally found a fitting border transitions macro. Everyone is free to contribute. In case somebody wants to use the terrain, I will provide the graphics and coding below:
EDIT: The [terrain_type] has been updated as to fit josteph's solution concerning the second question
Code: Select all
[terrain_type]
icon_image=symbols/terrain_type_fog
id=sandstorm_proxy
string=Ssp
aliasof=At
hidden=yes
hide_help=yes
[/terrain_type]
[color_range]
id=sandstorm_proxy
rgb=F1CE6C,FFFCC0,4A3212,B19D66
[/color_range]
[terrain_type]
symbol_image=sandstorm/sstorm
editor_image=sandstorm/sstorm-n-ne-se-s
id=sandstorm
name="Sandstorm"
editor_name="Sandstorm"
string=^Sst
aliasof=_bas
def_alias=_bas
mvt_alias=Ssp
vision_alias=Ssp
editor_group=desert
[/terrain_type]
Code: Select all
{CUSTOM_TERRAIN_BASE *^Sst 100 sandstorm/sstorm}
{CUSTOM_BORDER_TRANSITIONS *^Sst 100 sandstorm/sstorm}
Code: Select all
#define CUSTOM_TERRAIN_BASE TYPE LAYER IMAGESTEM
[terrain_graphics]
[tile]
type={TYPE}
x=0
y=0
[/tile]
[image]
layer={LAYER}
name={IMAGESTEM}.png
[/image]
[/terrain_graphics]
#enddef
#define BORDER_TRANSITION_BUILDER TYPE LAYER IMAGESTEM
[tile]
pos=1
type=!,{TYPE}
[image]
layer={LAYER}
name={IMAGESTEM}
[/image]
[/tile]
[tile]
pos=2
type=!,{TYPE}
[/tile]
[tile]
pos=3
type={TYPE}
[/tile]
#enddef
#define CUSTOM_BORDER_TRANSITIONS TYPE LAYER IMAGESTEM
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-all.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
2 , 2
, 1 ,
* , *
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-n.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
* , 3
, 1 ,
* , 2
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-ne.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
* , 3
, 1 ,
* , 3
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-ne-se.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
* , 3
, 1 ,
2 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-ne-se-s.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
2 , 3
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-ne-se-s-sw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
3 , 3
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-ne-se-s-sw-nw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
2 , 3
, 1 ,
* , 2
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-n-ne.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
2 , 3
, 1 ,
* , 3
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-n-ne-se.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
2 , 3
, 1 ,
2 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-n-ne-se-s.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
2 , 3
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-n-ne-se-s-sw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
3 , *
, 1 ,
2 , *
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-nw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 2
, 1 ,
2 , *
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-nw-n.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
2 , 2
, * ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-nw-n-ne.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
2 , 3
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-nw-n-ne-se.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
2 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-nw-n-ne-se-s.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
* , *
, 1 ,
2 , 2
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-s.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
* , 2
, 1 ,
* , 3
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-se.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
* , 2
, 1 ,
2 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-se-s.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
2 , 2
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-se-s-sw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
3 , 2
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-se-s-sw-nw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 2
, 1 ,
3 , 3
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-se-s-sw-nw-n.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
2 , *
, 1 ,
3 , 2
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-s-sw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
3 , *
, 1 ,
3 , 2
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-s-sw-nw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 2
, 1 ,
3 , 2
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-s-sw-nw-n.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
3 , 2
, 3 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-s-sw-nw-n-ne.png}
[/terrain_graphics]
[terrain_graphics]
map="
, * ,
2 , *
, 1 ,
3 , *
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-sw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 2 ,
3 , *
, 1 ,
3 , *
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-sw-nw.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 2
, 1 ,
3 , *
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-sw-nw-n.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
3 , 2
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-sw-nw-n-ne.png}
[/terrain_graphics]
[terrain_graphics]
map="
, 3 ,
3 , 3
, 1 ,
3 , 3
, 2 ,"
{BORDER_TRANSITION_BUILDER {TYPE} {LAYER} {IMAGESTEM}-sw-nw-n-ne-se.png}
[/terrain_graphics]
#enddef
Last edited by MoonyDragon on June 13th, 2019, 11:32 pm, edited 2 times in total.
Default L0 Era - Level 1 leaders with level 0 recruits!
Re: Sand Storm Terrain
Wow. I don't know if there's a better solution, but thanks for sharing your solution!
Re: Sand Storm Terrain
You need to enter by I in left corner data/core/terrain-graphics to access other macros for terrain.
Re: Sand Storm Terrain
Hi,
I'll admit that I'm doing a bit of a drive-by and haven't thought about terrain graphics recently, but I'm pretty surprised that you'd have to invent the wheel. It looks like you tried using the terrain rules for void, which doesn't have translucent transition images. The overlapping transition images is a pretty common issue, did you try using NEW:TRANSITION?
The terrain-graphics macros onion-layers can be annoying to dig through, but they mostly exist for a reason, mostly for transitions to other terrains.
I'll admit that I'm doing a bit of a drive-by and haven't thought about terrain graphics recently, but I'm pretty surprised that you'd have to invent the wheel. It looks like you tried using the terrain rules for void, which doesn't have translucent transition images. The overlapping transition images is a pretty common issue, did you try using NEW:TRANSITION?
The terrain-graphics macros onion-layers can be annoying to dig through, but they mostly exist for a reason, mostly for transitions to other terrains.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
Hi doofus-01,
I have indeed tried the NEW:TRANSITION macro before I asked this question, but with no success:
1. It causes some border transitions to simply disappear (see: Desert Sands - Desert Mountains in the pictures below). I suppose that is because it is used in those transitions aswell, causing them to interfere in buggy ways.
2. If there are more than 5 adjacent tiles of the same terrain, I end up exactly where I started: amidst overlapping transitions... Its impossible to dispose of those variants, as I have some lonely Desert Tents scattered in my maps.
CUSTOM_BORDER_TRANSITIONS: NEW:TRANSITION:
At this point, i suppose its easier to reinvent the square wheel a couple of times rather than digging into computer-generated piles of macros. Sorry to disappoint you with my laziness - I simply settle for this solution and declare the first question "solved (more or less)".
cheers
I have indeed tried the NEW:TRANSITION macro before I asked this question, but with no success:
1. It causes some border transitions to simply disappear (see: Desert Sands - Desert Mountains in the pictures below). I suppose that is because it is used in those transitions aswell, causing them to interfere in buggy ways.
2. If there are more than 5 adjacent tiles of the same terrain, I end up exactly where I started: amidst overlapping transitions... Its impossible to dispose of those variants, as I have some lonely Desert Tents scattered in my maps.
CUSTOM_BORDER_TRANSITIONS: NEW:TRANSITION:
At this point, i suppose its easier to reinvent the square wheel a couple of times rather than digging into computer-generated piles of macros. Sorry to disappoint you with my laziness - I simply settle for this solution and declare the first question "solved (more or less)".
cheers
Default L0 Era - Level 1 leaders with level 0 recruits!
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
Update on the second question
Dismissing the possibility of creating a completely new alias with its own movement costs, I decided to use the Frozen alias instead. But because a terrain with both Sand and Frozen aliases would look contradictory, I set up a proxy-terrain that is Frozen for all intents and purposes, but uses the Fog icon. And when my Sand Storm terrain referenced this proxy, it displays the Fog icon as follows: What drives me crazy, however, is that the icon is displayed in red, a color usually reserved for impassable or unwalkable terrain. And just as other terrain aliases have their own color, I'd like to change the color of the Sand Storm terrain to the same yellow as in the Sand icon. Is there a way of doing it?
As usual, my solution is given below:
Dismissing the possibility of creating a completely new alias with its own movement costs, I decided to use the Frozen alias instead. But because a terrain with both Sand and Frozen aliases would look contradictory, I set up a proxy-terrain that is Frozen for all intents and purposes, but uses the Fog icon. And when my Sand Storm terrain referenced this proxy, it displays the Fog icon as follows: What drives me crazy, however, is that the icon is displayed in red, a color usually reserved for impassable or unwalkable terrain. And just as other terrain aliases have their own color, I'd like to change the color of the Sand Storm terrain to the same yellow as in the Sand icon. Is there a way of doing it?
As usual, my solution is given below:
Code: Select all
[terrain_type]
icon_image=symbols/terrain_type_fog
id=sandstorm_proxy
string=Ssp
aliasof=At
hidden=yes
hide_help=yes
[/terrain_type]
[terrain_type]
symbol_image=sandstorm/sstorm
editor_image=sandstorm/sstorm-n-ne-se-s
id=sandstorm
name="Sandstorm"
editor_name="Sandstorm"
string=^Sst
aliasof=_bas
def_alias=_bas
mvt_alias=Ssp
vision_alias=Ssp
editor_group=desert
[/terrain_type]
Default L0 Era - Level 1 leaders with level 0 recruits!
Re: Sand Storm Terrain
I don't have a good answer, but can just describe what I would look at (as someone who once was concerned with terrain graphics) if I were in your shoes:
Where are icon_image=symbols/terrain_type_frozen, and similar things stored? Are these the images you want to change? I found <wesnoth>/images/icons/terrain images, not sure if those are aliased or what. Is your icon_image field tied to whatever is in the the "symbols" directory, or can you point that field to something of your own?
Probably doesn't help much, but maybe...
Where are icon_image=symbols/terrain_type_frozen, and similar things stored? Are these the images you want to change? I found <wesnoth>/images/icons/terrain images, not sure if those are aliased or what. Is your icon_image field tied to whatever is in the the "symbols" directory, or can you point that field to something of your own?
Probably doesn't help much, but maybe...
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
The symbols/ directory is indeed found in "<wesnoth>/images/icons/terrain". and as far as I have tried out, the terrain icons you may use are indeed limited to what you find there. I assumed that these transparent icons would be layered on the colored background, and tried to circumvent the red color by referencing this non-transparent image:
Sadly for me, this time there wasnt any icon at all, only the red background... So no, apparently you cannot reference anything outside the symbols/ directory (or at least non-transparent images).Default L0 Era - Level 1 leaders with level 0 recruits!
Re: Sand Storm Terrain
So, it turns out, the background color of the terrain icon is determined by the [color_range] tags in data/core/team-colors.cfg. For example, the yellow background of the sand terrain icon is determined by these lines:MoonyDragon wrote: ↑May 26th, 2019, 1:18 pm What drives me crazy, however, is that the icon is displayed in red, a color usually reserved for impassable or unwalkable terrain. And just as other terrain aliases have their own color, I'd like to change the color of the Sand Storm terrain to the same yellow as in the Sand icon. Is there a way of doing it?
Code: Select all
[color_range]
id=sand
rgb=F1CE6C,FFFCC0,4A3212,B19D66 #F1CE6C
name= _ "Sand"
[/color_range]
edit: The background might be magenta because wesnoth doesn't find a matching [color_range] tag.
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: Sand Storm Terrain
UPDATE: The second question is solved
A big thanks to everyone here! I inserted josteph's code into my terrain.cfg file and now everything works as intended
You will see this terrain in my upcoming UMC campaign!
A big thanks to everyone here! I inserted josteph's code into my terrain.cfg file and now everything works as intended
You will see this terrain in my upcoming UMC campaign!
Default L0 Era - Level 1 leaders with level 0 recruits!
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Sand Storm Terrain
Though you've solved your issue, I'd like to suggest that it's probably better practice to use a new alias rather than aliasing it to frozen. You can then use movetype patching to ensure that all units get sensible values for the new terrain. If you're certain you'll never want sandstorm and ice to have different movements, or you're certain that you'll never use ice, then I guess your method is fine, but...