Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Trigger based AI
Trigger based AI
Feb 17 2010, 9:24 pm
By: Burgled  

Feb 17 2010, 9:24 pm Burgled Post #1



First off, hi, this is my first time posting, I'm very interested in the work you people are doing here and would like to contribute if possible
I'm lazy and I don't make maps but I like coding and I like problem solving so I'm hoping some of my little trigger projects can be of benefit to
someone else's map rather than just sitting around.

Now on to my general AI "solution" I really doubt it is original and I have suspicions it is unfeasible for some reason, but you guys can point those out.
The principle is simple, in order to create AI for a unit type you just cycle through each one of those units, give it a burst of 'intelligence', and move
on to the next one, repeat forever (or until you want it to stop, w/e)
As far as how thats done well, replace the unit with its hero counterpart, when there are no longer any of that unit, replace the hero with the original
unit and hey presto you've got a cycle.

The effect is you have a location (or locations more usefully) that are always centered on one of those units, a random one at any given point in time.
Then you can start constructing intelligent behavior inside those location, which will then be applied to all the units of that type, in due time.

Disadvantages:

-units are healed when switched as well as possible unwanted upgrades/downgrades (hero unit) You can slow down the rate at which the switching occurs,
lowing the probability of it happening during a fight but in general I recommend this AI for many weak enemies rather than few strong ones.

-the intelligence is not omnipresent, it will only occur when the unit is switched but you can make it affect the behavior of other units within a certain
vicinity of the intelligent one, you'll see this in the example map.

-unsuitable for air units, they stack on each other, this will cause issues in the switching of them, perhaps there is a work around, I don't know it.
-perhaps it goes without saying but this will only be useful for computer units, human players like controlling their units (I think) xD

Advantages

