• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

AI Visibility Detection

Status
Not open for further replies.
Level 3
Joined
Jul 28, 2013
Messages
24
Hey everyone! :)

I'm creating an AI for my Map Lord of the Archers, in which you use an ability to shoot arrows around. Right now the AI ignores fog of war, which means it begins to shoot, as soon as you walk into the maximum range of its arrows. The thing is, i dont want them to ignore the fog of war! i tried stuff like "unit is fogged" or "unit is visible" and stuff like that, but then the AI won't shoot at all :(

For those who're interested:
Lord of the Archers

Can someone help me out with a Visibility Detection System? :)
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,227
ok? can you show me what i've done wrong? :D

http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/complete-list-things-leak-126761/
http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
http://www.hiveworkshop.com/forums/...quick-tutorial-common-triggering-tips-190802/

Check up on location leaks and unit group leaks since they're the most common ones.

OT:
you could check if the distance is lesser than vision range, however that's buggy and rather annoying to create. Is unit visible should do the trick, mind showing the trigger where it fails?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,277
The way your AI is structured with multiple periodic loops generating orders is not recommended as you then have to deal with order conflicts (so that one decision loop does not interact with the other).

In your style of map I would suggest a single loop that does attacking, evasion and movement with an update period of ~0.1 seconds (the average latency human players suffer when playing in multiplayer). In such a case you can start by checking if there are any visible enemies nearby, and if so then proceed to attack/evade otherwise simply look to move around somewhere (possibly even at other players for harder cheating AI).

In such a map evasion is probably key so you start by trying to generate an evade order. This is done by having a list of "hazards" which you then process through for appropriate ones and move out the way of any you are in. You generate hazards every time someone fires an arrow. They are destroyed (removed from list) every time the arrow falls (stops, finishes etc). All AI could filter the same hazard list removing friendly hazards (ones which deal no damage) and hazards that are not appropriate for the unit (no one cares about a hazard on the other side of the map). In the case of simple line hazards it is always most efficient to move diagonally away from the hazard (no cartoon style bolder chase situation). Evasion is possible both directions in case there is an active hazard in the dodge location. If both directions contain hazards then ultimately it should try and move into the hazard with the lowest weight (hurts less) but this can probably be ignored and the AI can instead "grit its teeth" and move on to a counter attack.

Attacking is pretty straight forward. Shot at standing still targets. Shoot in front of moving targets. Possibly add some randomness for difficulty adjustment or to make AI less predictable. The tricky part is to make learning AI which is a lot more effective than standard prediction AI. You could profile players to some extent recording how they respond to hazards. For example if you shoot a hazard in front of a player if they respond by stopping after a few times (random number for no predictability) you try shooting at them and the player might stop right inside the hazard. Although that would give better AI performance it probably is excessively complicated.
 
Level 3
Joined
Jul 28, 2013
Messages
24
yeah i dont even know if i'm able to do that. but i made the ai only for people who want to test my map. they can take a quick look at it and if they like it, they can proceed and play it with friends. the ai moves quite random so a it has a bit of evasion and has basic aiming. also the loops dont interact with each other (or at least you dont see that they do) so i'm pretty happy with my AI now :) anyway thanks for your help :)
 
Status
Not open for further replies.
Top