Various WML questions about Terrain

The place to post your WML questions and answers.

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.
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Various WML questions about Terrain

Post by Alarantalara »

Eleazar wrote:OK, the "!" means "Not" in the following context, but how do i interpret a line with two "!"?

Code: Select all

{TRANSITION_COMPLETE_LF    (!,Chw,Khw,Khs,!,C*,K*)            W*          -510 submerged_part     castle/castle-to-water}
I've been wondering that myself for a while, but your question finally prompted me to find out. I took a look at the source and it works like this. ! actually just reverses the meaning of what follows and can be applied again to reverse it again.
So your line means to not match Chw,Khw,Khs (the current water castles) but to match any other castle or keep. It's more reliable than having to keep changing the list whenever a new castle type is added.

To follow the computer's logic:
Start in the state that if the terrain matches there is a match.
See ! switch to state that there is NOT a match if the terrain matches.
Check for Chw, Khw, Khs in order, if match then this rule does not apply.
See !: switch back to f the terrain matches there is a match.
Check for C*, K* in order, if match then this rule DOES apply.
If no match to this point, rule does not apply.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

Thanks, A6. That will come in handy.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

I got my double-sided transitions to work.

Apparently the secret (though i have no clue why) is to list them a second time in the reverse order. Note that the first "LF" macro is for "Gs", and last "L" macro is for "Gs". If i reorder the lines, making (for instance) "Gs" the first "L" macro, "Gg" transitions will no longer be drawn over "Gs".

Code: Select all

{TRANSITION_COMPLETE_LF     Gs            Gg,Gd                      -261   transition3     flat/savanna-long}
{TRANSITION_COMPLETE_LF     Gg            Gs,Gd                      -262   transition3     flat/grass-long}
{TRANSITION_COMPLETE_LF     Gd            Gg,Gs                      -263   transition3     flat/grass-dry-long}

{TRANSITION_COMPLETE_L      Gd            (Gg,Gs)                    -266                   flat/grass-dry-long}
{TRANSITION_COMPLETE_L      Gg            (Gs,Gd)                    -264                   flat/grass-long}
{TRANSITION_COMPLETE_L      Gs            (Gg,Gd)                    -265                   flat/savanna-long}
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

As Alink reminded me we have a feature that used to enable villages to have lit windows at night.

I don't want to do all the villages right now, but i thought i'd add lit windows to a common village set to raise awareness of this feature and hopefully spur others on to add these.

However, i don't know how to name these alternate images so the game can find them, or if additional lines are needed in terrain-graphics.cfg.

The exact details of how to use this feature and weather it currently only works on base tiles or might also work on transitions (i.e. castles) would be welcome.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Various WML questions about Terrain

Post by Alarantalara »

I had been thinking about creating a fairy-like tile which had glowing plants at night, so I tried it out a week or so ago. To add alternate images based on the time of day, the image tag needs some extra information. This means that the existing macros don't handle this case at all. When I get home from work, I'll try out some possible solutions that might work nicely within the existing context. It will probably need a new, more complicated macro to work correctly. Just adding more lines to terrain-graphics probably won't work because of the random variations: it shouldn't change variation from day to night.

Transitions should work fine, though I don't know what happens with time of day areas yet.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

If it requires new macros, i'll let it pass for now.

The macro situation with the way they are being interpreted is currently pretty slow-- i don't think we want to add anything major ATM
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Various WML questions about Terrain

Post by Alarantalara »

I'll leave it for now then. It might be possible to sneak it in using the _B forms of the macros, but it wouldn't be KISS at all.

Basically the current macros eventually turn into this:

Code: Select all

[image]
    name=imagename.png
    layer=0
    center=90,144
[/image]
and the time of day forms want it to look like this:

Code: Select all

[image]
    name=imagename.png
    layer=0
    center=90,144
    [variation]
        tod=<time of day from schedule.cfg - e.g. morning>
        name=imagenamefortod.png # this would probably include a time suffix + the image name from above
    [/variation]
[/image]
The only way to get that extra piece is to write a new base macro or possibly make a really fancy {BUILDER} macro.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

OK, i have IMHO a pretty decent system for making mountains blend in nicely with various kind of terrain. The only problem is i can't get any transitions to draw over the mountains. Is there something special going on with mountains?