-only one computer required.
-can create special behaviors, abilities in units.
-can be used to procedurally create and remove spawn points and rally points + pretty well anything else you can think up (I can explain this fully if you're interested)
-area-sensitive that is to say you can make units behave one way or have an ability in one region and totally different behavior/abilities in another, with a seamless hand-off.
-lots of room for tweaking and optimizing.

So anyways I'll give a simple example of a problem and the solution with this system at it's heart.
Zombies, how to make them both wander randomly but also swarm, I also used the fact that the location is randomly at a zombie to make it so
zombies only spawn where there are already zombies, at a random one, also they spawn by killing something, in this case civilians.
(exponential growth of zombies = coolness)

As far as actual AI in this example it is only the bottom 2 triggers of player 2. If you want to play around with it the simplest thing to do
is to make location Z4 bigger, this will make them more swarmy and less wandery, have fun.

Err and keep in mind this is my first time posting and I realize this may be unfeasible but idk, so be honest but please don't be mean *hides in corner*

Oh and I forgot to mention for your viewing pleasure ore = number of zombies, gas = number of civilians ^_^

Attachments:
Zombie AI Prototype.scm
Hits: 4 Size: 104.72kb

Post has been edited 1 time(s), last time on Feb 17 2010, 10:37 pm by Burgled.



None.

Feb 17 2010, 10:05 pm Jack Post #2

>be faceless void >mfw I have no face

You might want to check out http://www.staredit.net/topic/8681/ and http://www.staredit.net/topic/8936/

Anyway keep it up.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Feb 17 2010, 10:33 pm Burgled Post #3



Thank you, indeed I did see the artificial intelligence topic, in part it encouraged me to post this general system
perhaps I should have just posted it there but I didn't want to see it buried, maybe thats too narcissistic of me :P



None.

Feb 17 2010, 10:53 pm Sacrieur Post #4

Still Napping

It seems your thread is more about detection than the actual AI itself.



None.

Feb 17 2010, 11:08 pm Burgled Post #5



Quote
It seems your thread is more about detection than the actual AI itself.

Hmmm true enough, but to me it seems the challenge of AI/special abilities isn't making it for one unit, that in itself isn't a big struggle.
The challenge is how to make it work for any unit of a particular type, and this detection system allows for that. Perhaps I would have been
more accurate in stating it as a detection system off the bat but AI seems like the most obvious application, its true my example has only 2 triggers
that cause AI (wanted to keep it simple) but they have a big effect because of the system in which they operate.



None.

Feb 18 2010, 9:24 am Lanthanide Post #6



So your idea is to find a Zealot, replace it with Fenix, find another Zealot, replace it with Fenix and keep going until there are no Zealots left, then find a Fenix, replace it with a Zealot and issue an order?

This obviously doesn't work for units without heroes (BW units, shuttle, observer etc) and has the HP problem as you noted.

Why not just give the units to P9 instead of converting them to their hero counterpart?



None.

Feb 18 2010, 6:48 pm Burgled Post #7



Quote
So your idea is to find a Zealot, replace it with Fenix, find another Zealot, replace it with Fenix and keep going until there are no Zealots left, then find a Fenix, replace it with a Zealot and issue an order?

This obviously doesn't work for units without heroes (BW units, shuttle, observer etc) and has the HP problem as you noted.

Why not just give the units to P9 instead of converting them to their hero counterpart?

Tried it just now, but quickly ran into difficulties:

Quote
Players 9 though 12 cannot own triggers, and hence cannot run AI scripts, disabling the ability to set alliance or vision statuses. If provoked player 9-11 units will follow the assailant but not attack it- this is because they do not have vision (and cannot be given it by any means), not even for their own units which makes them unable to attack.




None.

Feb 18 2010, 7:01 pm CecilSunkure Post #8



You can create trigger-based Ai integrated into a VHP system!! Especially one that I describe in this topic. I had at one point begun to create a concept map, but I stopped because I have no time anymore. But yeah, it's very doable with only a single computer player. The only limitation would be locations, so you could have like 200 different units running at once, with individualized Ai. Since the hit points are virtual, you can detect them and run actions off of them. Yeah, it would be cool to make, but I really just don't have the time at the moment. Maybe in the future, I dunno.



None.

Feb 18 2010, 7:12 pm Jack Post #9

>be faceless void >mfw I have no face

Quote from name:Cervantes
You can create trigger-based Ai integrated into a VHP system!! Especially one that I describe in this topic. I had at one point begun to create a concept map, but I stopped because I have no time anymore. But yeah, it's very doable with only a single computer player. The only limitation would be locations, so you could have like 200 different units running at once, with individualized Ai. Since the hit points are virtual, you can detect them and run actions off of them. Yeah, it would be cool to make, but I really just don't have the time at the moment. Maybe in the future, I dunno.
Did you check my concept map, BTW? Other than how it uses two computers, is it the same as what you described?



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Feb 18 2010, 9:14 pm Lanthanide Post #10



Quote from Burgled
Quote
Tried it just now, but quickly ran into difficulties:

[quote]Players 9 though 12 cannot own triggers, and hence cannot run AI scripts, disabling the ability to set alliance or vision statuses. If provoked player 9-11 units will follow the assailant but not attack it- this is because they do not have vision (and cannot be given it by any means), not even for their own units which makes them unable to attack.

1. They cannot own triggers or run AI scripts, but trigger owned by P1-8 can still Order units owned by P9-11.
2. If you need AI scripts and units to attack, you'd still get much cleaner results by just using 2 CPU players (7 & 8) and giving units between them than you do using a single CPU and hero units.



None.

Feb 18 2010, 10:09 pm Burgled Post #11



Quote from Lanthanide
Quote from Burgled
Quote
Tried it just now, but quickly ran into difficulties:

[quote]Players 9 though 12 cannot own triggers, and hence cannot run AI scripts, disabling the ability to set alliance or vision statuses. If provoked player 9-11 units will follow the assailant but not attack it- this is because they do not have vision (and cannot be given it by any means), not even for their own units which makes them unable to attack.

1. They cannot own triggers or run AI scripts, but trigger owned by P1-8 can still Order units owned by P9-11.
2. If you need AI scripts and units to attack, you'd still get much cleaner results by just using 2 CPU players (7 & 8) and giving units between them than you do using a single CPU and hero units.

True enough, here I changed my example to giving instead of switching unit type, it works just as well, and solves the issue of HP
its a bit of a drag to have to use 2 computers instead of 1 but I can see it being more versatile.
Anyways, the way you achieve the switching is not so important, what is important is the wide range of AI behavior or special abilities
it allows you to create in a unit type. Anyways here's the modified map for your viewing pleasure.

Attachments:
Zombie AI modified.scm
Hits: 1 Size: 104.79kb



None.

Feb 19 2010, 5:19 pm CecilSunkure Post #12



Quote from name:zany_001
Quote from name:Cervantes
You can create trigger-based Ai integrated into a VHP system!! Especially one that I describe in this topic. I had at one point begun to create a concept map, but I stopped because I have no time anymore. But yeah, it's very doable with only a single computer player. The only limitation would be locations, so you could have like 200 different units running at once, with individualized Ai. Since the hit points are virtual, you can detect them and run actions off of them. Yeah, it would be cool to make, but I really just don't have the time at the moment. Maybe in the future, I dunno.
Did you check my concept map, BTW? Other than how it uses two computers, is it the same as what you described?
Yeah I did, but your method was very different from the one I had in mind. Mine wouldn't use the unit's actual HP for anything other than displaying current HP to players. Also, I planned to have all the units invincible, so all attack graphics would be simulated. I'm not sure how yours worked internally, but mine wouldn't be dependent on the unit being virtually represented, as in, a zergling could represent any type of unit that has already been created in the triggers. All Ai would be trigger based, since units are all invincible.

As for the Ai itself, I had planned to randomize most of the Ai based on surroundings of each individual unit. The random motion would be balanced out so that the likelyhood of something say.. Running away completely is very low, while the probability of it using one of its two attacks on you are both equal, and much higher than the fleeing probability, just as an example.

Post has been edited 1 time(s), last time on Feb 19 2010, 5:25 pm by Cervantes.



None.

Feb 21 2010, 12:57 am Burgled Post #13



anyways here is another example map that you can all not look at lol
I wanted to make a plant in SC, I used this system in combination with a mobile grid (in this case carriers)

Any sunken or spore colony in this map for player 2 will grow as far as they can in due time, of course the direction can be tweaked
(the mobile grid) as well as the speed of growth (by building delays) The triggers are not many or complex but the effect is
as intelligent as a plant would be expected to be. For this example It simply grows equally in all directions as fast as possible.

Attachments:
Plant.scm
Hits: 5 Size: 75.41kb



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
Please log in to shout.


Members Online: Roy