Loading...
 

PogamutUT2004


How to make a simple double-dodge??????

Hi again,

I'm coding my bot movement using just raycasting and I want my bot to move quick through the environment. To do so, I need him to double dodge easily (dodge + jump), but in the pogamut functions I just found dodge (in the move module).

I have tried this:

move.dodge (new Vector3d (1, 0, 0));
move.jump();

But he just makes a front dodge.

Also I have experienced some problems with the functions in the "senses" module.

I want to know if I hit with a certain weapon to change to another weapon, but sometimes when I hit, "senses.isCausingDamage ()" returns false, and when is true, if I try to check the amount of damage given, it NEVER gets it right.

Those are two big problems for me right now. Hope you can help me!!
Hi!

1) regarding dodging ... unfortunately the dodge alone is simulated by small JUMP thus you can't truly combine it with jump at all ... you might want to create your own dodgeLeftJump / dodgeRightJump command that will use Strafe and Jump (the Jump must be carried out after a small amount of time, you will probably need to have your own "timing" thread for that :-( ).

Please be aware that "jumps" hurt bot's aiming a lot! You might want to use move.strafeLeft(), move.strafeRight() instead?

2) unfortunatelly "senses" module was not fully debugged yet. Please describe the situation more closer and I will try to fix it

Cheers!
Jimmy
First of all! Thanks for answering Jimmy!

I know dodging can hurt my bot aim, but we're building a bot that can compete against humans. I was an UT2K4 gamer back in my time (serious UT2k4 gamer), so we are trying to use my knowledge to make the bot behave like a gamer would. It is very important to double-dodge in certain situations. For example, if you are fighting an enemy, the best way to avoid some threats some times is making a double-dodge.
I will try dodge + jump again, with some delay and see if it works. The problem for me is that I'm new to Java, I have always programmed in C++, so there are things like interfaces or exceptions that I still don't understand very well.

I'll show you an idea of the code I have right now, so you can figure out what is not working:

changeWeapon ();
executeMovement ();
shootEnemy();

The code I have, is of course, a bit more sophisticated than that, but, in general terms, that is pretty much the idea, so, right next to that I do the following:

