[ZScript] Help with optimizing inventory item

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Boondorl
Posts: 191
Joined: Wed Jul 11, 2018 10:57 pm

[ZScript] Help with optimizing inventory item

Post by Boondorl »

Currently I'm working on a universal mod with a leveling system for enemies, and part of that is attaching an item to them that keeps tracking of their XP. I noticed when I play on map 15 of the newest Sunder (which has almost 6000 enemies on it), however, the performance tanks by about 10 FPS. I thought it might be the DoEffect for some reason causing issues, so I disabled that part of the code. Code snippet:
Spoiler:
There was no difference in performance. There's also overridden BeginPlay, PostBeginPlay, OwnerDied, and ModifyDamage functions. I was wondering if these might have some impact on the performance while enemies are idling since most of the time they are only relevant in very specific circumstances. Not spawning the actor at all seems to be the only way to fix the performance. Obviously not a solution, but I'm wondering if this is a sheer numbers problem. Since map 15 of Sunder has almost 6000 enemies, and all of them need this item, it would make sense that when I look at the profiles the item comes out near the top at the amount of time needed to process. However, this might just be me misunderstanding another part of the item's code, and the solution might be fairly simple.

Is there anything I can do here? Or should I assume I've reached a limit with what the VM can do?
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: [ZScript] Help with optimizing inventory item

Post by _mental_ »

Use profilethinkers console command to profile the next tick. I guess you need something like profilethinkers -t 10, but you can try different options. The command will output a brief help info if run without arguments.
Post Reply

Return to “Scripting”