| 04-03-2005, 07:28 PM | #1 |
Hey, for my td, i got a multi that shows level, player name, kills, lives, and gold. It works fine and all, but i think its makin the game laggy. As the game starts off, its fine, but as u go on in the td it gets lagger and lagger. Around the end at level 40 its so bad that its hard 2 even scroll ur screen. Heres my multiboard peridoc i used. (i constently clear it and then remake it so that itll autoupdate so if a player leaves or something itll bump all the other people on the multi up a slot). Code:
Update Multiboard 1
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Multiboard - Clear (Last created multiboard)
Multiboard - Create a multiboard with 1 columns and 1 rows, titled |c00208040Temple TD...
Set Columns = 4
Set Rows = 1
Multiboard - Change the number of columns for (Last created multiboard) to Columns
Multiboard - Change the number of rows for (Last created multiboard) to Rows
Multiboard - Set the text for (Last created multiboard) item in column 1, row Rows to |c00808000Current L...
Multiboard - Set the text for (Last created multiboard) item in column 2, row Rows to (|c00808000 + ((String(CurrentLevel)) + |r))
Set Rows = (Rows + 1)
Multiboard - Change the number of columns for (Last created multiboard) to Columns
Multiboard - Change the number of rows for (Last created multiboard) to Rows
Multiboard - Set the text for (Last created multiboard) item in column 1, row Rows to |c00208040Name:|r
Multiboard - Set the text for (Last created multiboard) item in column 2, row Rows to |c00208040Kills:|r
Multiboard - Set the text for (Last created multiboard) item in column 3, row Rows to |c00208040Lives:|r
Multiboard - Set the text for (Last created multiboard) item in column 4, row Rows to |c00208040Gold:|r
Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked player) slot status) Equal to Is playing
Then - Actions
Set Rows = (Rows + 1)
Multiboard - Change the number of columns for (Last created multiboard) to Columns
Multiboard - Change the number of rows for (Last created multiboard) to Rows
Multiboard - Set the text for (Last created multiboard) item in column 1, row Rows to (PlayerColorText[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
Multiboard - Set the text for (Last created multiboard) item in column 2, row Rows to (PlayerColorText[(Player number of (Picked player))] + ((String(KillsAll[(Player number of (Picked player))])) + |r))
Multiboard - Set the text for (Last created multiboard) item in column 3, row Rows to (PlayerColorText[(Player number of (Picked player))] + ((String(AllLivesSolo[(Player number of (Picked player))])) + |r))
Multiboard - Set the text for (Last created multiboard) item in column 4, row Rows to (PlayerColorText[(Player number of (Picked player))] + ((String(((Picked player) Current gold))) + |r))
Else - Actions
For each (Integer MultiboardLoop) from 1 to Rows, do (Actions)
Loop - Actions
Multiboard - Set the display style for (Last created multiboard) item in column 1, row MultiboardLoop to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 2, row MultiboardLoop to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 3, row MultiboardLoop to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 4, row MultiboardLoop to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 1, row MultiboardLoop to 10.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row MultiboardLoop to 5.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 3, row MultiboardLoop to 5.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 4, row MultiboardLoop to 5.00% of the total screen width
Multiboard - Change the number of columns for (Last created multiboard) to Columns
Multiboard - Change the number of rows for (Last created multiboard) to Rows |
| 04-03-2005, 07:39 PM | #2 |
Progressive lag is usually caused by memory leaks accumulating up. Now, you leak a player group with your trigger every second, but that's far from critical. I think a bigger problem might be the fact that you don't destroy the previous multiboard before you create a new one, you just clear it. Additionaly, you may leak some point objects with creep spawning and moving, but unless you do terrificly stupid stuff there, that shouldn't cause any serious lag as well. Try destroying the multiboards before you create new ones and we'll see how that works. |
| 04-04-2005, 04:11 AM | #3 |
progressive lag is actually usually caused by some 'physical' object on the person's screen that the game has to attempt to render even though it may not exist memory leaks usually cause a long delay at the end of the game when war3 has to go and clean out the ram (unless u have very little then maybe it'll start to slowdown the actual game) as for the code posted above, don't even bother creating a new multiboard -- simply overwrite the old values also you may want to just turn that into an 'update' function/trigger so you're not calling it every second, only when theres an actual event that triggers the need of an update (though not neccessary, just a suggestion) |
| 04-05-2005, 08:46 AM | #4 | |
Guest | Quote:
|
| 04-08-2005, 09:45 AM | #5 |
Guest | Make sure you are removing the units dying from the game. When making my TD I noticed that removing the units made the game less laggy. Salutions® |
| 04-08-2005, 10:38 AM | #6 |
Guest | Indeed, when the cadavers disappear, units are considered existing but invisible, making the computer not understand how to render this graphically, you need to remove them after some time, same goes for the multiboards, locations, etc... Your leaks in this multiboard also seems to come from the statement (player number of (picked players)), used a few times every second, but, as Anitarf says, this is more probably caused by overlapping boards. |
| 04-08-2005, 11:49 PM | #7 | |
Quote:
actually i believe once a unit completely decays (non-heros) they are destroyed |
| 04-09-2005, 02:12 PM | #8 |
I have to say: did you know that GUI's multiboard actions that work on specific item row and columns, leak a local variable everytime? and that there is no way to fix this leak? IT is better to get umswe and use its multiboard functions or to use JASS directly. |
| 04-09-2005, 02:44 PM | #9 |
woah man didn't knew that, that explains alot of things vex of how my map gets laggy. |
