Unvanquished icon indicating copy to clipboard operation
Unvanquished copied to clipboard

bots: Delete useless warning

Open DolceTriade opened this issue 2 years ago • 6 comments

It's spammy. There are two calls to G_BotAdd(): One in sg_admin.cpp and another when running the bot fill code. The sg_admin codepath already warns when a bot cannot be added. The bot fill code path shouldn't care if a bot can't be added.

Fixes #1812

DolceTriade avatar Apr 10 '23 10:04 DolceTriade

We might prefer to use https://github.com/UnvanquishedAssets/unvanquished_src.dpkdir/pull/180 as a solution. I'm ok either way but I think I would rather keep the warning

necessarily-equal avatar Apr 11 '23 13:04 necessarily-equal

But that's just a default. What if I just always want max bots? I can do something like /bot fill aliens 100

DolceTriade avatar Apr 11 '23 16:04 DolceTriade

But that's just a default. What if I just always want max bots? I can do something like /bot fill aliens 100

Then in my experience you often get unbalanced teams. I remember I found the warning useful to understand wtf was going on in that case. The best way to solve it could be to add a more explicit, clear warning in the /bot fill code

necessarily-equal avatar Apr 12 '23 08:04 necessarily-equal

Then in my experience you often get unbalanced teams.

This has been fixed a while ago. Now, bot fill adds bots in each team in alternance.

I think it's a good idea to keep the warning to give a hint to admins that the limit has been reached. What is annoying is that the warning is spammed every 2 seconds, though, instead of only when there is an actual change in number of players, which would make more sense (as the filler function is only useful to call in that condition)

ghost avatar Apr 12 '23 17:04 ghost

Agreed. It's hard to determine max bots though at fill set time.

DolceTriade avatar Apr 12 '23 18:04 DolceTriade

Not sure (from daemon):

/*
==================
SV_BotAllocateClient
==================
*/
int SV_BotAllocateClient()
{
  int i;
  for (i = std::max(1, sv_privateClients.Get()); i < sv_maxclients->integer; i++) {
    if (svs.clients[i].state == clientState_t::CS_FREE) {
      break;
    }   
  }

  if (i >= sv_maxclients->integer) {
    return -1; 
  }

  client_t* cl = svs.clients + i;
  cl->gentity = SV_GentityNum(i);
  cl->gentity->s.number = i;
  cl->state = clientState_t::CS_ACTIVE;
  cl->lastPacketTime = svs.time;
  cl->netchan.remoteAddress.type = netadrtype_t::NA_BOT;
  cl->rate = 16384;

  return i;
}

So basically sv_maxclients->integer - sv_privateClients.Get() might do it. Not sure if gamelogic can access that though.

ghost avatar Apr 12 '23 19:04 ghost