Coding for 32 Players

Coding for 32 Players

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Coding for 32 Players

Post by REVENGE »

Anyways, this is a continuation of the topic in the Off Topic subforum regarding raising the unique team limit to 32. Currently, the error code that is raised when trying to setup such a game occurs at the end of this code in GameSetup.cpp:

Code: Select all

/**
@brief Load teams and remove gaps in the team numbering.
@pre numTeams, hostDemo initialized
@post teams loaded
@todo don't store in global variables directly
*/
void CGameSetup::LoadTeams(const TdfParser& file)
{
   // i = team index in game (no gaps), a = team index in script
   int i = 0;
   for (int a = 0; a < MAX_TEAMS; ++a) {
      char section[50];
      sprintf(section, "GAME\\TEAM%i\\", a);
      string s(section);

      if (!file.SectionExist(s.substr(0, s.length() - 1)))
         continue;

      // Get default color from palette (based on "color" tag)
      int colorNum = atoi(file.SGetValueDef("0", s + "color").c_str());
      colorNum %= palette.NumTeamColors();
      float3 defaultCol(palette.teamColor[colorNum][0] / 255.0f, palette.teamColor[colorNum][1] / 255.0f, palette.teamColor[colorNum][2] / 255.0f);

      // Read RGBColor, this overrides color if both had been set.
      float3 color = file.GetFloat3(defaultCol, s + "rgbcolor");
      for (int b = 0; b < 3; ++b) {
         gs->Team(i)->color[b] = int(color[b] * 255);
      }
      gs->Team(i)->color[3] = 255;

      gs->Team(i)->handicap = atof(file.SGetValueDef("0", s + "handicap").c_str()) / 100 + 1;
      // leader field is relocated in RemapPlayers
      gs->Team(i)->leader = atoi(file.SGetValueDef("0", s + "teamleader").c_str());
      gs->Team(i)->side = StringToLower(file.SGetValueDef("arm", s + "side").c_str());
      // allyteam field is relocated in RemapAllyteams
      gs->SetAllyTeam(i, atoi(file.SGetValueDef("0", s + "allyteam").c_str()));

      // Is this team (Lua) AI controlled?
      // If this is a demo replay, non-Lua AIs aren't loaded.
      const string aiDll = file.SGetValueDef("", s + "aidll");
      if (aiDll.substr(0, 6) == "LuaAI:") {
         gs->Team(i)->luaAI = aiDll.substr(6);
      } else {
         if (hostDemo) {
            aiDlls[i] = "";
         } else {
            aiDlls[i] = aiDll;
         }
      }

      teamRemap[a] = i;
      ++i;
   }

   if (teamRemap.size() != numTeams)
      throw content_error("incorrect number of teams in GameSetup script");
}
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Coding for 32 Players

Post by KDR_11k »

um, that would mean it lost teams during the remapping. I assume you raised the MAX_TEAMS #define already?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Coding for 32 Players

Post by Kloot »

Honestly, the issue is not how to raise the team limit (which is
trivial, your snippet is just one of a few places that reference it),
but whether it should be done in the first place.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coding for 32 Players

Post by REVENGE »

Actually, testing with just a script.txt and 1 player + 16 bots results in a crash. Apparently, the script file stops being parsed correcting after adding the definition for the 17th player/team.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coding for 32 Players

Post by REVENGE »

Kloot wrote:Honestly, the issue is not how to raise the team limit (which is
trivial, your snippet is just one of a few places that reference it),
but whether it should be done in the first place.
Look, what the fuck is up with all of this FUD spreading? Fact of the matter is, we have mods that could be played perfectly fine with 32 players. What is this irrational fear of nubs hosting 32 player BAsh parties? I mean honestly, we don't even get many 16 player games these days because people KNOW the engine has limitations and KNOW that late-game with 16 players becomes a lag-fest.

If you don't want to see it done, don't help. Otherwise, please continue spreading FUD in the Off Topic thread.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Coding for 32 Players

Post by Kloot »

1) You could have bothered to read Tobi's reply in your topic, who
happens to be lead dev around here and ultimately decides what
"gets done": ;)
Tobi wrote: Current max is fine IMHO; we already increased it not so long ago. (Though that was lobby only IIRC.)

I think the arguments are very true, people will try it anyway and it will (often) fail. If not due to a bug, then because more players means the player with the weakest CPU is even weaker, and more units, so basically two factors that will contribute to more lag in such games.
2) Knowing how the engine works and where the bottlenecks are a
little better than you, I'd cut back on the FUD accusation-slinging if
you'd like to have any chance of your patch being committed before
the end of the century.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coding for 32 Players

Post by REVENGE »

I did read Tobi's reply. I respectfully considered his opinion, but I continue to maintain my position. Unless he explicitly says so, I don't believe that his reply was in the category of a cease and desist, just his recommendation.