// check if I hit the enemy with any weapon
if (senses.isCausingDamage()){
PlayerDamaged playerHit= senses.getLastHitPlayer();

// If we killed the enemy, reset the information we are guessing about the enemy
if (senses.isPlayerKilled(enemyId)) { //
// check if I hit the enemy with any weapon
if (senses.isCausingDamage()){
PlayerDamaged playerHit= senses.getLastHitPlayer();

// If we killed the enemy, reset the information we are guessing about the enemy
if (senses.isPlayerKilled(enemyId)) { //
First of all! Thanks for answering Jimmy!

I know dodging can hurt my bot aim, but we're building a bot that can compete against humans. I was an UT2K4 gamer back in my time (serious UT2k4 gamer), so we are trying to use my knowledge to make the bot behave like a gamer would. It is very important to double-dodge in certain situations. For example, if you are fighting an enemy, the best way to avoid some threats some times is making a double-dodge.
I will try dodge + jump again, with some delay and see if it works. The problem for me is that I'm new to Java, I have always programmed in C++, so there are things like interfaces or exceptions that I still don't understand very well.

I'll show you an idea of the code I have right now, so you can figure out what is not working:

changeWeapon ();
executeMovement ();
shootEnemy();

The code I have, is of course, a bit more sophisticated than that, but, in general terms, that is pretty much the idea, so, right next to that I do the following:

// check if I hit the enemy with any weapon
if (senses.isCausingDamage()){
PlayerDamaged playerHit= senses.getLastHitPlayer();

// If we killed the enemy, reset the information we are guessing about the enemy
if (senses.isPlayerKilled(enemyId)) { // This is never true!! not a single time I kill the enemy
enemyInfo.reset ();
}
else {
enemyInfo.hit (playerHit.getDamage()); // most of the times I get null pointer exception here
}

// If we hit the enemy and the weapon we are carrying is the Shock Rifle or Sniper Rifle/Lightning Gun
// we activate the flag hitShockSniper
if (weaponry.getCurrentWeapon().getType().equals(ItemType.SHOCK_RIFLE)
weaponry.getCurrentWeapon().getType().equals(ItemType.LIGHTNING_GUN)

weaponry.getCurrentWeapon().getType().equals(ItemType.SNIPER_RIFLE)) {
hitShockSniper = true;
}
}

Maybe, you are thinking, that instead of checking the weapon that I am currently using, I could just check what is the name of the weapon that made the hit... well, that function returns nothing at all. If I do the following:

playerHit.getWeaponName();

nothing is returned.

The hitShockSniper is a static flag that I use to change to shock rifle. For example, if I hit the enemy with the sniper or shock, I want to make the next hit with the shock rifle. So what I do is, I turn on the flag if I hit, and in the next logic iteration if the flag is on, changeWeapon() switches to shock rifle (if available) and turns off the flag.

I know I could probably use a more (much more) sophisticated approach, but as I said, I am new to Java, and for example, I have worked with concurrency just in Ada. I don't really get how listeners work =/ so by now, I'll stick with this primitive style of coding, at least in the first version of the bot.

By the way, how do you make jungigation work?? I am currently using the pathExecutor provided by default. I noticed that using Warshalls algorithm could be a lot more efficient, because you do everything in the beginning, but again, I don't know what to change (I don't understand very well the tutorial).

Any help would be really appreciated (: as an exchange I can give you tips (if you want) of how skilled people usually play UT.

Greetings from Spain!! (:
Hi!

Cool you're making some very clever bot! Just side notice - there is an addon project UT2004Tournament (there are already some example archetypes for it) that will allow you to repeat 1 match many times in order to give you solid statistical validity about the efficiency of your behavior.

First thing I will have to do is review code inside Senses class, it wasn't used much so it is possible there are some bugs there as you're reporting that some methods are not working.

Second, if "senses" are going to be fixed, your code should work.

Third, listeners are concept that is used a lot in pogamut, synonymum for that is observer / callback ... basicly you may hook up a "listener" to various events that are happening inside UT2004. For instance there is an event PlayerKilled (some other player died), so you may easily hook a listener to that. See "responsive bot" tutorial and the example archetype in order to see how it is done (basicly, you may create a method in java and annotate it with @EventListener, think of @EventListener as semantic information that is indicating that this method should be used as "callback" when some concrete event occurs in the world and is sensed by the bot).

Fourth, yes fwMap is much better than pathPlanner but you can't use it to plan to any location (sadly), but you may use navBuilder to actually alter the navigation graph the fwMap should work with.

Fifth, we're going to revisit the Jungination again (much has happened since the time the tutorial was written) and as I'm not the one who has written the library, I can't truly give you any info for that. But you may write to the author Lubomir (varga@plaintext.sk) and ask him personally.

I'm sorry I'm currently in the middle of preparation to my PhD final exam, so I can't help you more currently. I'll be free around mid of May.

Cheers!
Jimmy

P.S.: I would be greatly interested in pro-tips about UT ;-)
Thanks a lot man!

That definitely saved my day. I am currently doing this project as my ending career project. The bot uses data bases and a distributed genetic algorithm to improve during time. I will check that info about UT2k4 project.

I hope you can fix those methods. If you can't I'm sure I'll work something out.

P.D: Whatever you want to ask about pro-tips, feel free to contact me, I guess you can get my mail through the forum, if you can't, just tell me (:

Cheers!!
I have taken your advise, and finally I have understood how listeners works. Turns out, that using listeners everything that didn't work before, now works!! Now I still have to figure out how to make a double-dodge.

Another doubt I have is, how can I connect my bot to a remote server? I was planning to use a server on my university, but I can't make my bot work on a remote server. I've put the correct ip on netbeans and I have forwarded ports correctly, but it just works if I launch the bot in the same place as the server is running. I can play in the server from my pc, but I can't make the bot connect to the server ):

By the way, the event listeners method is veeeery clever, great work!
Hi!

Great job ;-) ... using listeners gives you more power for sure.

Regarding the connection, there are a few possibilities how you can make your bot to connect to different server:

1) look up the project directory for PogamutPlatformCustom.properties there are:
pogamut.ut2004.bot.host=localhost
pogamut.ut2004.bot.port=3000

Change them to whatever you want.

2) if you want to do that right from the code, search up main() method,
there is something like:

new UT2004BotRunner(GoalBot.class, "EmptyBot").setMain(true).startAgent();

change it into:

new UT2004BotRunner(GoalBot.class, "GoalBot", "your-new-address", 3000).setMain(true).startAgent();

e.g.

new UT2004BotRunner(GoalBot.class, "EmptyBot", "192.168.0.1", 3000).setMain(true).startAgent(); // if the server is running at 192.168.0.1

or

new UT2004BotRunner(GoalBot.class, "EmptyBot", "my.server.at.univ.com", 3000).setMain(true).startAgent();

Note that 3000 is default port of GameBots2004 but you may even force GameBots2004 to listen at different port (edit UT2004/System/GameBots2004.ini before you start up the server)

Aslo be sure that the firewall does not block GameBots2004 at your remote server.

Hope it helps!

Cheers!
Jimmy
Anyway, could you describe in detail what double-dodge is?

If it is something ordinary human player can do, we should provide a special command inside GB2004 to do such thing.
This approach would be the easiest.

Is it something like "double jumping" to left/right?

Best,
Jimmy
Yes, exactly. It's something like double jumping and you can do it in the game. A double dodge occurs whenever you push two times one direction and after that you push jump, but that it's not all! there is also wall jumps.

To double-dodge:

press two times one direction and then jump

To wall-double-dodge

jump (normal jump) against one wall and then press two times on direction (must be contrary to the direction of the wall) and then jump

To double-jump-wall-dodge

make a double jump against one wall; when you are in the highest point of the double jump, press two times one direction (again, the direction of the dodge must be contrary to the direction of the double dodge).

From all of those, the only one that should be implemented is double-dodge, because in the end, the other two can be implemented mixing jumps and dodges. Try it in the game and you know what I mean!!

Maybe the reason why you don't know it is because in UT3 they erased them, they wanted to make UT3 more like UT99 (where double dodges didn't exists). Anyways, just in case, in UT3 you can, jump, double-jump, dodge, and wall-jump-dodge.

