Graphical issues when a unit's modifications are too long

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Graphical issues when a unit's modifications are too long

Post by Dugi »

My campaign works quite badly on certain computers, and we have managed to identify the cause of the problem as excessively much data in the [modifications] tag. I mean something like a dozen of [object]s and about twenty [advance]s.
It is known to appear on Windows Vista, Windows XP Black Edition, but not on Windows XP Service Pack 3 or other WinXPs. I tested it only on Linux, and I didn't notice any problems of this kind. I suspect that something from outside is causing the game to recalculate or reload some data (and if [modifications] is too long, it takes it a lot of time).
Nothing related appeared in stderr.txt.

Here is a copy of the conversation about this (with a few additional notes and filtered unrelated things):
minardians wrote:Why's that after I put items and gears, the way the game scrolled become a lot slower?There's nothing wrong with other campaign nor other part of map. Just when I scroll the map where Lethalia and Efraim {leaders and strongest units} in full gear are battling with hordes of troops, the game become a lot lagging. Is there something I can do about this? I've tuned down the display that may make the game slower, but it doesn't help much.
minardians wrote:My machine is the one I use to work, here's the spec :
image
There's no problem with lagging with other campaigns anyway, so I think the problem might lay with how the program read your scenario, the more I accumulate items, the crazier the lagging become. I've increase the program's priority in task manager with no avail, and hackspeed with CE doesn't give anything either.
Dugi wrote:{Verified that it's not related to overlays, as I first thought}
minardians wrote:Hmm.. on other computer it's just run smoothly, ....
Vagnard wrote:First a mere nuissance, it gradualy became worse to a point of unplayability. It happens every time a mid-lvl Efraim or Lethalia is onscreen, all other units work fine. After a bit of testing in debug mode the culprit seems to be the update system. The more experienced (and thus more versatile attackwise) a unit gets, the heavier the effect on performance. Other units begin to slow things down also, but the kind of xp needed to acomplish this just isn't there in normal gameplay.

I'll attach a savegame that shows what I described. {The save file worked without any issues on Linux}

I'm running Wesnoth 1.11. The PC is more than capable of handling it, but just for the heck of it I assigned high priority and full adressset to the .exe, unfortunately without any measurable difference.
Dugi wrote:..According to the results, it appears on Windows XP, and only on certain installations..
minardians wrote:I came to same conclusion either. Those who use above XP seems just have normal day. I previously already tried your suggestion, but it doesn't make any difference. Well, there's another reason to doing upgrade anyway. Anyway, thanks to your suggestion, I'll tried in dual OS machine with other version of XP, see if the problem persist, or just upgrade it to 7.

Anyway, here's the stderr.txt from my game. {stderr.txt didn't contain anything related}
Dugi wrote:Trying it on a different OS installation on the same machine might provide us some clues.
miniardians wrote:Found.
Apparently it has something to do with XP Black Edition that has been modified for gaming mode. I dont know what exactly it is, but for those who
encountered the same problem as me, I suggest to update your SP to the latest one, or revert back to original XP.
Vagnard wrote:So, it's only on my system after all, thats too bad. XP can be ruled out as the culprit as I use Vista (*sigh*).
By the way, the lag not only happens when you scroll but also when the resepctive unit is just on the screen or the unit is selected, you point your cursor anywhere and the game tries to calculate a path. Maybe this provides a different angle.

Anyway, I'm interested in the partial solution you mentioned. What exactly can be done about it?

I'll also try to make another installation of the stable Wesnoth version later and try out your campaign again.
Dugi wrote:...How long are these delays? About 70 milliseconds like on my machine?
Vagnard wrote:The lags start out in that area, but gradually become worse. At first it's just the hexagon not being under cursor instantly when you select a path, but it builds up to seeing distinct single frames during an animation, so definitly more than 70ms.

The problem also occurs in Wesnoth 1.10.04 with the same magnitude.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Graphical issues when a unit's modifications are too lon

Post by Max »

Dugi wrote:@Vagnard I was unable to replicate your error. In the save file, there were minor slowdowns when scrolling, but it occurred when any units were just being loaded to the screen, emerging from the edge. I tried it on a save file when they had maybe 30 advancements taken, and still the slowed performance when I scrolled to them was identical to the performance slowdown caused by any units (enemy units with no advancements nor objects).
a minor slowdown on a fast machine is all it takes for a slower machine to come to a halt...

