jdmonin / JSettlers2

Java Settlers project home, downloads, and GPLv3 source code. To download the latest version as a JAR, see https://github.com/jdmonin/JSettlers2/releases/latest .
http://nand.net/jsettlers/
GNU General Public License v3.0
160 stars 63 forks source link

long timeouts when bot1 hangs, yet, other bot2 tries to trade to bot1 #57

Closed kotc closed 4 years ago

kotc commented 5 years ago

situation:

expectation: detection of hung bots and/or applying 'auto trade timeout' to bots too

jdmonin commented 5 years ago

Thanks for the suggestion.

It looks like this might be doable in SOCGameHandler.endTurnIfInactive() by checking if trade is waiting for a response from any humans, or only bots, then for bots using a shorter timeout than ROBOT_FORCE_ENDTURN_TRADEOFFER_SECONDS (60 seconds).

Possibly it could also build on the "stubborn robot" code added in 9954f87 for issue #47, but even without that, an improvement from 60 seconds would be good.

kotc commented 5 years ago

i think max tradeoffer should be limited to ~10s, 60s seems quite long time, even with humans involved (although clicking 'counter offer' might extend the timeout if human interacts)

jdmonin commented 5 years ago

I've added code to look for human players before using the 60-second timeout; that should improve the situation. Thanks again for the idea!

jdmonin commented 5 years ago

For practice games, code is part of the latest beta JAR available at http://nand.net/jsettlers/beta2/JSettlers2.jar

kotc commented 5 years ago

well, what i meant 'look for human players' is that sometimes bots offer trade only to other bots, even if there are humans in the game too. but even then, i think bots trade offers shouldnt last more than 5-8s for the sake of long pauses in game flow

jdmonin commented 5 years ago

OK thanks, that makes sense. Shortened to about 6 seconds when trade is offered only to bots.

kotc commented 5 years ago

dont know if it's related, but i'm seeing lots of: robot 6: debugRandomPauseActive for 12 seconds etc. with 20190319

jdmonin commented 5 years ago

Oh bummer. OK, that's now fixed and re-uploaded.

jdmonin commented 4 years ago

Newly released v2.0.00 includes this. Thank you :)