Skip to content

Running agents online

Matej Straka edited this page Oct 26, 2024 · 2 revisions

Running agents developed here is very simple and can be achieved in a 3 simple steps:

  • Implement your agent by subclassing Agent class. Check here.
  • "Register" your agent via make_agent function in the AgentFactory here
  • Run the following script:
from generals.remote import autopilot
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--user_id", type=str, default=...) # Register yourself at generals.io and use this id
parser.add_argument("--lobby_id", type=str, default=...) # The last part of the lobby url
parser.add_argument("--agent_id", type=str, default="Expander") # agent_id should be "registered" in AgentFactory

if __name__ == "__main__":
    args = parser.parse_args()
    autopilot(args.agent_id, args.user_id, args.lobby_id)

This script performs what we call autopilot mode. It means that the agent will join the specified lobby, force start and play against whoever joins. After game ends, agent again forces the start and so on. You will get also replay links in the CLI at the beginning of each game!

Fourth step: after you successfully run your agent, send it to us! We will make it accessible so others can play and develop against it.

Clone this wiki locally