Loading...
 

PogamutUT2004


senses.seeIncomingProjectile()

Hi,

I'm having problems with senses.seeIncomingProjectile(). For some reason, it never returns true. I've shot everything directly at the bot but also tried missing him, but nothing worked.

I simply wrote this into the logic method to test it,

System.out.println("getLastIncomingProjectile " + senses.getLastIncomingProjectile());
test = senses.seeIncomingProjectile();
test2 = senses.seeIncomingProjectileOnce();

System.out.println("test: " + test);
System.out.println("test2: " + test2);

test and test2 have @JProp, so I can observe the values directly too.
Hi!

I'm so sorry to say that "senses" is a terrible module! Do not use that! We're going to refactor that...

Instead, check this tutorial: http://pogamut.cuni.cz/pogamut_files/latest/doc/tutorials/01-ResponsiveBot.html

And write your own event listener for "IncomingProjectile.class" object event

Something like (into your bot class):

@ObjectEventListener(objectClass=IncomingProjectile.class, eventClass=WorldObjectUpdatedEvent.class)
public function incomingProjectileEvent(WorldObjectUpdatedEvent<IncomingProjectile> event) {
...
}

Cheers!
Jakub
Shameless self promotion.

I don't know what exactly you need but if you need to know which projectile of which type is visible and or nearby, have a look at the Weaponry Shooting project and if you need it to do more, it should be easy to extend it.

Project: svn://artemis.ms.mff.cuni.cz/pogamut/trunk/project/Addons/UT2004WeaponryShooting
Class: nl.tudelft.pogamut.ut2004.agent.module.sensor.Projectiles
Thank you two for the help, I'll look into that and will report back when I get to try it.

What I need is just that the bot is aware of projectiles that pass him closely and the source of the projectile is out of sight (Like when someone shoots at you from behind but misses).
Note that you will never get any notifications about things you cannot see!!!

Jimmy
Yes, I only need to get a notification of things that are in the bots sight, like a shock rifle projectile that comes from behind and goes into the bots sight.
Ok, I've been able to have a look at it.

@Jakub
The listener on the IncomingProjectile class did exactly what I needed, except that not everything seems to be a projectile?
Is there another class I can listen for stuff like shock rifle primary shot, link gun secondary and lightning gun?

@Jimmy
Looks interesting, but I'm not sure how/where I should/could add a listener.

Thanks for the help again.
I don't think that it is possible to export Shock rifle primary / Link gun secondary or lighting gun primary :-(

They are not "projectile" inside UT2004 so there is no way to sense them inside UnrealScript so GameBots2004 cannot export them ;-(

Best,
Jimmy
Oh I see, too bad, but thanks. This will have to suffice then.

Also, I meant to address mpkorstanje with
"Looks interesting, but I'm not sure how/where I should/could add a listener."
GameBots really are not exporting Shock rifle primary / Link gun secondary or lighting gun primary, but you can sort of infer this information when you see enemy player. Lets say you see enemy player, you check that his current weapon is lighting gun Player pl.getWeapon() and that he is currently shooting pl.getFiring() - 1 primary fire, 2 - secondary fire, 0 not firing. Then you can check his rotation pl.getRotation() and see where actually he is shooting. Rate of fire of weapons can be inferred from weaponry module - from ItemDescriptors for the weapons, e.g. this.weaponry.getWeaponDescriptor(ItemType.LIGHTNING_GUN).getPriBotRefireRate(); (but the weapon has to be available on current map your bot is in, otherwise this will return null). For basic orientation where are these non-projectile shots ending this should be enough.

Best,
Michal
@ralf

Projectiles is a sensor module so it should have a world view to which you can add the listener. Won't solve your problem though. :-)
 

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.