i've tried Vagnards save file and was able to reproduce this issue on wesnoth 1.11, win7 and a moderately fast machine. the slowdown is most noticeable if Lethalia is placed on water (and map animation is on in preferences).

Lethalias unit definition is 15.472 lines long - that's a lot. it's obvious that the engine has to do some calculations when the unit is displayed. maybe it's not done in the most efficient way and doesn't e.g. scale well with the number of modifications/effects...

all you can do is create a bug report:
http://gna.org/bugs/index.php?group=wes ... onwanted=1

i'd base it on vagnards save file as it's for 1.11 (makes life easier for devs).
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

The circumstances are slightly different. I have a 2.2 GHz quadracore, miniargians has a 2.8 GHz dualcore, and Wesnoth can use only a single core, so his machine is better for this. Yet I experience no issues (once again, the slowdown they caused was identical to slowdown caused by units with a definitions 500 lines long). Also, his problems ceased when he switched to a different OS.
Also, there are many units with maybe 6000 lines of [advancement]s, and they don't seem to slow the game according to him. Only if this stuff is inside [modifications]. I would believe that advancements are not taken into consideration in this case, though.

I would like to believe your opinion is right, but there is a lot of evidence against it.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Graphical issues when a unit's modifications are too lon

Post by Max »

just tried it on my mac mini - shows exactly the same behavior.
i've turned debug logging on, the whiteboard is doing some stuff even if it's disabled but i'm pretty sure that's not the culprit.

could you have a look at the cpu load when you're scrolling and 1. Lethalias is not on the screen and 2. if she is? it's 100% (for one core) as soon if she's on the screen (there's also some rather heavy base load caused by animated water terrain).
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

I noticed something. When I was scrolling in and out from a place with several units (without excessively long code), the CPU usage was about 20% - 40%, when Lethalia floating above water was there, it was about 40% - 70% (but she had an animated halo, she had a standing anim herself and the water had an anim), when she was standing somewhere (not floating above anything), it was about 20% - 40%. But this was very far from jumping to 100% at any time she was on the screen. (I was using the save file he provided, I was unable to notice any difference from other units even in save files where her [modifications] were much longer, but there was not complicated terrain).
My conclusion would be that they seem to eat more CPU than other units, but not extremely large amounts. Apparently something works differently on some operating systems.

What do you think?
Vagnard
Posts: 7
Joined: September 26th, 2012, 12:13 am

Re: Graphical issues when a unit's modifications are too lon

Post by Vagnard »

Hello, thanks for trying to solve my problem.

I did some testing as well. I assigned only one core to the wesnoth process and that one did in fact reach 100% load when the respective units are onscreen or offscreen while calculating a movement. If the units are deselected and offscreen the game runs very smooth at 10-20% load.
My system is a 2,6GHz Quadcore with 8GB RAM @ 1333MHz. Operating system is an updated 64bit Vista. I already tried the compability mode for Wesnoth without any difference. GPU is a Geforce GTX 260 though thats propably less important.
User avatar
nickg4000
Posts: 28
Joined: May 25th, 2012, 12:14 pm
Location: Chichester

Re: Graphical issues when a unit's modifications are too lon

Post by nickg4000 »

Hi

I've been having this problem on Ubuntu 12.04 64bit playing BfW 1.10.3. It didn't happen before the last update... and definitely happens when Lethalia is on screen with lots of mods even if she's the only unit present. I've tried removing all the items that she's carrying but that made no difference, except I can't remove the book she's learning from and that's making a pink orb show next to her. Is that going to be causing it? i wondered if there was a way to easily switch off the image overlays in the code? I might play around with it later...

I also have a quad core processor so was wondering if Wesnoth runs on multiple cores or not?

Not quite the place for this but do you want a native English speaker to proof read the campaigns as there are a lot of awkwardly worded sentences? I did actually do this for myself with the second and third campaigns as they were the worst, but then my computer went phhhtt and I lost the corrected scripts. I'd only change dialogue rather than any code.