Oh! I almost forget, each time the server changes the level, my bot dies and doesn't reconnect, how can I make him connect again and again to the server? (I want him to stay alive for a long time on the internet)
Ok, I will try to talk it through with our GB2004 programmer and we'll see if it can be implemented.

Regarding the reconnection - I think it will suffice to create while(true) statement in main() method, so whenever the bot dies, it will start the bot once again.
You will probably also want to try/catch exceptions or relax "true" condition to something else.

Best, Jimmy
Hi.

I have re-implemented dodge command so it supports double dodging + wall dodging. Wall dodging is a bit tricky though, because it requires a wall close to the bot in the opposite direction of the dodge.

New GameBots can be got here by svn:
svn://artemis.ms.mff.cuni.cz/pogamut/trunk/project/Main/Gamebots/GameBotsUT2004

or use http://artemis.ms.mff.cuni.cz/websvn and go to /trunk/project/Main/Gamebots/GameBotsUT2004/System download .u file and replace your old UT2004/System/GameBots2004.u with the new one.

New DODGE command documentation here: http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/gamebots/ch06.html

Best,
Michal
Wow!

That was incredibly fast. Thanks a lot guys, you're doing a great job! (:
By the way Michal, maybe you've put the wrong link, but I can't seem to find the new documentation of DODGE. When I look for DODGE command the only thing I find is what it was before, just a command to make a dodge in the direction of a vector3d. How do you make the double-dodge and wall-dodge now?
Try to refresh the page - maybe you are looking on the old cached version. New doc for DODGE:

DODGE -
Causes the bot to dodge to supported direction. Only one (successful) dodge per second allowed.

Direction (Location)
Relative vector, will be normalized. The direction of the dodge will be added to current bot rotation.

FocusPoint (Location)
Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.

Wall (boolean)
Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.

Double (boolean)
If true performs a double dodge in specified direction.
Great!

Just a side note, you could add a timer to double so we could make a larger double dodge, it's usefull to do some tricks like jumping against a wall to double dodge after that and get across a ramp (:

Anyways, great job, and thanks again!
One more question, how do you send commands to gamebots? currently I am capturing Messages through event listeners, but I don't know how to send commands. I've looked in the documentation but I can't seem to find where it says how to do it. Any help would be apreciated (:

Cheers!
act.act(new Dodge().setYourParameters().setHere());

Cheers!
Jimmy
Again, I have a couple of questions hahaha, I'm sorry guys, I know I'm a pain in the ass, but you're helping me a lot :P

I was trying to make the bot explore the entire level. Because navpoints tell you if they are roaming spots, I thought of making the bot through this spots. But how can I get all navpoints in a level? I mean, through items I can get location of all of the items in one level, but what if I want all the Navpoints in a level?

Another interesting question, I don't know if you know this, but actually a combo in UT is shooting shock ball (secondary fire of shock rifle) and then hitting the shock ball with the primary fire of the shock rifle. If you hit one of this balls with the shock rifle, a explotion happens (and it's really painfull/usefull). I know I can know if there are incoming projectiles, but what about the things I shoot? can I know the position of shock ball?

I need it, to build complex shooting. I could shoot some of this balls and then make the closest one to my target explode by hitting it with the primary fire of the shock rifle.

I'm gonna post an old video (actually really old) of when I started playing with one of the best clans in my country, so you can see what I mean:

http://www.youtube.com/watch?v=wNB--gUkvE0

Skip to 2:04 and you see what happens when you hit that ball. You can also check how wall jumping and double-dodging is used, if you watch the whole thing.

I'm going to open a new thread anyways, just to give you some feedback, about the things that don't work properly and the ones that could be introduced.

Cheers (:
WTH! I've never seen anybody doing such thing, never tried that :-D (LOL)

This rocks :-D

Anyway, all navpoints can be obtained by calling: world.getAll(NavPoint.class)

It will return you Map so if you want to iterate over it you will need world.getAll(NavPoint.class).values()

Best!
Jimmy

P.S.: I'll pass it to Michal Bida, if such projectile can be exported (but I think it should already be exported? O.o)
It doesn't work!! I mean, I can get all the navpoints in the map, because I've counted them and it's like 207 something like that, but when I try to see if they are roaming spots I always get false.. It actually doesn't matter what you ask, it always says false. I've done the following in botSpawned:

Map existingNavPoints = world.getAll(NavPoint.class);
for (NavPoint spot: existingNavPoints.values()) {
if (spot.isRoamingSpot()) {
roamingSpots.add(spot);
}
}

if (roamingSpots.isEmpty()) {
body.getCommunication().sendGlobalTextMessage("There are no roaming spots");
}
else {
target = roamingSpots.get(next);
next = (next + 1) % roamingSpots.size();
IPathFuture pathHandle = pathPlanner.computePath (info.getLocation(), target);
pathExecutor.followPath(pathHandle);
}

And then, the same when target is reached, assuming of course that next, starts on 0.

It always says "There are no roaming spots". Even if I try "spot.isAIMarker()" or "spot.isSnipingSpot()" it always returns false. So in the end, roamingSpots is empty. Help!!
Hi,

Gamebots.u is not updated or maybe I'm doing something wrong. For example:

act.act(new Dodge().setDirection(new Vector3d (1, 0, 0)));

works. If you look into http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/gamebots/ch06.html there is no new documentation about the double-dodge (it's not a problem at all, Michal told me how to use the new method). I replaced the GameBots2004.u file in UT2004/System but when I go to netbeans and type:

act.act(new Dodge().setDirection(new Vector3d (1, 0, 0)));
act.act(new Dodge().double (true);

it doesn't work. Maybe it's because I'm not using the parameters as I should. I didn't quite understand how Jimmy told me to use commands for GB2004. What I usually do is, create a new command (by looking into the GB documentation), in this case Dodge, and call it's default constructor, once I've done that, I assume that the methods I can call are the ones that are commented below each command in the documentation of GB. If it works differently, please write down an example that shows how to use double-dodge, maybe that way it will be clearer.

(:
> If you look into http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/gamebots/ch06.html(external link) there is no new documentation about the d

This is copy paste from the location you provided:

DODGE - Dodge — Supported in packages: GameBots2004, GBScenario, GameBotsAnim, Connections: Bot,

Causes the bot to dodge to supported direction. Only one (successful) dodge per second allowed.

Direction (Location)

Relative vector, will be normalized. The direction of the dodge will be added to current bot rotation.
FocusPoint (Location)

Point the bot should focus after dodge command. Note that if not specified, this will be set automatically by dodge command to 1200 ut units in front of the bot at the time when the dodge command is issued.
Wall (boolean)

Attemtps to do a wall dodge. There has to be a wall in the opposite direction of the dodge. If there isn't, nothing will happen! This switch overrides "Double" dodge switch.
Double (boolean)

If true performs a double dodge in specified direction.

Refresh your web page.

> act.act(new Dodge().setDirection(new Vector3d (1, 0, 0)));
> act.act(new Dodge().double (true);

Dodge() is an object and you cannot define new methods just by calling them . I have commited changes to Dodge command to our repository. You need to update your Pogamut version. The best thing would be if you would start to use Pogamut SVN version. Eventually we will generate new installer and put it on our web page.

Best,
MIchal
 

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.