LARG / HFO

Half Field Offense in Robocup 2D Soccer
MIT License
228 stars 93 forks source link

How to run the sarsa agent #102

Closed MoonieC closed 4 years ago

MoonieC commented 4 years ago

Hi @mhauskn , me again. This time I want to know how to run the SARSA agent. I noticed there is a MakeFile in the directory sarsa_offense and sarsa_defense respectively, and I make them in terminal, but when I try to use the sarsa_agent, it cannot connect. Can you tell me how to address this problem? Should I use "make" command in all directory? And I also want to know if it is possible for me to write my own dqn agent using AC algorithm in python just like this sarsa agent? can I write a single .py file and connect it or should I make a library like you did for sarsa_library? I am really dying to know...

mhauskn commented 4 years ago

You should run make from the same directory as the makefile (e.g. sarsa_offense). You'll first need to start the server in the correct configuration:

./bin/HFO --offense-agents 1

Then you can connnect your sarsa_offense agent (from a different terminal):

./high_level_sarsa_agent

In general you can writer either Python or C++ to interface with HFO. The high_level_sarsa_agent may be a good starting point for you: https://github.com/LARG/HFO/blob/master/example/sarsa_offense/high_level_sarsa_agent.py

MoonieC commented 4 years ago

Thx! It works! So does this mean that I should not add '--port xxxx' in my command?

mhauskn commented 4 years ago

It uses the server's default port of 6000, so unless you start the server on a different port, then you can omit it.

MoonieC commented 4 years ago

Okay, I think I get it. Thanks again!