Edit: I've tried it with the halo switched off and no animation via preferences but that didn't make a difference

Nick
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

So you say it was okay before Wesnoth 1.10.3? That might be an important trace.
We have already proven that the overlays are not the problem, simply if a unit has too many advancements taken, it starts to lag on some computers. Mysteriously, not on mine, and I have there Ubuntu 12.04 32-bit, that is not much different. I have Wesnoth 1.10.4, but I am sure it didn't happen before, on 1.10.3 neither.
And as I said Wesnoth runs only one core, because in most cases, you don't need more.
User avatar
nickg4000
Posts: 28
Joined: May 25th, 2012, 12:14 pm
Location: Chichester

Re: Graphical issues when a unit's modifications are too lon

Post by nickg4000 »

What I meant was before the update where you made chapter 6 available, - I'm not sure what version of BfW it was. It may have been 6 months or a year ago? I think it was still 1.10.something ...

I tried 1.10.4 the day it came out and had problems so went back to 1.10.3. I'll check whether that's been sorted and then try 1.10.4 again.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

You simply updated Wesnoth and my campaign and continued playing?
In that case, to find out if it was related to a change in LotI, try to place several max level units (Elvish Assassin, Dragon Rider, Deathlord, Grim Knight...) close to each other, and see if the lag happens when you scroll over them.
User avatar
nickg4000
Posts: 28
Joined: May 25th, 2012, 12:14 pm
Location: Chichester

Re: Graphical issues when a unit's modifications are too lon

Post by nickg4000 »

I've upgraded to 1.10.4 and have the same problem with Lethalia in Chapter 5. It got so bad that I'd just leave her in the corner and did everything with Efraim and Manta.

I've just started playing chapter 6 and by the time I get to 09_Across_the_Barren_Land with Efraim I'm getting the same lag problem.
Also the enemy sides in both scenarios 08 and 09 (chapter 6) seem to take a very long time to decide what they're doing...
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

The enemy decisions are an issue of AI to attack units that have high resistances, or lots of hp or lots of damage. It appears when there is too many units that can attack your boss unit. In chapter 6, it could not be used (I suppose), but it is used in chapters 4 and 5, and will be probably used in chapters 7 and onwards.
This is unrelated to the problem investigated in this forum.

It is quite weird that the problem was tied to a single unit, while there were more units with equally long [modifications]. It is not related to [advancement]s, that were added in masses from the time the lag started, because many other units would cause the same lag.
Are you sure that there is always only one unit that causes it?
User avatar
nickg4000
Posts: 28
Joined: May 25th, 2012, 12:14 pm
Location: Chichester

Re: Graphical issues when a unit's modifications are too lon

Post by nickg4000 »

Are you sure that there is always only one unit that causes it?
It seemed that way as in chapter 5 Efraim was just as powerful as Lethalia but it didn't affect him then.

I haven't tried it but could it relate to unequipped items that they carry around? I can't see why it would but just a thought.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graphical issues when a unit's modifications are too lon

Post by Dugi »

Items carried around in the storage were nothing but a small variable container, that contained only a few information to tell other parts where to find generic information about these items. They could not be the issue.
It seemed that way as in chapter 5 Efraim was just as powerful as Lethalia but it didn't affect him then.
This is confusing me as well. Lethalia is not much different from Efraim (well, visibly, they were fairly different, but they had the same uniqueness, that was probably the cause). Can you please investigate it further?
Because it's against all logic that two units are practically the same, just one causes much more mess (and especially, it can be any of them, so the suspicion that it was related to the fact that Lethalia's float animation appears more frequently and she has a halo effect in addition).
Last edited by Dugi on October 2nd, 2012, 12:19 pm, edited 1 time in total.
User avatar
nickg4000
Posts: 28
Joined: May 25th, 2012, 12:14 pm
Location: Chichester

Re: Graphical issues when a unit's modifications are too lon

Post by nickg4000 »

In Chapter 6 fighting the orcs outside Axadria:

When Efraim is on screen he is using 100% of the CPU.
His allies are the same when he is on screen but CPU use drops to 60-80% when he is off screen.
The Orcs use 100% whether he is on or off screen
Post Reply