Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,40 @@ type StartMatchOptions struct {
LauncherArg string `json:"launcherArg"`
}

func WaitForMatchReady(conn *rlbot.RLBotConnection, expectedMatchConfig *flat.MatchConfigurationT) error {
// wait for the correct match to start
var matchConfig *flat.MatchConfigurationT
var gamePacket *flat.GamePacketT
for matchConfig == nil || gamePacket == nil {
packet, err := conn.RecvPacket()
if err != nil {
return err
}

switch packet := packet.(type) {
case *flat.MatchConfigurationT:
matchConfig = packet
case *flat.GamePacketT:
gamePacket = packet
}
}

// while the match isn't active or the car is on the wrong team
for gamePacket.MatchInfo.MatchPhase == flat.MatchPhaseEnded || gamePacket.MatchInfo.MatchPhase == flat.MatchPhaseInactive || gamePacket.MatchInfo.MatchPhase == flat.MatchPhasePaused {
packet, err := conn.RecvPacket()
if err != nil {
return err
}

switch packet := packet.(type) {
case *flat.GamePacketT:
gamePacket = packet
}
}

return nil
}

func (a *App) StartMatch(options StartMatchOptions) Result {
// TODO: Save this in App struct
conn, err := rlbot.Connect(a.rlbot_address)
Expand Down Expand Up @@ -236,6 +270,19 @@ func (a *App) StartMatch(options StartMatchOptions) Result {
}

conn.SendPacket(&match)

conn.SendPacket(&flat.ConnectionSettingsT{
AgentId: "",
WantsBallPredictions: false,
WantsComms: false,
CloseBetweenMatches: false,
})
conn.SendPacket(&flat.InitCompleteT{})
err = WaitForMatchReady(&conn, &match)
if err != nil {
return Result{false, err.Error()}
}

conn.SendPacket(nil) // Tell core that we want to disconnect

return Result{true, ""}
Expand Down
8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
},
"dependencies": {
"@wailsio/runtime": "3.0.0-alpha.66",
"svelte": "^5.25.9",
"svelte": "^5.33.1",
"svelte-5-french-toast": "^2.0.4",
"svelte-dnd-action": "^0.9.60",
"svelte-dnd-action": "^0.9.61",
"svelte-portal": "^2.2.1"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@rsbuild/core": "^1.3.5",
"@rsbuild/plugin-svelte": "^1.0.8",
"@rsbuild/core": "^1.3.21",
"@rsbuild/plugin-svelte": "^1.0.10",
"typescript": "^5.8.3"
}
}
Loading