Forged Alliance Forever Forged Alliance Forever Forums 2012-07-08T10:12:17+02:00 /feed.php?f=2&t=1470 2012-07-08T10:12:17+02:00 2012-07-08T10:12:17+02:00 /viewtopic.php?t=1470&p=15372#p15372 <![CDATA[Re: New lobby function]]> Statistics: Posted by Ze_PilOt — 08 Jul 2012, 10:12


]]>
2012-07-08T02:04:33+02:00 2012-07-08T02:04:33+02:00 /viewtopic.php?t=1470&p=15359#p15359 <![CDATA[Re: New lobby function]]>
I ran into a slight issue though...

warning: Error running OnRelease script in <deleted object>: ...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(702): attempt to concatenate field `PL' (a nil value)
stack traceback:
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(702): in function <...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua:678>
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(1142): in function `LaunchGame'
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(1167): in function <...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua:981>
...orever\gamedata\faforever.faf\lua\ui\lobby\lobby.lua(2164): in function `OnClick'
...d alliance\gamedata\mohodata.scd\lua\maui\button.lua(133): in function <...d alliance\gamedata\mohodata.scd\lua\maui\button.lua:122>

Code:
      local ratingTable = {}
      for i = 1, numAvailStartSpots do
         if gameInfo.PlayerOptions[i] then
            LOG("Rating  of player " .. i .. " : " .. gameInfo.PlayerOptions[i].PL)
            rating = gameInfo.PlayerOptions[i].PL
            ratingTable[rating] = i
         end
      end


Problem is at .. gameInfo.PlayerOptions[i].PL

In skirmish mode (using an init file to load faf and phantom-x), the AIs I'm testing with don't have ratings (unless I missed something), so this code bombs out. I can use fixed spawns for testing purposes, but you may want to look at some exception handling for a scenario where there are no player ratings (i.e. AIs).

Statistics: Posted by Duck_42 — 08 Jul 2012, 02:04


]]>
2012-07-07T21:24:05+02:00 2012-07-07T21:24:05+02:00 /viewtopic.php?t=1470&p=15339#p15339 <![CDATA[New lobby function]]>
If you set a Auto-Team other than manual or none, and if the spawns are random, the function will automatically kick in.

It will take the rating of all the players, and place them in the correct team to have the most even match possible. (this is a crude algorithm, but it will give 75% the best result, and at worst something not that bad if not the best).

The option can't be disabled : If you don't want it, don't set auto-team and/or random spawn.

Statistics: Posted by Ze_PilOt — 07 Jul 2012, 21:24


]]>