Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New Feature: Tracking
Re: New Feature: Tracking[message #337686]
|
Tue, 11 November 2014 02:42
|
|
Ocular |
|
Messages:24
Registered:September 2014 |
|
|
Hiya Flugente, great feature!
I have a bug report:
The tracking patch introduces very large periodic CPU spikes due to a large number of sudden successive cover display calculations when in COVER_DRAW_MERC_VIEW, or in another expensive cover view.
AFAICT, this is because SOLDIERTYPE::SoldierPropertyUpkeep() is triggered a large number of times in a row about every ~3 seconds, forcing a cover recalculation each time due to the call to DisplayCover( TRUE ).
While I think that the periodic runs of SoldierPropertyUpkeep() is probably a bug worth investigating, calling DisplayCover() with the forceUpdate parameter to TRUE causes the expensive cover calculation to be recalculated before an interval of COVER_SYSTEM_UPDATE_DELAY has passed.
Calling DisplayCover( FALSE ) fixes this issue, and relieves the problem somewhat. There are still CPU spikes during cover display, but this fix at least addresses this performance regression.
Trivial patch follows. Thanks!
Index: Build/Tactical/Soldier Control.cpp
===================================================================
--- Build/Tactical/Soldier Control.cpp (revision 7650)
+++ Build/Tactical/Soldier Control.cpp (working copy)
@@ -17432,7 +17432,7 @@
if ( this->bInSector && this->bTeam == gbPlayerNum && !this->bCollapsed )
{
- DisplayCover( TRUE );
+ DisplayCover( FALSE );
}
}
Oh, one last thing, since I notice you are attempting to clean up some of the craziness in the code.
The signature of DisplayCover() is:
void DisplayCover( const BOOLEAN& forceUpdate )
There is no reason to pass a "const BOOLEAN&" when a simple BOOLEAN would do!
EDIT:
I just realized that there should not really be any reason to call DisplayCover() at all, since cover redisplay is handled by another game loop. Removing that if-block entirely has no apparent effect on the tracker display or any other cover display:
Index: Build/Tactical/Soldier Control.cpp
===================================================================
--- Build/Tactical/Soldier Control.cpp (revision 7650)
+++ Build/Tactical/Soldier Control.cpp (working copy)
@@ -17429,11 +17429,6 @@
{
this->usSoldierFlagMask &= ~SOLDIER_BATTLE_PARTICIPATION;
}
-
- if ( this->bInSector && this->bTeam == gbPlayerNum && !this->bCollapsed )
- {
- DisplayCover( TRUE );
- }
}
// check if Soldier can use the spell skillwise, with fAPCheck = TRUE also check current APs
[Updated on: Tue, 11 November 2014 03:51] by Moderator Report message to a moderator
|
Private 1st Class
|
|
|
Goto Forum:
Current Time: Thu Nov 28 23:48:51 GMT+2 2024
Total time taken to generate the page: 0.00929 seconds
|