Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Priority Method
Priority Method
Feb 18 2010, 1:54 am
By: Sacrieur  

Feb 18 2010, 1:54 am Sacrieur Post #1

Still Napping

I've been playing around with trigger based AIs for a while and think I've come across an Idea that just might work.

This system builds off of my already current idea to track units individually with a 1x1 pixel location, what I call location identification (LID). With this system units can be identified from other like units by the same player. I designed it to achieve intelligence AI capable of playing close to a skilled level - which would ultimately end up in a map I'm planning.

The system is based off of priorities. What is more important, the life of an enemy, or the squad's well being? Furthermore, how do these contribute to the main objective? Of course SC can't possibly be programmed to answer these questions, but what it can do is mathematics. The priorities are based off of immediate circumstance and distant objectives. Immediate circumstance decide what the unit does - whereas distant objectives decide where the enemy goes.

Examples of Immediate Circumstance

- Enemy presence.
- Squad health.
- Assisting fellow squads.

These are all factors that are occurring in the now. A squad has 50% casualties and a squad nearby is free to help out. The 2nd squad will jump in with the first squad and attempt to provide cover fire while the 1st squad retreats to safety.

Examples of Distant Objectives

- Destruction of the enemy forces.
- Annihilation of the enemy HQ
- Capture of an outpost.

These are goals that must eventually become accomplished. A squad's main objective may be to capture an outpost, and everything it does is to work towards that, thus deciding what sector a squad will most likely be in.

So here's how I put this so SC can read it. The triggers will first check for any immediate circumstances that it needs to take advantage of. If there are then it will take action upon it. If there is no available immediate circumstance the squad will make a new offensive in pursuit of a main objective.

You may be wondering how exactly am I going to accomplish all of this - it's easy, I just make a danger gauge in coupling with a danger threshold. A squad's own combat effectiveness is shown as a danger threshold. Each unit in the squad adds a point. In addition, player heroes or allied units also modify this positively. The danger gauge is how strong the enemy is. This is the same as the danger threshold, only for the enemy (and using the ally's locations). What this essentially does is make a yes or no. If the danger threshold is above the danger gauge then the squad will commit to the action. If the answer is no the squad will not.

Ultimately I think it is a strong basis for a in-development system.

The only disadvantages I see is the inability to gauge unit HP (leading to a bit of dumbing down on the AI's part, it can't pick out weaker units or know its own well being). Shades of gray can be added to the danger gauge where the squad will be more or less cautious (or using aggressive, defensive, etc.)



None.

Feb 18 2010, 4:14 am ImagoDeo Post #2



Using one-pixel unit tracking with this could work. Alternatively, you could use inverted location tracking in combination with one-pixel tracking; that way, locations couldn't be passed off (the inverted loc), and you could still detect if the unit has died (the one-pixel loc).

The main difficulty in a system like this is unit tracking. It's not impossible, but it's not a simple thing to pull off.

If this theorizing becomes a reality, it would still only benefit certain maps. Namely, ones that have a lot of locations to spare for the individual units.

All this will become much easier in SC2, no doubt. It might not be worth discussing it now, with the release so close (within a few months).



None.

Feb 18 2010, 4:30 am Falkoner Post #3



I definitely agree with this, an AI can't have a defined set of rules, it has to have several objectives, which are prioritized. Of course, each objective has to have sub-objective's whose completion is necessary to fulfill the main objective, which would allow for a lot more micro.

This would have to be done with slower units, of course, the fast ones would escape the locations. Only problem with this system is that it is static, there is really no way of making it a dynamic system, at some point you will hit limits, either units or locations.



None.

Feb 18 2010, 5:02 am ImagoDeo Post #4



Quote from Falkoner
I definitely agree with this, an AI can't have a defined set of rules, it has to have several objectives, which are prioritized. Of course, each objective has to have sub-objective's whose completion is necessary to fulfill the main objective, which would allow for a lot more micro.

This would have to be done with slower units, of course, the fast ones would escape the locations. Only problem with this system is that it is static, there is really no way of making it a dynamic system, at some point you will hit limits, either units or locations.

Not entirely true. If you're careful, you can recycle the LID locations, keeping track of which locations belong to which squads. The Binary Boolean Array Storage system is not perfect for this, given StarCraft's integer limit, which is 2^31 - 1; it would limit you to approximately thirty-one LID locations, which is less than ideal. However, I can't think of any other efficient system.

You're right, it'd be easy to use up locations with this system, but you won't run into problems with unit limits. The unit limit is only a problem in mass games and big RPGs with preplaced monsters.



None.

Feb 18 2010, 7:31 am Burgled Post #5



Hey, started working on this, maybe it is on the right track?
the hard part seems to be keeping the squads from getting mixed up, after that they are not
too hard to keep together and maneuver around. I haven`t spent time creating complex objectives yet.

In this prototype the main objective is to get to and destroy the enemy... base thing?... but on the way if the squad
encounters a bunker (in the distance) they will go for it, they prioritize enemies over bunkers though. I`ve only started
making the AI for one side, once its tweaked enough I`ll copy it to the other and we can get some AI on AI action lol

It`s not using your method, but I think a start on your concept?

Attachments:
Squad AI Test.scx
Hits: 2 Size: 49.96kb



None.

Feb 18 2010, 9:13 am JaFF Post #6



Quote
If you're careful, you can recycle the LID locations, keeping track of which locations belong to which squads. The Binary Boolean Array Storage system is not perfect for this, given StarCraft's integer limit, which is 2^31 - 1; it would limit you to approximately thirty-one LID locations, which is less than ideal. However, I can't think of any other efficient system.
How are you going to cycle through units of different squads with one 1x1 location? Unless the units are unique, which is not very efficient and probably not what you were thinking of. Putting burrowed units under the squad units will slow them down a lot because you'll have to cycle through in 1 trigger loop. And how is storing booleans in deathcounters related to this?

Also, you can detect HP with DDS, if you don't want to use HVP. This only works for low amounts of damage increments a unit can take. So if your squad units have 10 HP and all the enemies have damages incremented by 2 (2, 4, 6, etc), then your damage increment amount is 10/2 = 5. So DDS will accurately detect the HP of this unit in a maximum of 5 loops (the unit can be damage during those 5 loops, it's just the procedure that takes 5 lopps). So you can detect HP when there are no enemies nearby and use that info.

