• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Sources of computer lag other than leaks

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
Yesterday I was playtesting a version of Battle for Tatooine with a friend of mine on BNet. During an arena mode, we noticed the screen becoming choppy. It didn't feel like lag so much as computer computational problems. It reminded me a bit of what happened when I left some leaks in the game during editing once. But there were some differences that suggest this is not a leak problem:

1. For one, it didn't appear to get progressively worse. When I left leaks on it got worse and worse over time, but this time it didn't.

2. The choppy/lag experience occurred right after we started so there wasn't much time for any leaks to accumulate.

I should point out that this cannot be the computer being overwhelmed with functions (unless there's some bug I left on) because this version of the map is much much less complicated than the full version which doesn't lag or chop.

Sadly, I'm at work and can't get this out of my mind. What are the other sources of this sort of choppiness? (I.e. low frame rate).

Sorry I can't be more specific, but it's driving me crazy!
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Check your fps.
If your FPS is dropping, then you set things inefficiently (doesn't mean anything leaks). Sometimes, you need to create "an inefficient code" to make things more effective. An example from my own map - I create a spell called Apocalypse. The basic idea was that meteors were falling down in increased volume and size until one final big ass meteor fell down, caused explosion and set the whole ground on fire.
First, I made every meteor and fire as a unit and gave them timed life. The code was pretty clean, but due to how expensive units are, I was getting some serious fps drops.

The second way was to make everything as a special effect. It required a lot more complicated code, as I had to time life of everything manually and keep track of it. So not much of a nice code. But the result was more than I thought it would. Instead of about 20-25 fps drops my fps dropped by about 2.

So check your fps. You may as well try and check your ping just to be on the safe side. It also depends on the surrounding of the arena and what is happening there. For example if you suddenly use effects with huge particle count, or more detailed models for bystanders, etc. it may all affect your fps.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Well, I'd do some basic debugging.

Remove all triggers and see if the lag persists.
Remove all custom object data and check
Remove all imported files
(do this on a backup version)

If it still lags you know it's computer specific and not map specific.
And if it disappears, well you know which area is causing it at least so you have narrowed down the issue.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks for the feedback guys. It does seem to happen when two ships shoot at each other, which involves rapid generation of units (each laser is a unit). But what's so perplexing is that in the regular game (which doesn't lag) there are easily 5-6 times as many units being generated and it's fine. It seems to be something about a particular mode in the game (arena mode), but I've combed through all the triggers that this changes and can't find anything.

I'll do another check when I get home, but I'm afraid I'll have to revert to an earlier version of the game and just try to recode what I've done hoping to not make the same mistake twice. Eh... crushing.

I'll check the fps, that's a good idea.

I'm afraid I can't delete all that information and test it, because the problem only shows up in the ship combat, which requires a ton of triggers and custom objects. It seems like the problem has to be a trigger that works differently in arena mode vs. regular mode. Again, there aren't many differences but I'll check it a third time when I get home. I'm afraid it's not something you guys can help with. Thanks though, your support feels good regardless!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Frame drops are caused by the game application failing to fulfill the real-time requirements of the game loop task. It will prioritize dropping frames (up to a certain number in a row to prevent freezes) to avoid all the expensive D3D/OpenGL API calls in an attempt to keep the game loop meeting deadlines.

This usually happens when you try to get the game to do too much at once such as having 1,000+ units fighting each other at the same time. Triggers can also cause it if you run something computationally intensive since they are tied to the main game loop task. Since each visible object translates to a dozen odd API calls it is also possible that having a lot of effects/models visible at once can cause it as well.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks everyone! I finally found it!

The problem was a trigger that I set to repeat every (real variable). I initialize the real variable in a trigger, but that trigger is skipped in arenas, so apparently that trigger was firing every 0 seconds... I'm a bit surprised the game didn't lock up immediately.

Anyway, I am SO relieved! New BfT should be ready soon.

+ rep all around; thanks guys!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
The problem was a trigger that I set to repeat every (real variable). I initialize the real variable in a trigger, but that trigger is skipped in arenas, so apparently that trigger was firing every 0 seconds... I'm a bit surprised the game didn't lock up immediately.
Do note that the period is passed to the event natives by value. As such if you set a periodic event in a GUI trigger to use a "real variable" for period it will always use the initialized value (from variable panel) of that real variable as the period, with changes to the variable being ignored.

You will need to attach the event at run time using the various event actions for the period to be dynamic. If you want to alter the period you would have to use JASS to destroy and re-create the trigger. In such a case using a timer may be better.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Do note that the period is passed to the event natives by value. As such if you set a periodic event in a GUI trigger to use a "real variable" for period it will always use the initialized value (from variable panel) of that real variable as the period, with changes to the variable being ignored.

You will need to attach the event at run time using the various event actions for the period to be dynamic. If you want to alter the period you would have to use JASS to destroy and re-create the trigger. In such a case using a timer may be better.

Interesting, and good to note!
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
spawning multiple units of the same unit also lags the game

I created that spell that when the creature dies it spawns 2 more of itself

epic disaster!

the map was full of them

also what would happen if I devour such a creature, it would multiply inside the creature endlessly

try it, it's quite fun until it crashes your game
 
Status
Not open for further replies.
Top