addBeacon slow?

For AI and campaign script related discussions and questions

addBeacon slow?

Postby Berserk Cyborg » 25 May 2018, 06:11

I have been experimenting with semperfi-js some more and think successive calls of addBeacon() are particularly intensive on performance. For context, I have it drop a beacon to its allies from within eventAttacked with a throttle of 30 seconds from the last time it was attacked by an enemy. And the beacons are mostly informative at best.

What is most noticeable is just how large the gap is when an ally is present. Take for example a 3v3 (Semperfi-js against Nullbot) on the Melting map. Each AI peaks around 25 units until the other side starts to win and should semperfi-js be the winning side the lag probably pauses Warzone for 1/5 a second as a beacon is dropped.

Now, on a map like Monocot where it's a 1v1v1, the lack of an ally to receive a beacon makes the worse perf of eventAttacked hovers around 5-7 ms. Then doing a 2v2 on sk-rush the worse perf time with eventAttacked jumps up to ~25 ms with just one ally. It don't matter if it is being called in eventAttacked as it will do just as bad in another function much to the same effect.

And before anyone gets too excited, the main addition is that it can research and produce a few bunker buster and maybe rush slightly better.

semperfi.wz
(16.23 KiB) Downloaded 4 times

semperfi.log
A sample perf log of two skirmish battles
(2.32 KiB) Downloaded 4 times
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 558
Joined: 26 Sep 2016, 19:56

Re: addBeacon slow?

Postby Per » 25 May 2018, 19:52

Unfortunately, addBeacon() eventually leads down into the messages code, which is one of the last remaining almost entirely unintelligible hell-holes in the codebase ...

Without having looked at it, I would guess the reason is that it calls into the graphics and audio code for each blip is adds...
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3744
Joined: 03 Aug 2006, 19:39

Re: addBeacon slow?

Postby Prot » 26 May 2018, 09:34

May be a best decision is a check, if ally player is player(not AI), then drop beacon.
User avatar
Prot
Trained
Trained
 
Posts: 146
Joined: 29 Nov 2010, 12:41


Return to Scripting