Post has been edited 1 time(s), last time on Feb 18 2010, 9:44 am by JaFF.



None.

Feb 18 2010, 6:11 pm ImagoDeo Post #7



Quote from JaFF
Quote
If you're careful, you can recycle the LID locations, keeping track of which locations belong to which squads. The Binary Boolean Array Storage system is not perfect for this, given StarCraft's integer limit, which is 2^31 - 1; it would limit you to approximately thirty-one LID locations, which is less than ideal. However, I can't think of any other efficient system.
How are you going to cycle through units of different squads with one 1x1 location? Unless the units are unique, which is not very efficient and probably not what you were thinking of. Putting burrowed units under the squad units will slow them down a lot because you'll have to cycle through in 1 trigger loop. And how is storing booleans in deathcounters related to this?

Also, you can detect HP with DDS, if you don't want to use HVP. This only works for low amounts of damage increments a unit can take. So if your squad units have 10 HP and all the enemies have damages incremented by 2 (2, 4, 6, etc), then your damage increment amount is 10/2 = 5. So DDS will accurately detect the HP of this unit in a maximum of 5 loops (the unit can be damage during those 5 loops, it's just the procedure that takes 5 lopps). So you can detect HP when there are no enemies nearby and use that info.

What I meant by recycle was to reuse the locations when the current unit died. For example,

Quote
  • Squad A (5 units) is using LID locations 1-5.
  • Squad B (5 units) is using LID locations 6-10.
  • Squad C (5 units) cannot currently be formed because only ten units are active in squads at any one time.

Squad A loses two units: #5 and #3.
Squad B loses three units: #7, #10, and #8.

Squad C is now formed, and its units are assigned to LIDs 5, 3, 7, 10, and 8.

That's what I meant. The problem is keeping track of which units with which LIDs belong to which squads. You have to somehow store the information per squad. A Binary Boolean Array Storage is just a system that stores a sequence, which is what we need to tell the game which units belong to which squads.

How do you intend to scan HP with DDS? Damage it with the system until it dies, and then recreate it with the detected hitpoint level?

That might work, but you'd have to move the unit to a holding zone every cycle until its HP has been fully detected to prevent splash damage. It might cause AI problems and/or pathing problems. Plus, you have to decide when to scan, or how often, or under which conditions you should scan.

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



None.

Feb 18 2010, 8:17 pm JaFF Post #8



