Topic: field.height setting (in editor) misbehaves
Tibor Topic Opener |
Posted at: 2014-01-08, 22:55
Hi
Top Quote |
wl-zocker |
Posted at: 2014-01-08, 23:18
Not sure if that is the reason, but have a look at https://wl.widelands.org/docs/wl/autogen_wl_map/#field (height vs. raw_height). The map is recalculated after setting the height. And I think the default value is 10, but I am not sure. "Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-08, 23:24
Hi, the first step in my script is iterate over all fields and set height to 0. But I did not check if it is working properly... So this is why I said that old value is usually 0 But to the topic: I understand difference between height and raw_height. "height" should trigger recalculation of all affected fields. Visually (when looking on map) it does this, but the height the central pixel is not set as ordered. Top Quote |
SirVer |
Posted at: 2014-01-09, 08:22
.height has to adhere to the constraints of the map, i.e. neighbouring fields are not allowed to be too different in height - otherwise the game looks funky and broken. If you want to randomize more than one height you should use .raw_height and then call https://wl.widelands.org/docs/wl/autogen_wl_map/#wl.map.Map.recalculate. If you fail to do this the outcome is undefined. recalculate() will reestablish the invariants that are required by the Widelands map. The height values of fields that are too different might change again for this. height is a value between 0 and 63 (I think), 10 is the 'sea level'. And you are correct that setting .height to a value that is too different to it's current value might not set it to the value you expect it to - because the renormalization of neighbouring fields has no understanding which one is the 'correct' one and moves all of them a bit. Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-09, 21:09
Well, .recalculate() somehow doesnt work properly, but I am not willing now investigate it more now. I came with a workaround - repeat field.height=x in loop until the target height is achieved! Top Quote |
SirVer |
Posted at: 2014-01-10, 07:00
Well, .recalculate() does work - in the way I described. You are probably setting the heights of neighboring fields too differently. Setting field.height in a loop will also not do the right think: while the field you are currently looking at will get the correct heigh, as soon as you change a field in its neighborhood dramatically, its height will change again. Oh, I forget in my last post. In the editor there is the Info tool (hotkey i) that will give you the height of individual fields. Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-10, 22:03
Well, I can live with what is available now, but in theory something like .forced_height might be useful. But for a handfull of peoples who would ever use it it is not worth the effort And thanks for "i" option - very very very useful!!! Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-11, 22:15
SirVer, How to get rid of "i" mode? It keeps generating new popup windows with any impulse from me... Top Quote |
SirVer |
Posted at: 2014-01-12, 06:41
The ghosts you called for .... No, seriously, I do not understand the question. Does it open new windows even when you move the mouse and not click on anything? It is just a regular tool, so if you select another one (i.e. setting height of fields) it goes away - you have to manually close the windows it created though. the "i" tool is basically a debugging aid and not very polished Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-12, 20:43
I noticed that SOMETIMES when I want to get rid of "i" popup window and clicking on it with right mouse, it seems there are many - like 10 or more popup windows that I has to get rid of before there is no window. So it seems there is some event that is triggering new "i" windows. All are stacked on the same place so you can not see how many they are. But in general I dont use this much so no big issue for me... Top Quote |