View Single Post
Author Message
Paimon
Member
Join Date: Jul 2021
Location: Zootopia
Old 02-18-2024 , 22:07   [L4D2] SIPool - Aim to improve performance when spawn SI (Experimental)[2024.04.18]
Reply With Quote #1

Description:

This plugin is a library that allows you to create special infected bot by SIPool.

The plugin's aim is that when your server needs to create special infected bots very frequency.
Such as create 28 SI bots in 0 seconds, CreateFakeClient() will consume lots of cpu and network resources.
But use SIPool can avoid lots of CreateFakeClient() operation because the plugin use pool to manage the SI bots that already created in the past and avoid them being kicked by the director.
When you try to request the bot, SIPool will pick an available bot from pool unless the pool is empty.

And after my test(28 SI with 0 seconds), the result showed that:
NO SIPool, the server's tickrate decrease from 100 to 80 LESS when CreateFakeClient() from a for() loop;
WITH SIPool, the server's tickrate decrease from 100 to 90 MORE when RequestSIBot() from a for() loop;

And the plugin still needs to test, only myself can not make the plugin be pefect, so any advice and criticize reports are wanted.

Q: How does SIPool work?

SIPool will prevent the engine from kicking dead SI(Special Infected) bots and keep them death until next spawn,
for example, a charger bot dead, SIPool will change it's status to ACTIVE to avoid it being kicked,
and add it to charger pool, next time you RequestSIBot for a charger,
SIPool will pick an available client from charger pool and make it respawn,
teleport to target position, then return it's index to the plugin which calls RequestSIBot.

Q: Why can SIPool enhance the performance?

I think the main reason is that SIPool avoid lots of CreateFakeClient operation.
SIPool makes the SI bot to be a player in coop mode, just like versus, dead SI won't be kicked but wait for respawn,
so no new client connect and boardcast to everyone in server, these will save lots of cpu and network resources.

Usage:

See si_pool.inc and sptest.sp.

Support:

Harry's L4D Infected Bots(SIPool fork)

Update:
2024.04.18#145
Fixed array index out of bounds.
Update L4DInfectedBots(SIPool fork) to 2.9.5

2024.04.01#124:
Fixed all bugs mentioned here(Issue#5)
The fixed bugs will list as follows:
1. Server crash when changelevel
2. SI crouch after spawn
3. Add tank to pool
4. Server full for connecting player(may be fixed)
5. Index out of bounds
6. Better way to manage SIPool

Spoiler


Source:

You can ALWAYS find latest source at my GitHub:
Paimon-Kawaii - L4D2-Plugins/InProgress/SIBotPool

Download:
Attached Files
File Type: zip SIPool_v2024.04.18.zip (18.6 KB, 52 views)
__________________

Last edited by Paimon; 04-26-2024 at 05:10.
Paimon is offline