addBeacon slow?

For AI and campaign script related discussions and questions
Post Reply
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

addBeacon slow?

Post by Berserk Cyborg »

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
semperfi.log
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: addBeacon slow?

Post by Per »

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...
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: addBeacon slow?

Post by Prot »

May be a best decision is a check, if ally player is player(not AI), then drop beacon.
Post Reply