Loading...
 

PogamutUT2004


Bot Radius Detection

Hi all,
I'm using Pogamut 3.0.11(not the latest version).

Could someone kindly assist me in changing the radius size for each bots detection on it's surrounding. To explain further,I need to control the exact size a bot will be able to see in distance.

Thanks
Hi!
Currently there is no direct way how to control the bots vision radius. However, it is easy to implement yourself - you need function like this:

public static final double MAX_DISTANCE = 500;

    public boolean canSee(ILocated object) {
        if (info.getLocation() != null && info.getLocation().getDistance(object.getLocation()) < MAX_DISTANCE)
            return true;
        return false;
    }


And each time you receive some object in listeners, or you just ask if you can actually see the object with canSee function - if no, you will ignore the object.

But controlling the vision radius might be useful and it will be probably implemented in the future.

Best,
Michal
Hi Michal,

I was checking Pogamut 3 documentation (http://artemis.ms.mff.cuni.cz/pogamut_files/documentation-project/Pogamut-Programmer_Documentation.pdf) and came across CanSee() method on page 12. The same method you mentioned above.
Documentation states that this method is inside RemoteBot class. For this reason I included NetBeans plug-in 'JarSearchResult' (http://blogs.sun.com/toxophily/entry/simple_netbeans_module_to_search) to search through Pogamut Libraries, however I was unable to find RemoteBot class.

Could you kindly inform me where I can find the class containing CanSee() method.

Thanks.

Regards,
dirkmalta
RemoteBot class is a part of GameBots2004 mod. GameBots2004 are a modification of UT2004 written in UnrealScript that enables connecting to the game through TCP/IP, control the bots and export the information about their environment.
GameBots2004 are not a part of Pogamut Java libraries. Instead their source is in UT2004 folder, because they are compiled directly by the UT engine. There is no way how to call GameBots2004 canSee method from Java. For UT+Gamebots/Java communication we have provided API that currently does not support setting of vision radius for the bot. However, as I said above - you can simulate this in Java with a simple function.
I guess we will integrate the radius setting to our API, but I cannot promise it before the half of the December.

Best,
Michal
Fully understood.
Thank you once again for your time Michal.
I will share my code once I get my bot running correctly.

Regards,
dirkmalta
Hi all. Here is a code sample I created thanks to the assistance provided by Michal. It allows Bots to have different radius sizes which detects surroundings.

Very simple but can be efficient:

TurnTo t = new TurnTo();
Map map = players.getPlayers();
for (Player p : map.values())
{
//System.out.println(p.getName() + " - " + p.getLocation());
if (p.getLocation() != null) {
if ((info.getLocation() != null) && (info.getLocation().getDistance(p.getLocation()) < MAX_DISTANCE)) {
body.getCommunication().sendGlobalTextMessage("VERY CLOSE!!!!");
p.
getAct().act(new TurnTo().setTarget(p.getId()));
getAct().act(new Shoot().setTarget(p.getId()));
} else if ( (info.getLocation() != null) &&
(info.getLocation().getDistance(p.getLocation()) > MAX_DISTANCE) &&
(info.getLocation().getDistance(p.getLocation()) < MAX_DISTANCE_OUT)) {
body.getCommunication().sendGlobalTextMessage("Close");
//pathExecutor.followPath(pathPlanner.computePath(bot, p));
} else {
body.getCommunication().sendGlobalTextMessage("I sense someone....");
}
}else {
body.getCommunication().sendGlobalTextMessage("peace all around");
}
}
 

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.