Finding the flag quickly? Posted by xman on Thu 29 of Apr, 2010 13:36 CEST Is there a way in API how to find a flag more quickly than through navigating in the map and waiting for the bot to see it?
Posted by jakub.gemrot on Thu 29 of Apr, 2010 14:02 CEST It depends what you mean by "finding the flag". Pogamut bots can't cheat directly - so the exact answer (probably) is no. But may be ... are you asking how to find FlagBases? Where the flag can be found if it is not stolen? Cheers, Jimmy
Posted by michal.bida on Thu 29 of Apr, 2010 15:05 CEST To get the flag bases - points where the flag gets respawned - look in GameInfo object. This object can be retrieved in botInitialized or botSpawned methods. Now to get the Flags - there will be two flag objects in your WorldView. Flag object class is FlagInfo. Code below inserts all the flags in the game in myFlags HashMap indexed by team number. FlagInfo object will be constantly updated by the Pogamut (note that most of the attributes will be updated only if you see the flag). Map myFlags = new HashMap(); @Override public void botSpawned(GameInfo info, ConfigChange config, InitedMessage init, Self self) { for (FlagInfo flag : getWorldView().getAll(FlagInfo.class).values()) { if (myFlags.containsKey(flag.getTeam())) { getLog().severe("Flag for this team already saved. Bug? " + flag.getTeam()); } else { getLog().severe("NEWFLAG team:" + flag.getTeam()); myFlags.put(flag.getTeam(), flag); } } } best, michal
Posted by xman on Thu 29 of Apr, 2010 15:19 CEST Thank you for great answers. The flag bases location was actually what I wanted and it is clear now.