HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

major lag problem

03-01-2006, 01:19 AM#1
Linera
Why is this causing high lag?

Trigger:
Board Update
Collapse Events
Time - Every 0.10 seconds of game time
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Multiboard - Set the text for status_board[(Integer A)] item in column 1, row 1 to Name
Multiboard - Set the text for status_board[(Integer A)] item in column 2, row 1 to Health
Multiboard - Set the text for status_board[(Integer A)] item in column 3, row 1 to Mana
-------- ----- --------
Multiboard - Set the text for status_board[(Integer A)] item in column 1, row 2 to PlayerName[(Integer A)]
Multiboard - Set the text for status_board[(Integer A)] item in column 2, row 2 to (((String((Integer((Life of PlayersCharacter[(Integer A)]))))) + /) + (String((Integer((Max life of PlayersCharacter[(Integer A)]))))))
Multiboard - Set the text for status_board[(Integer A)] item in column 3, row 2 to (((String((Integer((Mana of PlayersCharacter[(Integer A)]))))) + /) + (String((Integer((Max mana of PlayersCharacter[(Integer A)]))))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentGroup[(Integer A)] Not equal to 0
Collapse Then - Actions
Set temp_number = (NumberOfMembers[CurrentGroup[(Integer A)]] + 1)
Multiboard - Change the number of rows for status_board[(Integer A)] to temp_number
Set temp_number = 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
InRaid[(Integer A)] Equal to True
Collapse Then - Actions
Multiboard - Change the title of status_board[(Integer A)] to Raid
Collapse Else - Actions
Multiboard - Change the title of status_board[(Integer A)] to Party
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CurrentGroup[(Player number of (Picked player))] Equal to CurrentGroup[(Integer A)]
(Picked player) Not equal to (Player((Integer A)))
Collapse Then - Actions
Multiboard - Set the text for status_board[(Integer A)] item in column 1, row temp_number to PlayerName[(Player number of (Picked player))]
Multiboard - Set the text for status_board[(Integer A)] item in column 2, row temp_number to (((String((Integer((Life of PlayersCharacter[(Player number of (Picked player))]))))) + /) + (String((Integer((Max life of PlayersCharacter[(Player number of (Picked player))]))))))
Multiboard - Set the text for status_board[(Integer A)] item in column 2, row temp_number to (((String((Integer((Mana of PlayersCharacter[(Player number of (Picked player))]))))) + /) + (String((Integer((Max mana of PlayersCharacter[(Player number of (Picked player))]))))))
Set temp_number = (temp_number + 1)
Else - Actions
Collapse Else - Actions
Multiboard - Change the number of rows for status_board[(Integer A)] to 2
Multiboard - Change the title of status_board[(Integer A)] to Solo
Multiboard - Set the width for status_board[(Integer A)] item in column 0, row 0 to 8.00% of the total screen width
03-01-2006, 01:21 AM#2
shadow1500
Make it upgrade every 1 sec maybe, and put those
Trigger:
Multiboard - Set the text for status_board[(Integer A)] item in column 1, row 1 to Name
Multiboard - Set the text for status_board[(Integer A)] item in column 2, row 1 to Health
Multiboard - Set the text for status_board[(Integer A)] item in column 3, row 1 to Mana
-------- ----- --------
Multiboard - Set the text for status_board[(Integer A)] item in column 1, row 2 to PlayerName[(Integer A)]
at map startup instead of in a periodic trigger
03-01-2006, 01:21 AM#3
Immoralis
I think you need to destroy it at the end
03-01-2006, 01:24 AM#4
Linera
it updates a tiny bit slow as it is, and 1 sec update would throw off the sync of hp and mana of the unit to the board.
03-01-2006, 01:33 AM#5
Vexorian
Most of GUI multiboard actions leak memory like heal. And it is the kind of memory leak you can't fix.

The solution is to use the JASS natives directly when modiffying multiboards

Have a nice day .

You can make it update every 5 seconds instead of 0.1 seconds that would leak 1/50 times the memory it leaks currently and no difference.

I actually think even a 30 seconds update cycle will be good enough

Edit: A clever solution would be to actually just update the multiboard when you are sure it requires to be updated.
03-01-2006, 01:35 AM#6
Linera
the health and mana is part of the board and need to always update.

reason is that healers need a way to see who is needs healing and stuff.

plus there is no way to know when hp or mana changes, no event for it.
03-01-2006, 01:46 AM#7
Immoralis
Quote:
Originally Posted by Linera
plus there is no way to know when hp or mana changes, no event for it.

detect on damage and spell use?
03-01-2006, 01:48 AM#8
Linera
there is no way to detect when a unit's health or mana changes
03-01-2006, 01:53 AM#9
Vexorian
Oh well the Optimizer's "Optimize BJ functions" method should fix the leaks.

And of course there are ways to detect when a unit's health or mana changes.

There is even a unit state event
03-01-2006, 01:59 AM#10
Linera
ahh found one for takes damage but that doesn't take for account of regen.

there is no event for when hp and mana goes up or down.
03-01-2006, 02:44 AM#11
Chuckle_Brother
I'm pretty sure that Kattana made a function for this, but unless I am mistaken it was said to leak trigger actions, but of course that can be fixed with some little use of tables or whatever.

It can be found Here. A mana one would be simple to make, just sub in the UNIT_STATE_MANA constants where they need to go and you're laughing.

Edit: Oh but the thing is that since unit's regen and all that this may effectively cause MORE lag since this would theoretically run every second, and possibly many times a second if you have lots of heroes.
03-01-2006, 04:24 PM#12
Captain Griffen
What are you trying to do? Make it to show allied hero's health and mana? If so, just turn on advanced shared control. Doesn't give control, but shows the hero icons at the side. May need to cut the number of reserved hero icons, and if you have > about 6/7 heroes it won't really work. But otherwise it is good.
03-01-2006, 04:37 PM#13
Linera
I'm trying to give an on-screen display of the players character and any he is grouped with.
for example

My hero hp mana
Party member hp mana
Party member hp mana
Party member hp mana

and i can't give control as that will allow players to control each other. like movement and stuff.
03-01-2006, 05:10 PM#14
emjlr3
anytime you are updating a multiboard every .1 sec or so with a whole boat load of things, it may get laggy(there is just to much going on between it and all the other triggers running), either update it less frequently, like 1 second, which can still be helpful(just not as up to date) but still, every 1 second will give a pretty godo idea of allies hp and mana, or scrap the idea

along with the major memory leaks this has, it may just be a bad idea all together
03-01-2006, 05:57 PM#15
Linera
What if i have a trigger update a variable then on the board it just grabs that variable on run?