Regarding to class Unit in 1.1's entity timer.

Place to get help with not working mods / modding interface.
Post Reply
heyqule
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Sun Mar 05, 2017 1:35 am
Contact:

Regarding to class Unit in 1.1's entity timer.

Post by heyqule »

Hi

What contributes to the class Unit timer?

I replace the vanilla enemy with my new race and let the game run for 10 minutes. The unit timer went from 1.5, 1800 to 5.x, 6000~ with new units.

The new enemies have new attack moves and projectiles. I'm looking for ways to optimize units.

heyqule
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Sun Mar 05, 2017 1:35 am
Contact:

Re: Regarding to class Unit in 1.1's entity timer.

Post by heyqule »

Hi Developers

Do the units in base builder group counts in the unit entity usage timer?

I was playing with onUnitFinishGathering event. I noticed the base builder group in my new AI enemy force use full group size (custom set to 100 units). I cut down the group size and sometime reassigned them to attack. That entity usage timer dropped significantly. Now the unit counter rarely hit 2000. Most of the times the unit time shows just around 1000-ish even when my map has 40000 units.

I wonder if that's something you guys can optimize. ;)

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Regarding to class Unit in 1.1's entity timer.

Post by Klonan »

heyqule wrote:
Fri Apr 02, 2021 3:43 am
I wonder if that's something you guys can optimize. ;)
If you can provide save games or demonstrations, we can take a look

heyqule
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Sun Mar 05, 2017 1:35 am
Contact:

Re: Regarding to class Unit in 1.1's entity timer.

Post by heyqule »

Hello Klonan

Here is the link to the mod packages and saves. https://drive.google.com/drive/folders/ ... sp=sharing

This is how I tested it. It tested with 1.1.30.

ERM 0.6.1
----------------
game.player.surface.pollute(game.player.position,30000000)
game.speed = 5

Entity class Unit have 2000-3000 units after a minutes or 2.


EMR 0.7.0
-------------------
game.player.surface.pollute(game.player.position,30000000)
game.speed = 5

Entity class Unit have 1000-2000 units after a minutes or 2.
----------------------

The difference between them is how I handle the base building group. While I was working on version 0.7, I notice many base build groups were using the full size(max 100).

I implemented the following logic to it with onUnitFinishGathering = function(event) in enemyracemanager/control.lua

If the build group have more units than max settler size, that unit group has 75% chance to break down as a small build group and an attack group and 25% become an attack group.


OT:
Another thing I notice in 0.7.0. The script timer would jump to something like 0.002/0.000/some very high number like 10.xxx - 20.xxx once in a while. I dropped some log() in my new functions and I don't see any anomalies. The UPS didn't have hiccup. I'm pretty confused on why that happened lol.
Nvm.. find_entities_filtered with large radius is expensive.

Post Reply

Return to “Modding help”