Loading...
 

PogamutUT2004


How to handle bot threads in simple fashion?

With pogamut 2 you would start a bot and thereby starting a new thread which ran by itself. The original thread starting the bot thread would then continue unaffected.
With pogamut 3 this has apparently been changed or I'm misunderstanding something. When I'm creating a new bot the thread starting the bot pauses. I say it pauses because if I debug the bot thread runs and the bot starter thread runs (also some bot mediator thread runs).
My question is how do I start a bot thread without the thread starting the bot pauses?

Thanks for any help :-)

P.S. (A simply workaround is to start a thread that just hangs around doing nothing but thats a little silly.)
Yes, that was design-decision - having blocking start/stop methods.

The problem with non-blocking method is that there must be a non-standard feature (some sort of state-listening mechanism) that allows you to made them blocking.
Alas making any method non-blocking means just to execute the blocking method inside a thread.

Another nice thing about blocking-method is their ability to use exceptions - whenever the agent could not be started due to whatever error, an exception can be propagated back to you allowing you to write cleaner code (passing exceptions between multiple threads is no joke...).

I admit it leads to a weird state that to startup 10 bots in parallel means to start additional 10 threads but these threads usually terminates quickly. Note that
you can not achieve true start-10-bots-in-sync via these 10 threads - you would have to hack UT2004Bot.initCommandRequested() method. Or the better way - implement the logic of bots so it won't start doing anything till a requested number of bots connect to the game.

Additionally you may use ThreadPoolExecutor and create some StartAgentTasks to deal with the problem gracefully.

Advice: DO NOT EVER combine threads/tasks with SingleUT2004BotRunner ... use UT2004BotRunner instead.

Sorry to disappoint you.

Jimmy
Okay I can understand that. So my workaround is more like the solution :-D and thanks for the tip with UT2004BotRunner.
We're here to help ;)

Jimmy
 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.