Loading...
 

PogamutUT2004


Finding the flag quickly?

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?
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
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
Thank you for great answers. The flag bases location was actually what I wanted and it is clear now.
 

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.