Programming Need some help setting up 4player doubles

Hi,

I'm trying to setup a doubles or free4all game with 4 players but can't get it to work. So this is what I tried:

JavaScript:
Teams.setGeneratorFactory(TeamGenerators);
let streams = BattleStreams.getPlayerStreams(new BattleStreams.BattleStream());
const gameSpecification = { formatid: "gen5doublescustomgame" };
let playerTeam = [
    {
        name: "Blastoise",
        species: "BLASTOISE",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
    {
        name: "MEW",
        species: "MEW",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
];
let player2Team = [
    {
        name: "MEW",
        species: "MEW",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
    {
        name: "MEW",
        species: "MEW",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
];
let player3Team = [
    {
        name: "MEW",
        species: "MEW",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
];
let player4Team = [
    {
        name: "MEW",
        species: "MEW",
        item: "",
        ability: "",
        moves: ["TACKLE"],
        nature: "",
        gender: "",
        evs: {
            hp: 252,
            atk: 252,
            def: 252,
            spa: 252,
            spd: 252,
            spe: 252,
        },
        ivs: {
            hp: 15,
            atk: 15,
            def: 15,
            spa: 15,
            spd: 15,
            spe: 15,
        },
        level: 25,
    },
];
const p1spec = {
    name: "P1",
    team: Teams.pack(playerTeam),
};
const p2spec = {
    name: "P2",
    team: Teams.pack(player2Team),
};
const p3spec = {
    name: "P3",
    team: Teams.pack(player3Team),
};
const p4spec = {
    name: "P4",
    team: Teams.pack(player4Team),
};
class PlayerController extends RandomPlayerAI {
    receiveRequest(request: any): void {
        console.log(request);
    }
}
const p1 = new PlayerController(streams.p1);
const p2 = new RandomPlayerAI(streams.p2);
const p3 = new RandomPlayerAI(streams.p3);
const p4 = new RandomPlayerAI(streams.p4);
void p1.start();
void p2.start();
void p3.start();
void p4.start();
void (async () => {
    for await (const chunk of streams.omniscient) {
        console.log(chunk);
    }
})();
void streams.omniscient.write(`>start ${JSON.stringify(gameSpecification)}
>player p1 ${JSON.stringify(p1spec)}
>player p2 ${JSON.stringify(p2spec)}
>player p3 ${JSON.stringify(p3spec)}
>player p4 ${JSON.stringify(p4spec)}`);
document.getElementById("submit-button")?.addEventListener("click", () => {
    let inputElement = document.getElementById(
        "input"
    ) as HTMLInputElement | null;
    if (inputElement) {
        const text = inputElement.value;
        streams.p1.write(text);
    }
});


1. The output is :
|t:|1715014702
|gametype|doubles
|player|p1|P1||
|player|p2|P2||
|teamsize|p1|2
|teamsize|p2|2
|gen|5
|tier|[Gen 5] Doubles Custom Game
|clearpoke
|poke|p1|Blastoise, L25, F|
|poke|p1|Mew, L25|
|poke|p2|Mew, L25|
|poke|p2|Mew, L25|
|teampreview
|player|p3|P3||
|player|p4|P4||

but it should be (I think):
...
|poke|p1|Blastoise, L25, F|
|poke|p2|Mew, L25|
|poke|p3|Mew, L25|
|poke|p4|Mew, L25|


when I use one team per side so p1 and p3 use one team and p2 and p4 use another team I get this output:
|t:|1715015924
|gametype|doubles
|player|p1|P1||
|player|p2|P2||
|teamsize|p1|2
|teamsize|p2|2
|gen|3
|tier|[Gen 3] Doubles Custom Game
|rule|HP Percentage Mod: HP is shown in percentages
|
|t:|1715015924
|start
|switch|p1a: Blastoise|Blastoise, L25, M|94/94
|switch|p1b: Typhlosion|Typhlosion, L25, M|93/93
|switch|p2a: Mew|Mew, L25|104/104
|switch|p2b: Meganium|Meganium, L25, F|94/94
|turn|1
|player|p3|P1||
|player|p4|P2||





2. how to target a pokemon?
The documentation is very confusing to understand.: https://github.com/smogon/pokemon-showdown/blob/master/sim/SIM-PROTOCOL.md
getting:

chunk-UKPKZ6WI.js?v=9708ba80:368594 Uncaught (in promise) Error: [Invalid choice] Can't move: Tackle needs a target

when I do move 1

The documentaition says something about +1 +2 for selecting enemies buthow does the full command look like?

I tried move 1 +1

3. The documentation states that there are singles, doubles, triples, multi, or freeforall.
but only singles and doubles works. Any other option just uses singles.
const gameSpecification = { formatid: "gen5doublescustomgame" };
This is how I set the game format also I searched through the code and could only find the formatid for singles and doubles in the code.
 

Mathy

I swear I have good sitting posture
is a Programmeris a Forum Moderatoris a Battle Simulator Moderator
3. The documentation states that there are singles, doubles, triples, multi, or freeforall.
Currently the repo only comes packaged with formats that are available on the main server, but you can make your own formats using a config/custom-formats.ts file. Here's an example to make a format called gen5multibattlecustomgame:

JavaScript:
export const Formats: FormatList = [
    {
        name: "[Gen 5] Multi Battle Custom Game",

        mod: 'gen5',
        gameType: 'multi',
        searchShow: false,
        debug: true,
        battle: {trunc: Math.trunc},
        // no restrictions, for serious (other than team preview)
        ruleset: ['Team Preview', 'Cancel Mod', 'Max Team Size = 24', 'Max Move Count = 24', 'Max Level = 9999', 'Default Level = 100'],
    },
];
I tried move 1 +1
Try move 1 1? move 1 +1 should also work; if it's not then that's a bug
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top