Need help for custom terrain transitions
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.
Need help for custom terrain transitions
I did try to make a clone dwarfish castle with a unique floor. The coding as custom terrain is proofing difficult.
I have an issue with the bridge in front of the tower. The second issue is the wooden keep which is appearing without any code. I just want it to be gone. Any ideas?
I have an issue with the bridge in front of the tower. The second issue is the wooden keep which is appearing without any code. I just want it to be gone. Any ideas?
Re: Need help for custom terrain transitions
I'd use a different terrain code, that doesn't start with Ku or Cu, if I wanted to avoid being affected by mainline transition rules.Wussel wrote:The second issue is the wooden keep which is appearing without any code. I just want it to be gone. Any ideas?
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
Re: Need help for custom terrain transitions
But that is exactly what I want! It is supposed to be a castle. An underground castle. Like the dwarfish one. I was assuming the mainline rules would be benefiting this castle too. It is just a floor variation. Or at least it should be. Could you elaborate at your advice???
Re: Need help for custom terrain transitions
Use the same macros as the terrain you want, as you see them in the data/core/terrain-graphics.cfg file, but change the terrain code filtering. If you make the terrain code something like "Zkul", and specify the dwarf wall images in your own rules for "Zkul", it won't be affected by all the seemingly unrelated transition rules(EDIT: random stuff, apparently) filtering for "K*" or "Ku*".
Last edited by doofus-01 on June 17th, 2015, 3:35 am, edited 1 time in total.
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
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Need help for custom terrain transitions
For the bridge problem, it looks like a layering issue. The NEW:WALL macro should normally avoid such issues - are you using it or something custom?
The DISABLE_WALL_TRANSITIONS macro is available specifically to deal with the encampment problem. Just include it after all your other wall transitions and any you skip will be taken care of (in this case keep to castle).
I'd suggest keeping the K and C prefixes to start the name of the terrain. It affects some animations and Lua AI logic (e.g. the Experimental AI in multiplayer) so not using them can cause interesting issues. It also makes it easier to implement any abilities related to being on castles or keeps if you're interested in such.
The DISABLE_WALL_TRANSITIONS macro is available specifically to deal with the encampment problem. Just include it after all your other wall transitions and any you skip will be taken care of (in this case keep to castle).
I'd suggest keeping the K and C prefixes to start the name of the terrain. It affects some animations and Lua AI logic (e.g. the Experimental AI in multiplayer) so not using them can cause interesting issues. It also makes it easier to implement any abilities related to being on castles or keeps if you're interested in such.
Re: Need help for custom terrain transitions
That "disable wall transition" is awesome!
The bridge is still a mystery to me. The mountains are doing the same thing. They go over the towers in my cloning of the dwarven castle. Is there any word of advice?
On top I would like a hint about the new bridge macro. There was only 1 before. Now there are 3?
Is there a help for all the new terrain macros anywhere?? Please give some direction.
The bridge is still a mystery to me. The mountains are doing the same thing. They go over the towers in my cloning of the dwarven castle. Is there any word of advice?
On top I would like a hint about the new bridge macro. There was only 1 before. Now there are 3?
Is there a help for all the new terrain macros anywhere?? Please give some direction.
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Need help for custom terrain transitions
There isn't that much help unfortunately. There's a thread I started that covers the WML tags in some detail but basically ignores most of the macros since apart from some of the very common ones, most are so specific to individual terrains that it's unlikely people would use them and for those that do, they're so limited that just drawing over the graphics for and existing use and picking a new terrain code approaches the limit of what is possible with them.
Generally, it's much easier to give advice about terrain WML and macros if we can read what you have since what you write is never isolated (unlike with other WML) and so advice, especially about drawing order, generally needs to see what is there to know what is going wrong.
Generally, it's much easier to give advice about terrain WML and macros if we can read what you have since what you write is never isolated (unlike with other WML) and so advice, especially about drawing order, generally needs to see what is there to know what is going wrong.
Re: Need help for custom terrain transitions
The bridge line is not doing anything. I did not write anything about the mountains. I would guess I need the transition towards the dwarvish castle and redo it somehow.
Code: Select all
# Dark castle terrain graphics
{TERRAIN_BASE_RANDOM Cul castle/dark/floor }
{TERRAIN_BASE_RANDOM Kul castle/dark/floor }
{OVERLAY Kul castle/dark/keep-overlay }
# Dark castle transitions
{DISABLE_BASE_TRANSITIONS Cul,Kul}
{WALL_TRANSITION3 (Cul,Kul) Ql* Qx* unwalkable/dcastle-lava-chasm}
{NEW:WALL2 (Cul,Kul) X* (!,Cul,Kul,X*) castle/dwarven-castle-wall}
{NEW:WALL2 (Cul,Kul) Ql* (!,Cul,Kul,Ql*) unwalkable/dcastle-lava}
{NEW:WALL2 (Cul,Kul) Qx* (!,Cul,Kul,Qx*) unwalkable/dcastle-chasm}
{NEW:WALL (Cul,Kul) (!,Cul,Kul,X*) castle/dwarven-castle}
{NEW:WALL Xu* (Cul,Kul) cave/wall-rough}
{DISABLE_WALL_TRANSITIONS Cul,Kul}
{BRIDGE:ENDS Bsb\ Bsb| Bsb/ * (Cul,Kul) * stonebridge -80 bridge/stonebridge-castle}
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Need help for custom terrain transitions
The bridge macros actually don't have anything to do with the chasm bridges. Adding them will not do what you think— they're for the complex multi-piece bridges like the wooden bridge or other ones that can extend multiple tiles.
This is actually a bug related to how the art is drawn and is just less noticeable on the default ground. It's not something that can be fixed other than by taking the images from core, chopping them into two pieces and adding more transition rules. If you did manage to get the bridge to go underneath, you'd discover that the chasm would cover the bridge making it disconnected in some way.
So, to fix this you need to:
Take all the unwalkable/dchasm images and separate the bottom part from the top.
Use the existing new:wall macro with the top parts.
Use the old WALL_TRANSITION_LF macro (which is more versatile which is why it hasn't been replaced entirely) to do the bottom part of the chasm images that were separated
Use the OVERLAY_LF macros to draw the bridges at layer -1 instead of 0 with the bridge flag.
If you do do all of this, then the next step is probably to submit a pull request to the wesnoth repository, since you'll have fixed a bug in the game.
Once that is accepted, you can then delete your copy of the images and OVERLAY macros for 1.13 and become a contributor.
This is actually a bug related to how the art is drawn and is just less noticeable on the default ground. It's not something that can be fixed other than by taking the images from core, chopping them into two pieces and adding more transition rules. If you did manage to get the bridge to go underneath, you'd discover that the chasm would cover the bridge making it disconnected in some way.
So, to fix this you need to:
Take all the unwalkable/dchasm images and separate the bottom part from the top.
Use the existing new:wall macro with the top parts.
Use the old WALL_TRANSITION_LF macro (which is more versatile which is why it hasn't been replaced entirely) to do the bottom part of the chasm images that were separated
Use the OVERLAY_LF macros to draw the bridges at layer -1 instead of 0 with the bridge flag.
If you do do all of this, then the next step is probably to submit a pull request to the wesnoth repository, since you'll have fixed a bug in the game.
Once that is accepted, you can then delete your copy of the images and OVERLAY macros for 1.13 and become a contributor.
Re: Need help for custom terrain transitions
Sounds awesome. Bug fixing. Why does the most annoying stacking error with oversized units never gets fixed?
I still would like to know how the regular dwarven castle is doing it. (Mountain and chasm bridge at least.)
I still would like to know how the regular dwarven castle is doing it. (Mountain and chasm bridge at least.)
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Need help for custom terrain transitions
It doesn't avoid the problem, it's just harder to see because everything is grey.
Re: Need help for custom terrain transitions
Nope, the tower gets over bridges and mountain for the regular dwarvish castle. So I still would like an answer.
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Need help for custom terrain transitions
Layering rules.
Images are drawn one at a time in an order partially dependent on the order the rules appear in the file. Unfortunately, to allow add-ons to override the core rules, this means that all core images are drawn after, and therefore on top of, all images from add-ons that have the same layer and base. For more details, see this post I wrote some time ago as part of my giant incomplete tutorial.
http://forums.wesnoth.org/viewtopic.php ... 15#p498519
The giant fix I described above is one way to fix it for everyone (since it will allow the bridges to be moved to a lower layer).
You can reach the same level of fixed as core by copying all the rules for the terrains that are misbehaving into your file and making sure that they appear before your wall rules in the file. Note that this doesn't completely fix the problem (unlike the previously proposed fix), since while the bridge is drawn behind the tower, it's still drawn on top of the wall behind it.
Images are drawn one at a time in an order partially dependent on the order the rules appear in the file. Unfortunately, to allow add-ons to override the core rules, this means that all core images are drawn after, and therefore on top of, all images from add-ons that have the same layer and base. For more details, see this post I wrote some time ago as part of my giant incomplete tutorial.
http://forums.wesnoth.org/viewtopic.php ... 15#p498519
The giant fix I described above is one way to fix it for everyone (since it will allow the bridges to be moved to a lower layer).
You can reach the same level of fixed as core by copying all the rules for the terrains that are misbehaving into your file and making sure that they appear before your wall rules in the file. Note that this doesn't completely fix the problem (unlike the previously proposed fix), since while the bridge is drawn behind the tower, it's still drawn on top of the wall behind it.