My wiki adventures (Wml optimisation)

For writers working on documentation, story prose, announcements, and all kinds of Wesnoth text.

Moderator: Forum Moderators

Post Reply
User avatar
Dunno
Posts: 773
Joined: January 17th, 2010, 4:06 pm
Location: Behind you

My wiki adventures (Wml optimisation)

Post by Dunno »

Hi,
I haven't made a decent, finished add-on because I've "moved on" to the higher level of programming and I got addicted to python. But, I've learned quite a lot here and I thought I should contribute as much as I can to the wiki to help the others. It's the least I can do. I'm thinking about adding more examples here and there, expanding some sub-sections and maybe adding brand-new articles.

My first shot is the WML optimisation, since I've had problems with it myself and Dugi's rant reminded me of it. Before I'll scatter links to this article around the wiki, I'd like to ask if there are any objections. It's been a while since I'd used wml and maybe this page makes no sense.

Thanks!
Oh, I'm sorry, did I break your concentration?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: My wiki adventures (Wml optimisation)

Post by zookeeper »

Looks like a good idea to me.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: My wiki adventures (Wml optimisation)

Post by Dugi »

It's well written and understandable (for me, I can't speak for others).

Ever heard of the trick to solve problems with large WML blocks inserted into all scenarios (that is needed if you're adding some extra functionality, based on a load of events that have to be in each scenario)? They cause long periods the game needs to load and large RAM consumption. The solution is to put these events into a dummy unit, create and kill it in prestart (the creation and killing can be finely a macro, the dummy unit holds all the WML), and this adds the events it holds. It can be also done by lua, but it would be almost identical, just without the need to use the macro. I think that it might be worth including there too, what do you think?

I also know a trick to optimalise problems related to too many AMLA options (if there is more than a hundred of them, it causes severe framerate drops), but it's extremely ugly, and even uglier on on 1.11.1 and later.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: My wiki adventures (Wml optimisation)

Post by zookeeper »

Dugi wrote:It's well written and understandable (for me, I can't speak for others).

Ever heard of the trick to solve problems with large WML blocks inserted into all scenarios (that is needed if you're adding some extra functionality, based on a load of events that have to be in each scenario)? The solution is to put these events into a dummy unit, create and kill it in prestart (the creation and killing can be finely a macro, the dummy unit holds all the WML), and this adds the events it holds. I think that it might be worth including there too, what do you think?
:shock: I don't think that's something one would want to confuse non-advanced people with. I mean, it's certainly a clever idea but it sounds like a big enough hack that I wouldn't suggest it to anyone who's going to learn anything from that wiki page. Doesn't mean we couldn't have a separate page for all sorts of advanced hacky tricks, though, in case UsefulWMLFragments isn't up for the task.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: My wiki adventures (Wml optimisation)

Post by iceiceice »

Just a thought -- probably we should use the discussion page of the wiki to discuss the actual content, and only put on the forum stuff that it doesn't make sense to put there, e.g. "I'd like to ask if there are any objections [to having this page in the first place]".

Dugi: Maybe just a note, like one sentence towards end, explaining that scenario & era wml is cached but unit wml is not so sometimes moving wml to units can improve performance? (This is just what I took away from your note.)
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: My wiki adventures (Wml optimisation)

Post by Dugi »

zookeeper wrote: Doesn't mean we couldn't have a separate page for all sorts of advanced hacky tricks, though, in case UsefulWMLFragments isn't up for the task.
This sounds like a good idea. I'll write it when I'll have more time. It took me long to figure these tricks out and I think that some people might find it useful.
iceiceice wrote:Maybe just a note, like one sentence towards end, explaining that scenario & era wml is cached but unit wml is not so sometimes moving wml to units can improve performance? (This is just what I took away from your note.)
UnitWML is loaded as well, there is pretty much no way to avoid it. But the point is that it is loaded only once, and not for every scenario, because it is not the content of these scenarios, it's just added into one scenario when you start playing it.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: My wiki adventures (Wml optimisation)

Post by Dugi »

I wrote:I'll write it when I'll have more time.
I have posted my most precious WML secrets on the wiki. Read it with extreme care, they are powerful and hard to control.
Post Reply