Project-RimFactory-Revived
Project-RimFactory-Revived copied to clipboard
Drones Performance - Analyze
Describe the bug
Over time Cultivators seem to use much performance, seems to be due to Building_DronestationSpecialGraphic
which are running at crazy 200ms.
its used with <DrawDormantDrones>
to show dormat drones on a station
To me this should either be fixed or removed, i dont think show drones are worth extra lag. i have aldready turned it off on normal drone stations where it does not fit texture.
TODO
- figure out why it use so much performance ?
- Fix or Remove it
Update This issue is only seen with the "Drones" Extension
After spending too much time on this i can finally conclude that this is not an issue with DrawDormantDrones
.
<ThingDef ParentName="PRF_DroneStationBase">
<defName>CaretakerDroneStation</defName>
<label>caretaker drone station</label>
<description>A station that holds up to 20 drones, capable of hauling and cleaning, flicking and fighting fires. Consumes considerable power. Typically your colony only needs 1 of these.</description>
<thingClass>ProjectRimFactory.Drones.Building_DroneStationSpecialGraphics</thingClass>
<graphicData>
<texPath>Drones/DroneStationCaretaker</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2,2)</drawSize>
</graphicData>
<size>(2,2)</size>
<costList>
<Steel>100</Steel>
<ComponentSpacer>5</ComponentSpacer>
<ComponentIndustrial>5</ComponentIndustrial>
<PRFWeakAIChip>12</PRFWeakAIChip>
</costList>
<modExtensions>
<li Class="ProjectRimFactory.Drones.DefModExtension_DroneStation">
<displayDormantDrones>true</displayDormantDrones>
<workTypes>
<li>Firefighter</li>
<li>BasicWorker</li>
<li>Hauling</li>
<li>Cleaning</li>
</workTypes>
</li>
</modExtensions>
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<shortCircuitInRain>false</shortCircuitInRain>
<basePowerConsumption>1000</basePowerConsumption>
</li>
</comps>
<researchPrerequisites>
<li>PRFCaretakerDrones</li>
</researchPrerequisites>
</ThingDef>
As seen in the xml for some reason <thingClass>ProjectRimFactory.Drones.Building_DroneStationSpecialGraphics</thingClass>
was selected as the Class for the Station
@zymex22 why did you use <thingClass>ProjectRimFactory.Drones.Building_DroneStationSpecialGraphics</thingClass>
for them?
- [x] Check what is actually causing the high tick times
it seems as if public ThinkResult TryIssueJobPackageDrone(Pawn pawn, bool emergency)
takes significantly more time for the Caretaker (maybe related to haul?)
This post shall be updated to provide an collected Overview of all Scenarios where Reduced performance can be observed
Testing on 18.11.20 (Based on master)
Vanilla Modlist
Harmony, Core, Royalty, HugsLib, DubsPerformenceAnalyzer, PRF
Scenario - 1 Drones have the "Haul Job" enabled with a a lot of haulabel things that cant be moved as the target is out of range.
In this Scenario a ~3ms Ticktime Increases to 10ms
Image shows the 3ms Time. if the range is increased while the haul job is active the time will increase to 10ms
Other Observations:
- Adding haulabels outside the allowed Area(range) of the Station has no impact on the Ticktime.
"Bigger Mod list" (provided by itengineer)
full list by itengineer
<li>brrainz.harmony</li>
<li>ludeon.rimworld</li>
<li>ludeon.rimworld.royalty</li>
<li>unlimitedhugs.hugslib</li>
<li>dubwise.dubsperformanceanalyzer</li>
<li>vanillaexpanded.achievements</li>
<li>spdskatr.projectrimfactory</li>
<li>brrainz.achtung</li>
<li>fluffy.modmanager</li>
<li>unlimitedhugs.allowtool</li>
<li>razor2.3.anotherrimworldmod.autocutblight</li>
<li>gguake.ui.simplesearchbar</li>
<li>arandomkiwi.rimsaves</li>
<li>mlie.wikirim</li>
<li>valcrafto.rimsearch</li>
<li>savestoragesettings.kv.rw</li>
<li>fluffy.worktab</li>
<li>tikubonn.dontblockdoor</li>
<li>notfood.frameratecontrol</li>
<li>mehni.numberspatched</li>
<li>sarg.smartspeed</li>
<li>smashphil.neceros.srtsexpanded</li>
<li>dhultgren.smarterconstruction</li>
<li>giantspacehamster.moody</li>
<li>unlimitedhugs.mapreroll</li>
<li>krafs.levelup</li>
<li>jkluch.haultostack</li>
<li>mlie.apparelorganizer</li>
<li>madeline.modmismatchformatter</li>
<li>fluffy.colonymanager</li>
<li>dubwise.dubsmintminimap</li>
<li>com.bymarcin.architecticons</li>
<li>dubwise.dubsmintmenus</li>
<li>taveron.increasedstack</li>
<li>fluffy.blueprints</li>
<li>notfood.researchpal</li>
<li>dubwise.rimatomics</li>
<li>dubwise.rimefeller</li>
<li>arandomkiwi.rimthemes</li>
<li>proxyer.optionalicons4ai</li>
<li>fed1splay.pawntargetfix</li>
<li>linkolas.stabilize</li>
<li>void.charactereditor</li>
<li>leafzxg.masterofcrafting</li>
<li>syrchalis.setupcamp</li>
<li>mlie.xndmemorableauroras</li>
<li>jaxe.rimhud</li>
<li>roolo.giddyupcore</li>
<li>mlie.rimquest</li>
<li>yrtwof.rimpedia</li>
<li>kikohi.jewelry</li>
<li>mlie.pickupandhaul</li>
<li>acruid.repairbench</li>
<li>daniledman.fastregen</li>
<li>ratys.rtfuse</li>
<li>murmur.walllight</li>
<li>orion.therapy</li>
<li>targhetti.showdrafteesweapon</li>
<li>leafzxg.masterofcooking</li>
<li>timmyliang.tradehelper</li>
<li>vfme.caravanpacks</li>
<li>rikiki.miningco.spaceship</li>
<li>neceros.reinforcedwalls</li>
<li>meltup.beautifuloutdoors</li>
<li>roolo.giddyuprideandroll</li>
<li>mlie.centralizedclimatecontrol</li>
<li>roolo.giddyupcaravan</li>
<li>roolo.giddyupbattlemounts</li>
<li>roolo.runandgun</li>
<li>wit.expandedroofing</li>
<li>user19990313.runtimegc</li>
<li>roolo.searchanddestroy</li>
<li>com.yayo.betterjumppack</li>
<li>syrchalis.doormats</li>
<li>tammybee.whereismyweapon</li>
<li>cabbage.rimcities</li>
<li>petetimessix.simplesidearms</li>
<li>brrainz.cameraplus</li>
<li>lwm.deepstorage</li>
Current Progress in reducing the List
<li>brrainz.harmony</li>
<li>ludeon.rimworld</li>
<li>ludeon.rimworld.royalty</li>
<li>unlimitedhugs.hugslib</li>
<li>dubwise.dubsperformanceanalyzer</li>
<li>vanillaexpanded.achievements</li>
<li>spdskatr.projectrimfactory</li>
<li>brrainz.achtung</li>
<li>fluffy.modmanager</li>
<li>unlimitedhugs.allowtool</li>
<li>razor2.3.anotherrimworldmod.autocutblight</li>
<li>gguake.ui.simplesearchbar</li>
<li>arandomkiwi.rimsaves</li>
<li>mlie.wikirim</li>
<li>valcrafto.rimsearch</li>
<li>savestoragesettings.kv.rw</li>
<li>fluffy.worktab</li>
<li>tikubonn.dontblockdoor</li>
<li>notfood.frameratecontrol</li>
<li>mehni.numberspatched</li>
<li>sarg.smartspeed</li>
<li>smashphil.neceros.srtsexpanded</li>
<li>dhultgren.smarterconstruction</li>
<li>unlimitedhugs.mapreroll</li>
<li>krafs.levelup</li>
<li>mlie.apparelorganizer</li>
<li>madeline.modmismatchformatter</li>
<li>fluffy.colonymanager</li>
<li>dubwise.dubsmintminimap</li>
<li>com.bymarcin.architecticons</li>
<li>dubwise.dubsmintmenus</li>
<li>fluffy.blueprints</li>
<li>notfood.researchpal</li>
<li>dubwise.rimatomics</li>
<li>dubwise.rimefeller</li>
<li>arandomkiwi.rimthemes</li>
<li>proxyer.optionalicons4ai</li>
<li>fed1splay.pawntargetfix</li>
<li>linkolas.stabilize</li>
<li>void.charactereditor</li>
<li>leafzxg.masterofcrafting</li>
<li>syrchalis.setupcamp</li>
<li>mlie.xndmemorableauroras</li>
<li>jaxe.rimhud</li>
<li>roolo.giddyupcore</li>
<li>yrtwof.rimpedia</li>
<li>kikohi.jewelry</li>
<li>acruid.repairbench</li>
<li>daniledman.fastregen</li>
<li>ratys.rtfuse</li>
<li>murmur.walllight</li>
<li>targhetti.showdrafteesweapon</li>
<li>leafzxg.masterofcooking</li>
<li>timmyliang.tradehelper</li>
<li>vfme.caravanpacks</li>
<li>rikiki.miningco.spaceship</li>
<li>neceros.reinforcedwalls</li>
<li>meltup.beautifuloutdoors</li>
<li>roolo.giddyuprideandroll</li>
<li>mlie.centralizedclimatecontrol</li>
<li>roolo.giddyupcaravan</li>
<li>roolo.giddyupbattlemounts</li>
<li>roolo.runandgun</li>
<li>wit.expandedroofing</li>
<li>user19990313.runtimegc</li>
<li>roolo.searchanddestroy</li>
<li>com.yayo.betterjumppack</li>
<li>syrchalis.doormats</li>
<li>tammybee.whereismyweapon</li>
<li>cabbage.rimcities</li>
<li>petetimessix.simplesidearms</li>
<li>brrainz.cameraplus</li>
<li>lwm.deepstorage</li>
I can confirm a substantial loss in tps by the drone station
TODO:
- Locate Mod / Mod Combination that "causes" the issue.
- Fix if possible
Possible future performance improvements
For Building_DroneStation (In Case of no Job)
The only call where its plausible that noticeable Improvements can be made is TryGiveJob
.
There 2 Options remain:
- (1ms)
MakeDrone()
via Caching / "Static Pawn" - (2ms) (1ms per call)
TryIssueJobPackageDrone(x,y)
somehow improve the search for Job Code.
a third option wold be to tune additionJobSearchTickDelay
.
Current feedback shows that the reduction of responsiveness caused by it is not observed by the users.
-> It is likely that we could Reduce the responsiveness even more and therefor also reduce the tick time.
For Pawn_Drone (In Case of some Job(s))
The lag seems to be caused by base.Tick();
more specifically JobTrackerTick()
but i have no clue how to improve it
Check if the Calls to SetPriority
can be reduced. as WorkTab
has a patch for that function that reportedly take ~20ms (spike) late game (modded).
This behavior is unexpected as the code in said patch is simple & dos not seem like the execution time should or Could increase
Madman666: Yeh, so in short:
- Create a new map
- Dev mode spawn some power and a drone Cultivator mk3
- Dev spawn some pawns
- Make a big grow zone for drones to work on
- Watch WorkTab.Pawn_WorkSettings_SetPriority:Prefix get frequent big spikes in frametime. Seems to scale with both pawn amounts and drone amounts. In my case it was spiking in my modded testing save to about 20 ms, on newly created map with just PRF and WorkTab - to 5-6 ms per dronebase. https://cdn.discordapp.com/attachments/693933621349974040/797895773513318420/unknown.png
yeah drones eat my performance up
didn't realize it until it was too late