Possibly unit limit bug?

Possibly unit limit bug?

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
Orakio
Posts: 119
Joined: 25 Aug 2006, 16:41

Possibly unit limit bug?

Post by Orakio »

Yesterday I hosted a 5v5 game on green fields with a unit limit of around 2600.

At some point I had to take and got a spare tech 1 air field so I decided to build 100 scouts for an amusing scouring mission to end all scouting mission.

Anyway at some point after around 80 were made I could no longer build anything at all. I did CTRL+A to select all units and I only had 450. I also double checked script .txt and the max unit limit (MaxUnits) was indeed set to 2600 or so. To confirm it was definitely the unit limit I sent my 80 scout planes in to get shot to pieces and after that I could build again.

So basically there's a horrible unit limit bug.

I'm not entirely sure but I think this is the code responsible:

if(gameSetup)
maxUnits=gameSetup->maxUnits;
if(maxUnits>MAX_UNITS/gs->activeTeams-5)
maxUnits=MAX_UNITS/gs->activeTeams-5;

There were a couple of specs I think. And 5000/11 then -5 is 450 although I'm not entirely sure what activeTeams consists of. Basically what I would have thought this code should look like is this:

if(maxUnits>MAX_UNITS)
maxUnits=MAX_UNITS;

Because otherwise the maxunits value is being applied not per team but for all the teams combined.

That code is from UnitHandler.cpp so if it is indeed wrong a fix would be great, because otherwise 8v8 games are limited to 300 or less units per player regardless of what the unit limit was set to.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

No, that's not a bug. MAX_UNITS is the engine unit limit (5000), maxUnits in CUnitHandler is the per-team unit limit (which is the value set in script.txt, divided by the number of active teams to ensure that it doesn't exceed 4995 if there's only one activeTeam). Thus if there are 16 players and all are in their own team, everyone gets to build a maximum of (n / 16) - 5 units, where n can be at most 5000.
User avatar
Spawn_Retard
Posts: 1248
Joined: 21 Dec 2006, 14:36

Post by Spawn_Retard »

i thought it was 5000 per person not shared equally with every player in the host
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The total limit is 4998, if more than that are in play Spring crashes. Therefore the limit is set so that if all players hit their limit they still don't reach 4998.
Post Reply

Return to “Help & Bugs”