No announcement yet.

Better team balance request/help

  • Filter
  • Time
  • Show
Clear All
new posts

    Better team balance request/help

    How many of you have played in a server where the same 2-4 top score players end up on the same team many maps in a row? I know that I have seen this (and I am usually the one at the bottom of the list of the scores ). I am hoping that this can be a thing of the past after this mutator is finished.

    The only problem with this mutator is that I have very little direction for making this. After reading the wiki many times, and looking at sample code in other mutators, I think that I can do this.

    The general idea is to split up the top four (six, eight, whatever) scorers from the previous game into separate teams.

    First, I think that I would declare a struct
    struct PlayerScore {
        var String playerName // or player GUID;
        var float playerScore;
    Next I would declare a dynamic array of these to store each player's info
    var travel array<PlayerScore> prevGameScores;
    Then, in a PreBeginPlay event, the mutator would run the player names (or guids) through the mutator and designate the teams based upon score. For example, Player1, Player2, Player3, and Player4 had the top four scores (60, 57, 48, and 30 respectively) in the previous game. The mutator would separate the players as follows [seeding style]:

    Player1 (60 pts) & Player4 (30 pts) on RED
    Player2 (57 pts) & Player3 (48 pts) on BLUE

    I have no idea where to start on doing any coding for prebeginplay or anything of the like. Any help here would be great.

    During the game, if both teams have the same number of players the mutator could put a newly joined player on the team with the lower score.

    At the end of the game, the mutator would store the top 4(6,8,...) scores into the array. From my understanding, since the array is flagger 'travel' the contents will be retained while changing maps. If this is not the case, the scores could always be saved into a config file (this may be better anyway).

    I would greatly appreciate any help that anyone can give.

    If this would be easy for someone to just whip up, let me know. If it appears to be more time consuming and involved, I would like to try to work it out on my own, with help of course.

    Mutator to do the following
    1. Make struct for storing previous map scores
    2. Save these scores into an array which
      • is marked 'travel' so they are available in the next map or
      • is then saved into an .ini file so they are available in the next map
    3. Sort the top players before the map beigins as best as possible, seeding style
      For Example:
      • 1,4,5,8 - Red Team
      • 2,3,6,7 - Blue Team
    4. When new players join, if both teams have equal numbers place them on the team with the lower score
    5. At the end of the game, iterate through and store the player scores into the array declared above

    P.S. If you need any more information to attempt this project, let me know via pm or reply. Thanks again in advance for all who help.

    Mh, well, first of all, you can't use the PreBeginPlay()-Function. This function is called before any players joined.
    I think you need to trade all players in the same algorithm (I mean in which team they are).

    You can use the CheckReplacement()-Function and check if the actor is a xPlayer. Then a new player has joined (or is joining. be carfully: Playernames are often not yet initialized and if you try to get the player's GUID it will return the Server-GUID).
    Then you need to find the correct team based on the current scrore and the list.
    To find out when a player leaves you can use the NotifyLogout() function.

    And btw, you also need to prevent the players to change the teams manually.



      Thanks for the reply! I don't need to disallow manual team switching (or I can make it a config option) because this will be mainly used on a private server. Of the people who play, about 4-6 are much better than the rest. I am just trying to make it easier than manually changing every time. I assumed PreBeginPlay, but thanks for confirming that. Ill give your ideas a shot when I get time and post back the results.

      Thanks again.


        Hi ! I know it's probably too late, but...

        Did you succed with your mutator ? I'm interested with a score based team balance fonctionality.