diff --git a/cmd/ba/main.go b/cmd/ba/main.go index 7f3748b..d458c11 100644 --- a/cmd/ba/main.go +++ b/cmd/ba/main.go @@ -86,6 +86,7 @@ func makeapp() *cli.App { cli.StringFlag{Name: "host", Value: "", Usage: "IP serving the trainer; required"}, cli.StringSliceFlag{Name: "agent", Usage: "Agent images"}, cli.IntFlag{Name: "port", Value: 8080, Usage: "Port serving the trainer"}, + cli.StringFlag{Name: "viz-host", Value: "127.0.0.1", Usage: "Specify a host for the visualization server"}, cli.StringFlag{Name: "record-file", Value: "", Usage: "Destination file for recording the game"}, cli.StringFlag{Name: "map", Value: "hexagon", Usage: "Name of the map used by the trainer"}, cli.BoolFlag{Name: "no-browser", Usage: "Disable automatic browser opening at start"}, @@ -99,6 +100,7 @@ func makeapp() *cli.App { host := c.String("host") agents := c.StringSlice("agent") port := c.Int("port") + vizhost := c.String("viz-host") recordFile := c.String("record-file") mapName := c.String("map") nobrowser := c.Bool("no-browser") @@ -111,6 +113,7 @@ func makeapp() *cli.App { tps, host, port, + vizhost, nobrowser, recordFile, agents, diff --git a/subcommand/train/main.go b/subcommand/train/main.go index 1bc12f4..8837e4a 100644 --- a/subcommand/train/main.go +++ b/subcommand/train/main.go @@ -55,6 +55,7 @@ func TrainAction( tps int, host string, vizport int, + vizhost string, nobrowser bool, recordFile string, agentimages []string, @@ -224,7 +225,7 @@ func TrainAction( vizgames[0] = viztypes.NewVizGame(game, gamedescription) vizservice := visualization.NewVizService( - "127.0.0.1:"+strconv.Itoa(vizport), + vizhost+":"+strconv.Itoa(vizport), mapName, func() ([]*viztypes.VizGame, error) { return vizgames, nil }, recorder, @@ -239,7 +240,7 @@ func TrainAction( utils.FailWith(startErr) } - url := "http://localhost:" + strconv.Itoa(vizport) + "/arena/1" + url := "http://" + vizhost + ":" + strconv.Itoa(vizport) + "/arena/1" if !nobrowser { open.Run(url)