How Come computer cannot use certain Tools/Weapons?

5 replies [Last post]
typematrix
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 2019-08-20
Posts: 2

Hi

first time caller,

How Come computer cannot use certain Tools/Weapons?
Even on Level 5 CPU, computer cannot use certain items like

Drill rockets , napalm ,flamethrowers, teleport blow torch, etc etc

There is quite a few.

regards

nemo
nemo's picture
User offline. Last seen 2 hours 23 min ago. Offline
Joined: 2009-01-28
Posts: 1744

Because writing AI is hard. Smile

https://hg.hedgewars.org/hedgewars/file/tip/hedgewars/uAIAmmoTests.pas#l66

Everything with a 0 has no code written for it yet. Well... apart from certain utilities which are handled separately like amInvulnerable.
But anything in this list that's a weapon.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

nemo
nemo's picture
User offline. Last seen 2 hours 23 min ago. Offline
Joined: 2009-01-28
Posts: 1744

That said the AI does use drill rockets. Just not drill strike.
We do need to look into why he sometimes does not use an available weapon when it is best choice. This has been a long-term frustration.
For example, if you give AI *only* bat, on a level with a ton of barrels, he will usually figure out to bat barrels to explode them on hogs.

He does not figure this out often enough in other circumstances though, preferring lower damage attacks. Need to look into why he's getting "stuck"

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

typematrix
User offline. Last seen 11 weeks 6 days ago. Offline
Joined: 2019-08-20
Posts: 2

Ya I Meant to say drill strike not drill rockets.
I can see why some items are very hard for an AI given the time constraints.
But some things seem relativity easy like a napalm strike is not much different than an air attack?

What about teleport?
One of biggest advantage a Human has over AI is ability to move around map, especially flying saucer teleport etc. What are challenges in coding teleport for the AI.

nemo
nemo's picture
User offline. Last seen 2 hours 23 min ago. Offline
Joined: 2009-01-28
Posts: 1744

Someone wrote some teleport code once I know. I think it was removed due to bugginess?
I think they'd even included telebombing. Would have to dig around in history to see why it was removed.
I agree it's pretty handy for AI esp in sudden death which they suck at avoiding.

If I had to guess as to why no one has done it yet, it could simply be difficulty of figuring out a good position for AI to use a relatively precious resource. I guess one thought could be to do something like... "get random location", "test some trajectories from random location to simulate bazooka strikes to see if the position is overexposed to drowning" "test possibilities of attack from that position" "subtract first number from second to get a weight"

Dunno. Something like that.

Napalm strike could certainly be done. The trick ofc is that it involves wind drift more than airstrike, so you'd have to include some rough calculation of anything it's almost certainly going to be hitting along the way. Like a rough pixel count. It's a lot more approximate a process than airstrike which is probably why no one has attempted it yet. Air drill strike is actually a lot more predictable. No wind, random particles. I guess again no one has bothered.

Are you interested in assisting with the AI?

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

sheepluva
sheepluva's picture
User offline. Last seen 5 days 5 hours ago. Offline
Joined: 2009-07-18
Posts: 533

In my opinion many of those issues/challenges come from AI lacking real spacial awareness.

If there was a multi-tier grid in memory that allows the AI to quickly find spaces and routes without the need to literally scan pixel by pixel, e.g. things that require navigation would be much easier to implement.
Basically similar to how Real-Time Strategy games accomplish high-performance path finding across huge maps.

That's actually one of my abandoned mini-projects from years ago (I added some multi-tier grid thing and wanted to implement AI roping on top of it, I think I gave up to due to roping being particulary weird about inputs and I was too lazy to look further into it).

But I'd gladly see somebody who's more prone to finishing what they started have a go at such concept Big Grin

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Copyright © 2004-2017 Hedgewars Project. All rights reserved. [ contact ]