Skip to content

Commit

Permalink
Make UMS AI team detection work for 2 players
Browse files Browse the repository at this point in the history
  • Loading branch information
icza committed Mar 7, 2023
1 parent 3994a35 commit 52c3ef9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rep/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@ func (r *Replay) computeUMSTeamsAI() {
// Slot IDs of player's last Alliance commands, observers filtered out:
pidSlotIDs := map[byte][]byte{}

// If there are 2 players only, it's unlikely they'll check alliances and thus below team detection would fail.
// To make it still work, initialize with self-alliance:
if len(playerSlotIDs) == 2 {
for _, p := range players {
if !p.Observer {
pidSlotIDs[p.ID] = []byte{byte(p.SlotID)}
}
}
}

// Stop after ~90 seconds: use the "initial" teams
frameMaxLimit := repcore.Duration2Frame(90 * time.Second)
frameMinLimit := repcore.Duration2Frame(18 * time.Second)
Expand Down

0 comments on commit 52c3ef9

Please sign in to comment.