Secondly, I respect your position as someone who would indeed, be much more familiar with Spring code than I currently am. However, I was annoyed by the fact that the debate over whether or not this should be done in the first place has followed here into the dev forum, when I hoped it would stay in the Off Topic forum. My accusation of FUD-spreading toward you was off base, sorry about that.

Let me restate my opinion: I believe that there are some mods and even some maps for BA upon which a 32 player game would be both fun and viable. Comshooter and War Evo have already been given as examples, I believe some other mods [possibly kernel panic] could benefit from having a player limit higher than 16 players. Would a 32 player 5000 unit limit BA Delta Siege RevX v3 lag to hell? Absolutely. But who says we need to play such games, given the option? There is nothing to back the logic of the argument: nub hosts 32 player, people lag, ?????, LOSS OF PROFIT.
if you'd like to have any chance of your patch being committed before the end of the century.
If you are really against this idea, then I won't solicit any help from you. If those who control commit access are against it, then there's no helping it won't happen.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Coding for 32 Players

Post by Peet »

Bandwidth would also become an issue for the host - as far as I can tell, the amount of data sent from the host to the players would be in the order of n^2. So a 32 player game will require 4 times as much upstream bandwidth as a 16 player one...I'm not sure how much this would be exactly but it would probably rule out hosting for many people.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coding for 32 Players

Post by REVENGE »

Peet wrote:Bandwidth would also become an issue for the host - as far as I can tell, the amount of data sent from the host to the players would be in the order of n^2. So a 32 player game will require 4 times as much upstream bandwidth as a 16 player one...I'm not sure how much this would be exactly but it would probably rule out hosting for many people.
Hmm, true. The average DSLer gets around 512K of upspeed. Fortunately for me, I get a symmetric 3K/3K from my university.
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Re: Coding for 32 Players

Post by Erom »

If you are worried about nubs misusing this, I supose you could leave the limit at 16 by default and have a switch somewhere in preferences or whatever to "Enable 32 player mode. Note: Requires significantly more RAM and bandwidth than 16 player mode. Some modules do not support 32 player mode."
User avatar
clericvash
Posts: 1394
Joined: 05 Oct 2004, 01:05

Re: Coding for 32 Players

Post by clericvash »

Erom wrote:If you are worried about nubs misusing this, I supose you could leave the limit at 16 by default and have a switch somewhere in preferences or whatever to "Enable 32 player mode. Note: Requires significantly more RAM and bandwidth than 16 player mode. Some modules do not support 32 player mode."
Something like that would be a good option.
But seriously has anyone ever even seen a 16 player game, okay, a 10 player game?
Highly doubtful.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Coding for 32 Players

Post by Forboding Angel »

I would like to have to option, because some of the battles in Evolutions Multiplayer campaign will require large teams on either side commsharing.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Coding for 32 Players

Post by Pxtl »

Mod-defined maybe? Anybody tested how well, say, War Evolution (or some other single-unit-per-player mod) would run in a 64-player game?

Either way, it should be a warning behavior, not a blocking one.
malric
Posts: 521
Joined: 30 Dec 2005, 22:22

Re: Coding for 32 Players

Post by malric »

clericvash wrote: But seriously has anyone ever even seen a 16 player game, okay, a 10 player game?
Highly doubtful.
I find it funny, but usually the XTA games have quite many players (as I can remember I played 10 and 12 games at least). Of course there is just one XTA game open, but at least you know most of the people. :-)

A bit more on topic. A find it strange that the bandwidth is n^2. Shouldn't it be a linear function ?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Coding for 32 Players

Post by Peet »

malric wrote:A bit more on topic. A find it strange that the bandwidth is n^2. Shouldn't it be a linear function ?
n clients making orders, n clients to send them to

n*n

n^2
User avatar
caldera
Posts: 388
Joined: 18 Oct 2005, 20:56

Re: Coding for 32 Players

Post by caldera »

stalag has 2.5k up so go for it. i'd really like to try some BA 16v16 DSD, but i guess jj has to re-implement his springmark then :P
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Coding for 32 Players

Post by smoth »

32 X 500 = 16,000 units

the games have a hard time with 2000
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Coding for 32 Players

Post by KDR_11k »

Spring is capped at 10k units.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coding for 32 Players

Post by REVENGE »

caldera wrote:stalag has 2.5k up so go for it. i'd really like to try some BA 16v16 DSD, but i guess jj has to re-implement his springmark then :P
That is exactly the kind of game we wish to avoid. :lol:
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: Coding for 32 Players

Post by Otherside »

caldera wrote:stalag has 2.5k up so go for it. i'd really like to try some BA 16v16 DSD, but i guess jj has to re-implement his springmark then :P
the fail is starting :(
Post Reply

Return to “Engine”