LARG / HFO

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

Attempt at fixing NPC ghosts #13

Closed uniq10 closed 8 years ago

uniq10 commented 8 years ago

I tried to fix the issue by killing the NPC's soon after launch. The NPC's connect to the server and immediately receives a lot of data from the server so a time wait was necessary after launch so that the "(bye)" message on terminate was received when the server was not busy. Also a wait was done after the launch so that the launch a new NPC doesn't cause the "(bye)" to be missed by the server.

This fixed the issue in my system. Please check if it is working.

mhauskn commented 8 years ago

This has definitely fixed the defense_captured problem, but it seems there is still a problem with out_of_bounds. I run:

./bin/HFO --offense-npcs 1 --offense-agents 0 --defense-npcs 0 --defense-agents 0 --headless

and about 1/2 of the trials end with OOB. Running with --no-sync, virtually no trials end with OOB. This makes me think that when the game runs very fast (as with sync mode), either the Trainer can't keep up with the messages provided by the server or the server sends messages with out-of-date information.

Watching the logs from these replays, the ball goes through the goal then, two frames later, the Trainer ends the trial, then after 1 frame of the new trial, it restarts the trial again.

uniq10 commented 8 years ago

I get around 20% OOB (Maybe because of slower machine) and I believe that it's because the Trainer can't keep up. As a fix I think we will get better results if we modify the isGoal() logic.

If we keep track of the x and y coordinates of the last player who touched the ball and use it draw a line from that player to the ball, it is a goal only if that line intersects the goal line. This will report a goal even if the Trainer gets the ball data long after it has crossed the goal line.

I am not very sure about this but I think it should work assuming the shot doesn't curve (ie. all shots are in a straight line) and it doesn't deflect off other players.

PS: Can you tell me what version of boost libraries you are using

uniq10 commented 8 years ago

I am also facing another error:

When issue the high level action MOVE my agent dies and i was able to get this as the reason:

agent: /usr/include/boost/smart_ptr/shared_ptr.hpp:680: typename boost::detail::sp_dereference::type boost::shared_ptr::operator*() const [with T = ActionChainGraph; typename boost::detail::sp_dereference::type = ActionChainGraph&]: Assertion `px != 0' failed.

This is also happening if in your high_level_random_agent.cpp if i force it use move all the time.

mhauskn commented 8 years ago

Okay, I'll look into this later today or early tomorrow.

On Sun, Oct 18, 2015 at 8:50 AM, UNiQ10 notifications@github.com wrote:

I am also facing another error:

When issue the high level action MOVE my agent dies and i was able to get this as the reason:

agent: /usr/include/boost/smart_ptr/shared_ptr.hpp:680: typename boost::detail::sp_dereference::type boost::shared_ptr::operator*() const [with T = ActionChainGraph; typename boost::detail::sp_dereference::type = ActionChainGraph&]: Assertion `px != 0' failed.

This is also happening if in your high_level_random_agent.cpp if i force it use move all the time.

— Reply to this email directly or view it on GitHub https://github.com/mhauskn/HFO/pull/13#issuecomment-149018296.

mhauskn commented 8 years ago

I've pushed a fix to the master branch. See commit:

https://github.com/mhauskn/HFO/commit/db95ebefb992805c3f6056667cc00f950a5fb254