[Pogamut-list] Determining which team to spawn a bot into during initialization

jakub.gemrot pogamut-forum at diana.ms.mff.cuni.cz
Tue Apr 20 08:18:02 CEST 2010


Re: Determining which team to spawn a bot into during initialization

Author: jakub.gemrot

Hi Simon!

Yes, no problem (except, it is currently hidden). All you need to do is to hook the listener to PlayerListObtained event, see [http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/javadoc/|JavaDoc] The listener can be set up via getWorldView().addEventListener(PlayerListObtained.class, playerListListener) where playerListListener is of type IWorldEventListener ... remember that you have to store the reference to that listener, otherwise it will be a subject for GC!

This event is raised before the getInitializeCommand() is called therefore you may obtain how many players are inside the game.

To make it more comfortable - we're going to extend the Players agent module to take PlayerListObtained into the account may be even providing method
getTeamBalance() to provide a number of a team to connect into.

Best,
Jakub aka Jimmy

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=79&post_reply=1#form>





More information about the Pogamut-list mailing list