Half of it works fine, I.E. the second line below (from terrain-graphics.cfg now in trunk) correctly uses the dry hills transition whenever the mountains are next to dry terrain. But i need the other half, i.e the transition that gets drawn over the mountain.

Code: Select all

# Special mountain to dry trans
{TRANSITION_COMPLETE_LF    (Hhd,Rb,Re,Rd,D*)   M*                        -165  transition3  mountains/blend-from-dry}
{TRANSITION_COMPLETE_L     (Mm)             (Hhd,Re,Rd,D*)               -166               hills/dry}
I also tried reversing "(Hhd,Rb,Re,Rd,D*)" and "M*", but in neither case did the transition show up.

See attached image for what i want and what i'm getting.

I also want to use a transition over mountains when they are next to chasms, though that will be multi-hex.
Attachments
dry trans.jpg
dry trans.jpg (168.77 KiB) Viewed 3469 times
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: Various WML questions about Terrain

Post by Exasperation »

A quick look through mountains.cfg seems to suggest (and some experimentation confirms) that mountains are drawn on layers 0 to 2. That puts them on top of your layer -165 transitions.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

Thanks Exasperation. I'm not used to going outside terrain-graphics, since most of those macro CFGs just confuse me.

That sorta did the trick:

Putting them on layer 3 makes puts them over the mountains, but also over things like castles, and tall trees.
Attachments
dry mountains.jpg
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: Various WML questions about Terrain

Post by Exasperation »

Yeah, it looks like forests etc. are also set up on the same layers as mountains so that whichever one is to the S and E will wind up on top - I think that's going to cause you problems. Crazy idea follows:

Would it work to make the base of the mountain partially transparent so that what's underneath shows through, put a default under-image at layer -2 in the mountains' macro to take care of situations where there's no transition from the surrounding terrain (could probably just reuse the grassland hex or something), and put the transitions into the mountains at layer -1?
Tet
Posts: 391
Joined: February 18th, 2009, 5:11 am

Re: Various WML questions about Terrain

Post by Tet »

If the mountain is to high, I would lower the mountain. Units are supposed to be on layer 0.
My Temple Project: http://forums.wesnoth.org/viewtopic.php?f=23&t=29800
This is "must-play" campaign! Don´t read the thread, unless you need help. http://forums.wesnoth.org/viewtopic.php?f=8&t=31895
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

Exasperation wrote:Crazy idea follows:

Would it work to make the base of the mountain partially transparent so that what's underneath shows through, put a default under-image at layer -2 in the mountains' macro to take care of situations where there's no transition from the surrounding terrain (could probably just reuse the grassland hex or something), and put the transitions into the mountains at layer -1?
No.

1) I don't want all the edges transparent, which would make the mountains blurry

2) a default under-image doesn't improve anything. What i'm trying to do is make the edges of the mountains different depending on what they are next to.

EDIT: I hadn't realized it before, but mountains are actually overlay terrain and do have a default under-image (hills).
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Various WML questions about Terrain

Post by Eleazar »

OK, to try to solve layering issues, i set mountains and bridges to layer 0.
With the exception of setting mountains and bridges to layer 0, this image is the same as trunk.

Several of the results are not what i expected:
layers.jpg
1) If mountains and castle walls are both 0, how does this layering come about?

2) This is very weird. The mountains and bridge used are single graphics each. I.E the top of the mountain is the same image as the base of the mountian, and the foot of the bridge is the same image as the bulk of the bridge. what's going on here?
EDIT: This stuff also happens with castles and cave walls, but not with forests. Since all these things are on the same layer i really don't understand.

3) The mountains don't overlap the bridge in most cases. I can't figure out what the exception is.

4) This dry-to-mountain transition always overlaps the bridge. I don't understand why. While A) the trans is based from the dry hex to the south, that means the bridge and trans are based in the same hex. B) since the bridge is defined earlier in terrain-graphcs.cfg, i thought that meant it would be drawn on top.

5) Here again, the swamp grass is on layer 0 as is the bridge. Why then is the northern-most overlay drawing over the southern-most one?

EDIT: all this stuff is still happening after alink's latest commits.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Yoyobuae
Posts: 408
Joined: July 24th, 2009, 8:38 pm

Re: Various WML questions about Terrain

Post by Yoyobuae »

Question: Would it be possible to have a command in Wesnoth to dump a huge list with all the images used to render the currently displayed playing field? (in layering order perhaps)

Would be a great tool to debug terrain layering.
Post Reply