Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

KCA-kai consume much more resources during combat #11

Closed
n0k0m3 opened this issue Nov 26, 2017 · 8 comments
Closed

KCA-kai consume much more resources during combat #11

n0k0m3 opened this issue Nov 26, 2017 · 8 comments

Comments

@n0k0m3
Copy link

n0k0m3 commented Nov 26, 2017

So it comes to my attention that during combat the VM slows down and lags constantly. Checking process manager turns out that 100% CPU is being used. So I did a quick test with KCA and KCAK(KCA-kai) and take results for most basic functions of KCA:

  1. Home port: KCA: 20-25% /// KCAK: 10-45%
  2. Expedition and Quest: KCAK uses more resources but much faster
  3. Sortie: KCA: Pre-sortie: 0-30%, while during battle and post-battle screen: max 80%
    KCAK: Pre-sortie: 45-80%, while during battle and post-battle screen: 75-100%
  4. Overall in average: KCA: 0-90% /// KCAK: 30-100%(lags)

Spec:
intel i5 6300HQ 2.3GHz turbo 3.2GHz - 2 Core 100% exec cap
1536MB RAM
128MB VRAM

So is the additional constant check of KCAK causing the spike in CPU consumption? And can it be optimized like current KCA fork?

@mrmin123
Copy link
Collaborator

It depends on if you're willing to sacrifice accurate fleet position detection. Sacrifices had to be made to support the new combat model which fires multiple searches per second for fleet location identification, and one of them is the additional strain on the hardware. You can turn this down by overriding the SIKULI_SCANRATE in globals.py but you may get inaccurate readings for node locations and is ill-advised for sortieing to events.

@mrmin123 mrmin123 changed the title KCA-kai is unoptimized and consume much more resources KCA-kai consume much more resources during combat Nov 26, 2017
@mrmin123
Copy link
Collaborator

Renaming the ticket so it's a bit more accurate...

@n0k0m3
Copy link
Author

n0k0m3 commented Nov 26, 2017

Gonna try SIKULI_SCANRATE = 1 for couple of W4-5 runs to test it out.

@mrmin123
Copy link
Collaborator

I should also note that you will see higher CPU usages at many points because kcauto-kai uses multithreading for certain checks, which will also put additional strain on the CPU.

@stackhanovets
Copy link

intel i5 6300HQ 2.3GHz turbo 3.2GHz - 2 Core 100% exec cap
1536MB RAM
128MB VRAM

Got 4 cores with ~98% load, 8G RAM and 128M VRAM. KC3Kai freezes the screen often, so I've disabled it. Does someone use KVM for the gaming?

@mrmin123
Copy link
Collaborator

This value is hard coded for now but you could try commenting out L28 in kcauto-kai.py:

sikuli.Settings.RepeatWaitTime = 0

It'll set the repeat wait time to the default value of 1 (see RaiMan/SikuliX-2014#289)

@n0k0m3
Copy link
Author

n0k0m3 commented Nov 27, 2017

SIKULI_SCANRATE = 5 drastically reduces the cpu consumption and lags while still being able to correctly define nodes (tested with W4-5)

Will try sikuli.Settings.RepeatWaitTime = 1 for another 12 hours to test it out

Update: sikuli.Settings.RepeatWaitTime = 1 doesn't help much, got a 10% reduced usage but recognition is not swift and fast anymore.

Solution: SIKULI_SCANRATE = 5 is a go for VMs

@mrmin123
Copy link
Collaborator

To be resolved in #14.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants