Raised This Month: $32 Target: $400
 8% 

ccBalance SM port


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
musosoft
Senior Member
Join Date: Dec 2008
Location: Thailand
Old 08-27-2013 , 19:43   ccBalance SM port
Reply With Quote #1

Hello.

I've tryied every currently "working" CS:S team balance plugin, but didn't found ideal balancer for SM which doesn't move players too often, but keeps team score balanced. ccBalance is the best available plugin which does this, but it's only for ES. I know that it isn't easy to code something like this, but it would be great if there is anyone, who can help and bring good CS:S balancer to community (I think twistedpanda started porting, but never finished).

Maybe these (actually not working) SM plugins can be useful.

H-Balance (it spawns players with bad team player skin)
PTBx from XADdmin (not maintained for a long time)

Thank you for replies.
__________________
Making FiveM servers nowadays. Can help with CS:GO, CS:S, and other Source server stuff too, just PM me. Thanks

Last edited by musosoft; 08-27-2013 at 19:44.
musosoft is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-27-2013 , 19:56   Re: ccBalance SM port
Reply With Quote #2

Oh gawd. I tried this last year. And the year before. *nightmares*
__________________
thetwistedpanda is offline
musosoft
Senior Member
Join Date: Dec 2008
Location: Thailand
Old 08-30-2013 , 06:07   Re: ccBalance SM port
Reply With Quote #3

Hello panda, please post sourcecodes you've made, maybe someone can help Working teambalancer is really needed in CS:S community
__________________
Making FiveM servers nowadays. Can help with CS:GO, CS:S, and other Source server stuff too, just PM me. Thanks
musosoft is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-02-2013 , 01:58   Re: ccBalance SM port
Reply With Quote #4

I hope that night was well spent on that one.
Here's a SourceMod port of the popular eventscript cC Team Balancer 1.1 by *XYZ*SaYnt.

http://addons.eventscripts.com/addons/view/ccbalance

It registers the same convars like the original and should behave just the same as well.
See the top of the sourcecode file for configuration options and what they mean. Namely (including default values):
  • ccb_run_frequency 4
  • ccb_wait_until_dead 0
  • ccb_min_player_count 6
  • ccb_acceptable_strength_imbalance 10.0
  • ccb_team_imbalance_percentage_trigger 84.0
  • ccb_team_strength_percentage_trigger 60.0
  • ccb_lose_immunity_after 30
  • ccb_immune_for 3
  • ccb_max_swaps_considered 100
  • ccb_verbose 3
  • ccb_better_factor 1.1
  • ccb_worse_factor 0.9
  • ccb_global_immunity "STEAM_0:0:12480610 STEAM_0:0:21631" // the steamids of the original authors i guess..?
  • ccb_notify_team_change 3
The plugin uses a sqlite database named ccbalance.sq3 to remember some info about kills, deaths and total rounds played per player.


There's one command to print some balancing statistics into console: ccbstats


The eventscript version used Mani to swap teams smoothly. The ma_swapteam command also changed the model of the player correctly when he's switched teams while being alive. The attached gamedata file contains the same SDKCall to CCSPlayer::SetModelFromClass() to change the model as well. While not required, it would be missing when switching to the SM port.



You'll need smlib to compile.


I've only tested this with bots and it looks like it does some magic. You'll have to see, if it's messed up somewhere with real players.
Attached Files
File Type: sp Get Plugin or Get Source (ccbalance.sp - 277 views - 50.2 KB)
File Type: smx ccbalance.smx (31.4 KB, 169 views)
File Type: txt ccbalance.games.txt (697 Bytes, 198 views)
__________________

Last edited by Peace-Maker; 09-02-2013 at 10:19. Reason: Updated plugin to rename convars to ccb_ and fixed division by zero and immunity
Peace-Maker is offline
musosoft
Senior Member
Join Date: Dec 2008
Location: Thailand
Old 09-02-2013 , 03:03   Re: ccBalance SM port
Reply With Quote #5

thank you very much. you did it so fast, respect Testing right now

EDIT:

Testing reports:
- seems like it doesn't support lateload:
Code:
[ccbalance.smx] Couldn't find CCSPlayer::SetModelFromClass signature. Players won't have the right model when switching while alive.
- no errors after mapchange
- erros occured after mapchange server start, (Conflict with warmup round?)
Code:
L 09/02/2013 - 09:36:25: [SM] Plugin encountered error 14: Divide by zero
L 09/02/2013 - 09:36:25: [SM] Displaying call stack trace for plugin "ccbalance.smx":
L 09/02/2013 - 09:36:25: [SM]   [0]  Line 1354, C:\Users\Jannik\Desktop\ccbalance.sp::IsTeamStrengthOffKilter()
L 09/02/2013 - 09:36:25: [SM]   [1]  Line 676, C:\Users\Jannik\Desktop\ccbalance.sp::DelayedRoundEnd()
L 09/02/2013 - 09:36:25: [SM]   [2]  Line 588, C:\Users\Jannik\Desktop\ccbalance.sp::Timer_DelayedRoundEnd()
- switching players works well, color fade too, no error 14, no new errors (nothing changed in server config).

Current config (default):
Spoiler


Addons using:
Spoiler
__________________
Making FiveM servers nowadays. Can help with CS:GO, CS:S, and other Source server stuff too, just PM me. Thanks

Last edited by musosoft; 09-02-2013 at 04:50.
musosoft is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-02-2013 , 10:27   Re: ccBalance SM port
Reply With Quote #6

There are extra precautions to support lateloading. The signatures should be fine. Is SetModelFromClass found when loading the plugin with the server?

I've added checks to avoid that division by zero as well as fixing the switching immunity for x rounds after the player was switched. That's been bugs in the eventscript version too.. That happens when blindly porting a plugin without rethinking the logic ;)

The convars are now called ccb_* instead of balance_* too and a config file is generated in cfg/sourcemod.

Now after reading the thread in the eventscripts forum i've noticed C4vey did a rewrite with cleanup and optimization. Too bad i didn't see that one before
__________________
Peace-Maker is offline
musosoft
Senior Member
Join Date: Dec 2008
Location: Thailand
Old 09-02-2013 , 14:26   Re: ccBalance SM port
Reply With Quote #7

Yes SetModelFromClass is found (i think - no errors occured after startup)

Will try updated version, thanks.

Ahh, shit happens

EDIT: Feature request: change ccb_global_immunity to SM admin flags system

current config


EDIT #2:

- It's not logging ratio properly (0.0 ratio in logs).
- In ccbstats ratio is OK

L 09/02/2013 - 19:22:56: [ccbalance.smx] guest_x added to balancer.
L 09/02/2013 - 19:22:56: [ccbalance.smx] guest_x [STEAM_0:11036005] updated in balancer. Kill rate of 0.00 per round.

ccbstats


EDIT 3: What exactly bold message means? Isn't it unnecessary?
[cCB] Round 17: Team Strengths: T = 3.58 | CT = 3.02.
[cCB] Balancing in 1 rounds.
[cCB] Unable to list any valid moves or swaps.

PS: Very nice work, balancer works great, I'm adding it to second server.
__________________
Making FiveM servers nowadays. Can help with CS:GO, CS:S, and other Source server stuff too, just PM me. Thanks

Last edited by musosoft; 09-02-2013 at 15:47.
musosoft is offline
ph
AlliedModders Donor
Join Date: Mar 2006
Old 09-14-2013 , 08:57   Re: ccBalance SM port
Reply With Quote #8

Peace-Maker, any updates with amendments please.
__________________
ph is offline
musosoft
Senior Member
Join Date: Dec 2008
Location: Thailand
Old 09-14-2013 , 09:26   Re: ccBalance SM port
Reply With Quote #9

Plugin works, it's stable and it's balancing well (equal team scores at map end), but yes update would be cool
__________________
Making FiveM servers nowadays. Can help with CS:GO, CS:S, and other Source server stuff too, just PM me. Thanks
musosoft is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-16-2013 , 10:57   Re: ccBalance SM port
Reply With Quote #10

Quote:
Originally Posted by musosoft View Post
Yes SetModelFromClass is found (i think - no errors occured after startup)
The attached version now uses the new CS_UpdateClientModel native added in SourceMod 1.5.1. No need for own gamedata anymore, when running running SM1.5.1+ thanks to Drifter
If you're still running SM1.5 or lower, you'll need the gamedata file!

Quote:
Originally Posted by musosoft View Post
EDIT: Feature request: change ccb_global_immunity to SM admin flags system
Ok. That cvar is removed and the plugin now checks for a "ccb_immunity" access override to determine immunity.

Quote:
Originally Posted by musosoft View Post
EDIT #2:

- It's not logging ratio properly (0.0 ratio in logs).
- In ccbstats ratio is OK

L 09/02/2013 - 19:22:56: [ccbalance.smx] guest_x added to balancer.
L 09/02/2013 - 19:22:56: [ccbalance.smx] guest_x [STEAM_0:11036005] updated in balancer. Kill rate of 0.00 per round.
That's only been a visual glitch. The killrate was calculated correctly, when the player was already known in the database. It should display the killrate correctly now right away.
There's also been a issue with bots being added to the database. They're ignored correctly now.

Quote:
Originally Posted by musosoft View Post
EDIT 3: What exactly bold message means? Isn't it unnecessary?
[cCB] Round 17: Team Strengths: T = 3.58 | CT = 3.02.
[cCB] Balancing in 1 rounds.
[cCB] Unable to list any valid moves or swaps.
That is the output of the function which does the actual balancing. It shouldn't be called, if it's not going to balance this round.. That's fixed now too, i guess..
Attached Files
File Type: sp Get Plugin or Get Source (ccbalance.sp - 344 views - 50.0 KB)
File Type: smx ccbalance.smx (33.1 KB, 272 views)
__________________

Last edited by Peace-Maker; 09-25-2013 at 10:10. Reason: Mark CS_UpdateClientModel as optional
Peace-Maker is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode