[Pogamut-list] How to make a simple double-dodge??????

aisa87 pogamut-forum at diana.ms.mff.cuni.cz
Sat Apr 9 14:05:05 CEST 2011


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

Author: aisa87

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!! (:

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





More information about the Pogamut-list mailing list