Hey, I'm working on a map and recently switched from third-person to a top down style. I'm using WASD movement and I just finished up coding it. Now whenever I test it, it starts out perfect in the first few minutes but after that the FPS starts to drop and I get lag. This gets progressively worse until its nearly unplayable.
I have the map attached and would appreciate if someone could check it out because everything looks to be in line to me.
this happens when there is a trigger that has a memory leak, check your triggers that repeat and and have if conditions. make sure your arguments are valid. this happens a lot to me.
I'm not entirely sure how I would check for this, could you give me a quick example of a trigger that would be causing a memory leak? Like what to look for?
Variables or parameters don't leak. The only time there is a problem is when you have triggers using the Periodic Timer event and firing every 0.04 seconds or so. Every time a trigger is called it increases memory usage a little bit.
Many periodic triggers will eat up a nice bit of your memory which COULD be the cause of these lags (especially if your computer isn't high end)
I suggest changing them to one-shot timer events and instead use a loop in the trigger to execute the actions over and over.
So instead of this:
Event:
- Every 1 second of game time
Action:
- UI - Display "bla bla" to all players
You make this:
Event:
- Elapsed game time is 1 second
Action:
- while ( true == true )
- - UI - Display "bla bla" to all players
You could even use CameraFollowUnitGroup and remove this trigger.
same for the movement trigger, fire it if a key is pressed.
Keep the angle you want to move to global and let the key-pressed triggers modify it and re-issue the order; reset the distance in each of these triggers
Rule of thumb:
fire a trigger, if something has changed, not for polling conditions.
Thanks very much for the help guys, I did it a little differently than you guys suggested but got rid of the lag problems I was having and will keep in mind the tips you guys gave me.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey, I'm working on a map and recently switched from third-person to a top down style. I'm using WASD movement and I just finished up coding it. Now whenever I test it, it starts out perfect in the first few minutes but after that the FPS starts to drop and I get lag. This gets progressively worse until its nearly unplayable.
I have the map attached and would appreciate if someone could check it out because everything looks to be in line to me.
Thanks.
@xTiming: Go
this happens when there is a trigger that has a memory leak, check your triggers that repeat and and have if conditions. make sure your arguments are valid. this happens a lot to me.
I'm not entirely sure how I would check for this, could you give me a quick example of a trigger that would be causing a memory leak? Like what to look for?
Variables or parameters don't leak. The only time there is a problem is when you have triggers using the Periodic Timer event and firing every 0.04 seconds or so. Every time a trigger is called it increases memory usage a little bit.
Many periodic triggers will eat up a nice bit of your memory which COULD be the cause of these lags (especially if your computer isn't high end)
I suggest changing them to one-shot timer events and instead use a loop in the trigger to execute the actions over and over.
So instead of this:
Event:
- Every 1 second of game time
Action:
- UI - Display "bla bla" to all players
You make this:
Event:
- Elapsed game time is 1 second
Action:
- while ( true == true )
- - UI - Display "bla bla" to all players
whats cinematic_check for?
Improve the camera_Update trigger. it only has to be fired if the unit actually changes its position (for wasd)
You could even use CameraFollowUnitGroup and remove this trigger.
same for the movement trigger, fire it if a key is pressed. Keep the angle you want to move to global and let the key-pressed triggers modify it and re-issue the order; reset the distance in each of these triggers
Rule of thumb: fire a trigger, if something has changed, not for polling conditions.
Thanks very much for the help guys, I did it a little differently than you guys suggested but got rid of the lag problems I was having and will keep in mind the tips you guys gave me.