To avoid splash damage, just keep the unit in the battlefield and give it to another player and let a scarab owned by the standard owner of the squad to the damage. Deciding when to scan might be harder, but the general idea is to scan when there are no enemies nearby. This is tricky for situations when there's constant fighting going on.

And yes, now your recycling part makes sense.



None.

Feb 18 2010, 8:54 pm Sacrieur Post #9

Still Napping

This all works very well for a map I'm planning. It features low HP and damage values (so that 0 dmg can still be deadly). I will talk about the map later when I plan more out, but I'll elaborate on some squad stuff.

It is possible to replenish squads quite easily. Once the squad suffers from 50% losses (default) it will head back to base to heal and replenish its forces. The units with the LIDs of respective squads will only join with that squad. It simplifies the trigger work required considerably. The number of locations used per unit is practically tremendous for my purposes, meaning that squads may drop down to even four men per squad (I'm thinking of having 3 squads per team). If each unit is given 3 locations (LID, Immediate proximity, and distant proximity) and there are 3 squads that's 36 locations, which can be multiplied by 2 for a total of 72 (2 forces). If squads have 6 men each then that's 108 locations. In addition there will be not just marines, but tanks and aircraft support. Both of which need LIDs (they will operate as independent units, not squads). Say we allow 8 of these then we need to add another 48... So we're at 156 locations so far just for the squads. Location intensive indeed.

I think if I limit myself to a max of 156, that leaves me with 85 locations left to spend on w/e I would like. Each player will have possibly 3 - 8 locations for each player, so tack on another 48. We're at a grand total of 204 locations. This leaves us with 50 to spend on various nonsense. That's plenty. I'll probably spend 30 for bases and outposts, the other 20 will probably be thrown into the environment.

So yes, this is very location heavy, but will be well worth it.

HP detection is a strange thing. I suppose DDS could work for some applications. But the priority system is a progressive scan. There is no safe way to check units while they're in the midst of battle - which is where I need it the most.



None.

Feb 19 2010, 2:15 am Falkoner Post #10



Quote
You're right, it'd be easy to use up locations with this system, but you won't run into problems with unit limits. The unit limit is only a problem in mass games and big RPGs with preplaced monsters.

Well, the reason I said unit limits is very related to what JaFF said:
Quote
How are you going to cycle through units of different squads with one 1x1 location? Unless the units are unique, which is not very efficient and probably not what you were thinking of

My reasoning was that you would run out of unique units, because I don't see a way to easily do this that won't cause unit slowness or look nasty.



None.

Feb 19 2010, 3:26 pm poiuy_qwert Post #11

PyMS and ProTRG developer

Quote from Sacrieur
If each unit is given 3 locations (LID, Immediate proximity, and distant proximity) and there are 3 squads that's 36 locations, which can be multiplied by 2 for a total of 72 (2 forces).
You only need one location per unit, then you can center the proximity locations on it instead of having proximity locations for every unit all being constantly centered.




Feb 19 2010, 5:39 pm ImagoDeo Post #12



If you're using player-owned heroes in this map, you can force squads to target enemy heroes by allying with the opposing computer long enough to give the squad time to acquire the hero as a target. Then you can unally with the opposing computer, and the squad should continue to target the hero.



None.

Feb 19 2010, 8:12 pm Sacrieur Post #13

Still Napping

Quote from ImagoDeo
If you're using player-owned heroes in this map, you can force squads to target enemy heroes by allying with the opposing computer long enough to give the squad time to acquire the hero as a target. Then you can unally with the opposing computer, and the squad should continue to target the hero.

Thanks, that's a superb idea :D

Quote from poiuy_qwert
You only need one location per unit, then you can center the proximity locations on it instead of having proximity locations for every unit all being constantly centered.

You're right, this cuts back on locations, thanks.

You guys have really helped, I'm developing a proof of concept so maybe in a week or two (depending on how much extra time I get) I'll have it done and posted. Once it is successful I can start working on some other ideas.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[05:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[05:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[03:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
[2024-5-05. : 9:35 pm]
Vrael -- damn is that all EUD effects?
[2024-5-04. : 10:53 pm]
Oh_Man -- https://youtu.be/MHOZptE-_-c are yall seeing this map? it's insane
[2024-5-04. : 1:05 am]
Vrael -- I won't stand for people going around saying things like im not a total madman
Please log in to shout.


Members Online: Wing Zero, IlyaSnopchenko, Roy