Where does the computer pick its 'enemy'?
#1
Posted 06 August 2004 - 03:39 AM
I want to find how the computer AI picks it opponent, the one it concentrates on, so as when the computer has multiple opponents, it goes for certain ones above others (ones it can kill easier). For instance if the computer was playing Airforce I wouldn't want him to target Infantry General if there was an America against him, which he could kill easier.
An added bonus would be the comp would be able to 'gang up' when there multiple players on both sides...
Anyone have any idea if this is a script or if it can be changed at all?
Cheers,
Lord Akkrand
#2
Posted 06 August 2004 - 11:23 AM
You may, I'm not sure its just a crazy idea, be able to get the AI to choose its target again though. Try the following scripts:
***IF***
<any if condition here to check if this players target acquisition is not effective>
***THEN***
Player <This Player> considers <This Player's Enemy> to be Neutral (or friend)
Set timer <timername> to expire in 0.01 seconds
***IF***
Timer '<timername>' has expired
***THEN***
Player <This Player> considers <Local Player> to be Enemy
so that you somehow force the internal AI engine to check its enemies again. The chance for this to work is very unprobable, unfortunately, but I suppose you get my idea.
Edited by Mithril, 06 August 2004 - 11:24 AM.
#3
Posted 17 August 2004 - 11:44 PM
Also, there is no script condition to check whether a player is an enemy!
Thing is, I want the computer to pick one enemy out of multiple enemies to be *the* enemy the computer focuses on; setting the current enemy to neutral may cause problems...
I dunno... I'll mull it over some more...
Also, got another idea for a cool little script series;
Detects the enemy has auroras.
One raptor/mig circles above base, or moves back and forth between base and combat zone, does not attack.
Detects aurora entering base perimeter.
When aurora leaves base perimeter, sets priority of auroras to 5000, hunts for 5 seconds, then goes back to circling (doesn't want to follow all the way back to enemy base, will get shot down).
If it detects you don't/no longer have auroras, hunts normally.
The idea being that the raptor does not attack until the aurora has dropped its bomb and is heading home - once it becomes vunerable. It's useless telling a raptor to guard the outer perimeter against an aurora, it shoots all its missiles whilst the aurora is supersonic, all miss. But if it waits... ...and bides it's time...
I've started work on this and have got to test it properly, it seems hard to get the raptor to not attack, but I don't want it waiting on the airfield, then it takes too much time to takeoff, it never catches up....
BTW anyone got any ideas for little things like this that I could try to work out? I'm getting a little bored with nothing exciting to work on, every now and again I gather enough energy to update another general with some of the scripts I've written, but I enjoy working them out more than exporting/importing them into each gen, especially if they require a lot of faction specific stuff...
Ever since I found that I could assign a string local variable to each team, the possibilities of things I could do skyrocketed, now I just need ideas...
Cheers,
Lord Akkrand
#4
Posted 18 August 2004 - 01:18 AM
Akkrand, if you are really that bored, you could assist me in creating an complete new AI Style for my russian Faction
#5
Posted 23 August 2004 - 01:57 PM
BTW anyone got any ideas for little things like this that I could try to work out? I'm getting a little bored with nothing exciting to work on, every now and again I gather enough energy to update another general with some of the scripts I've written, but I enjoy working them out more than exporting/importing them into each gen, especially if they require a lot of faction specific stuff...
Ever since I found that I could assign a string local variable to each team, the possibilities of things I could do skyrocketed, now I just need ideas...
Cheers,
Lord Akkrand
What do you mean with "assign a string local variable to each team" ? Sounds interesting...
Ideas... yes I certainly have some.
Commandbutton abilities like the dragon tank's fire wall, the terrorist's car hijack, the helix napalm bomb (hunt using commandbutton ability should work right), the rally point commandbutton (never thought of this eh? ), the chinook's combat drop, the tankhunter's TNT attack, the attack\move commandbutton, the missile defender's laser lock, the ambulance's clean toxin, the comanche's rocket pods, the rebel's booby trap and finally the toxin truck's contamination are all, as far as I can remember, unused.
You could also try to implement random rushes, e.g. different unit combinations OR, much more interesting, a factory rush! That means, you tell the AI to send a dozer\worker to the enemy's base and build a(-a) factory(ies) and\or base defence(s). The problem with that may be the dynamic placement of structures - however as I have recently observed, the original ZH AI did this - the demo gen I think places demo traps next to oil derricks. You may want to look into this
Another, more theoretical tactic (just thought of this) would be to make a list of your teams and their special actions. Then you can take the data from the list and tell the AI to act accordingly. For example, consider this scenario:
1. The AI builds 2 teams .
2. One of those teams gets stuck somewhere in the map, unable to move anymore. You therefore record this data in the list (by giving the team a time counter script in its "On Idle" state, thus when its been idle for some minutes you can add 1 to a counter named.. say.. "MyTeamsAreDumb")
3. The second team attacks and is destroyed in the combat zone - giving you data about the presence of the enemy in the combat zone.
4. Now you use the gathered data to tell the stuck, dumb team to move to a different location or follow a different path, while for the second data you can increase the scripted build priority for a combat zone guard team.
Get my point? You can gather data from a list of experienced situations - and learn from that data. This is special case only - normal cases such as the destruction of the enemy's base will not increase the effectiveness - there isn't much to learn from victory.
If you expand upon this a good bit further, you will eventually end up with having specified many situations and combined with your splendidly developed dynamic attack paths system this should get us a big step closer towards perfectly dynamic teams of the type that humans would use them!
Effective players have dynamic tactics. If we want an AI to be a good opponent we need to develop a dynamic system as best as we can with the limitations given to us (3 waypoints ..argh).
Another dynamic system would be the recording of fired superweapons and the rate at which the player rebuilds. In other words, we record the effectiveness of our superweapons and adjust them accordingly - strike at different targets not just at the "player's highest cost area".
When LotR:BFME is out, I'll see about its AI. I'm sure there will be little support and many players that want a better AI. The SDI (currently consisting only of me and thudo, while thudo is often busy and msakdillz has vanished) will quite possibly organize a big, centralized scripting endeavour - with both novice and advanced scripters. Currently there are so many small AI's about - each with its own very effective strategies. Merging them all would create quite a ferocious bear!
Edited by Mithril, 23 August 2004 - 02:15 PM.
#6
Posted 24 August 2004 - 10:51 PM
I posted a long reply to this, going over each of your suggestions, but it was lost when the server went down yesterday morning...
In short, I think there's a lot of very useful ideas there, I'm going to have a look at a few of them, see what I can do.
Regarding the 'local team variable', in Scripting->Misc-> you can set the team state, to any string you like. This string can be tested as a condition in Team->State->is/is not. A lot of things can be done once a team is treated as a simple state machine. For example, I use this on my bombtrucks now, and I used it with the anti-aurora guards.
Can't be bothered posting much more atm; gotta start copy-and-pasting my posts here so I don't lose them anymore, its getting annoying. :(
Cheers,
Lord Akkrand
#7
Posted 26 August 2004 - 12:25 AM
I've got scripts that, once a terrorist is created, he goes off hunting using the commandbutton, with a priority set that includes all the civilian cars/trucks/etc. No problem; the terrorist goes straight for the car, gets in, the car is owned by the player. Also, if there are no civilian cars on the map, and hence the terrorist does not hunt, he goes idle, that sets off his idle script, which reduces his priority, and sets him off to attack on foot... so if there are no cars to take, the ai will not build as many of the terrorists.
The problem I've run into is that once the terrorist hijacks the car, he ceases to exist, his team has no units anymore (at least that's what the condition say), and his scripts no longer run... he is not idle, he has no state, nothing works. For all intensive purposes, the team ceases to exist. Also I found that none of the obvious status flags - IMMOBILE, IS_CARBOMB, HIJACKED, IS_FIRING_WEAPON went active before or after he hijacks the car.
So I'm left with no team, and a carbomb that is not attached to any team. It does not join a team when I use the
action, obviously it does not count as a captured unit because it was a civilian unit initially, not a faction unit.Player '<This Player>' creates a new Team 'Carbombs' from units it has captured. (There's nothing quite like being assaulted by your own captured units!)
The one thing I haven't tested, and am loathe to, is using the Player->Hunt->set all of a players units to hunt, as this would require setting a flag, say 'CARBOMBHUNT' to true for a frame, and having a script that would need to be in every team, that when CARBOMBHUNT goes true, it goes back to doing whatever it was is should be doing. That would be tedious in the extreme I should think. :(
This is another time when I've run into the situation of the object status flags not working as I imagine they should - IS_USING_ABILITY/IS_FIRING_WEAPON one of these flags should go true right before the terrorist jacks the vehicle, but even if they did, I lose control of the team anyway.... most frustrating.
Any ideas on a way around this, or am I going to have to test the Player->Hunt option?
Also I'm going to start looking at making the China Tank Hunters use the TNT, but only every couple of seconds - and only for a few frames - so it doesn't interfere with their normal attacks; there's no point using TNT exclusively, their long range attack is much better in most circumstances - if I can somehow identify that they are about to get run over, though, that would be perfect... If only I could have a condition like
"IF closest enemy unit of KindOf 'Vehicle' is Less Than or Equal to X feet away"...
Will try without it though
EDIT: Also, I've noticed in the debugger that the players are referred to as both 'playerX' and by 'teamWhateverX' where X is not the same, typically with 'playerX' the 'X' is from 0-7, whereas 'teamWhateverX' seems related to the location of the player on startup... can I access a player directly, like 'player1' in Skirmish, or is this not possible?
Cheers,
Lord Akkrand
Edited by Akkrand, 26 August 2004 - 01:05 AM.
#8
Posted 26 August 2004 - 01:44 AM
Save the environment, use green text
Some Bullshit Somewhere
#9
Posted 26 August 2004 - 06:43 PM
Yes its much more effective on buildings or as a last resort to deal a bit of extra damage - have you tried using the NO_COLLISIONS object flag? I know, object flags are evil (for reasons unknown to apparently everyone) but this is the first obvious thing. You'd have to put the script action in the "Actions if FALSE" tab, obviously
You may be able to do this with an INI modification but it won't be worth it - it may present other problems.
Other than that, damn WB seems to be ambitious to present its limitations again. Let's hope that will change in BFME..
About the carbomb thing:
It won't only be tedious in the extreme but expensive in CPU power too.. setting all the units to hunt will result in.. a lot of pathfinding calculation and similar things. Hmm.. however, setting the player's units to hunt won't be THAT expensive in this case because
a) the player does not possess many attacking units at this stage
b) this won't be done very often, as there is only a limited number of cars to hijack
I have a crazy idea. Not often, but sometimes crazy ideas work. What if you use the "[Player][Transfer]Transfer assets from one player to another player" script to transfer units from <This Player> to <This Player> ? Sounds crazy, it is. But maybe this "reminds" the player that the captured cars are his property.. After it has realized that you may be able to create a team from the captured units. Low chance of success but at least something..
Also, I've noticed in the debugger that the players are referred to as both 'playerX' and by 'teamWhateverX' where X is not the same, typically with 'playerX' the 'X' is from 0-7, whereas 'teamWhateverX' seems related to the location of the player on startup... can I access a player directly, like 'player1' in Skirmish, or is this not possible?
Without looking at it in detail I would say this looks like it is possible because WB is for both single player and skirmish scripting. You can try.. if I remember correctly I tried something like this before and it didn't work in skirmish - to my knowledge the AI engine has to create instances of players from pre entered data - the name and position of starting position waypoints for example, with which to compute the placement and therefore the instances - such a relativity would not allow a direct access, as far as I can tell. But please try and report back
Edited by Mithril, 26 August 2004 - 06:45 PM.
#10
Posted 27 August 2004 - 12:19 AM
In any case, my idea was to set all units to hunt, then a frame later, correct this for every other team, so it would only be a moment of lag, and yes, it would only be every few minutes. :0
Put in some stuff to test the playerX stuff, also had to add the commandbuttonhunt thing to Tank Hunters, also noticed they've got it listed in the ini as a special ability, so I've also got them using the ability on the nearest enemy object with KindOf VEHICLE, its doing both so one should work. I played and my scripts didn't noticably reduce their range firing ability, maybe I can tweak it back from 15 frames to 10...
Also added in that transfer of assets action in a script that identifies that you've got carbombs.
Cheers,
Lord Akkrand
#11
Posted 27 August 2004 - 04:04 PM
Dunno, just a random crazy idea
#12
Posted 27 August 2004 - 05:55 PM
BTW Akkrand I see you have a new version of yer AI on your site.. I'll put it up when I get the chance
EDIT: Now that I think about it.. I think people would like to know more about the changes in the new version..uhmm...which one of your new listed features are in 1.15 ?
Edited by Mithril, 27 August 2004 - 07:22 PM.
#13
Posted 29 August 2004 - 11:53 PM
Mithril, I'm not sure I can really tell you what 1.15 has... 'cos I don't remember I'm pretty sure its got the latest Dynamic Paths on Vanilla USA & Demo Gen. It might have the anti-aurora guards for all usa & china factions, but I can't be sure. USA gens target commanches and chinooks now, as a friend of mine found to his dismay, and all generals have the blitz attack scripts I mentioned in another post. I reckon that might be all... Oh and there may be some of my target acqusition stuff, but I don't think it works :(, at least it doesn't cause problems.
EDIT: Just to clarify why I don't know; I pretty much work on this every day, a little bit here, a little bit there, while I am at work. Sometimes I do large changes, but they mostly happen at home (like the Dynamic Paths). So some of the changes I make are a direct reflection of what happens in the 4v4 game after work: If attack after attack is repelled by commanches, I tell raptors/migs to target them, if I notice my workmates sending their chinooks to supply docks far from their base, I make sure that chinooks are in the priorities as well, so they get shot down, etc. But by and large, the changes are small and often forgotten - or plain don't work. Maybe when my contract ends and I get some free time, I'll go over one gen a lot, and code him from the start. But only being able to do a little each day makes that impossible, as then after the first day, my new project would be a gen dead in the water, as he wouldn't be a tenth finished.
Cheers,
Lord Akkrand
Edited by Akkrand, 30 August 2004 - 12:18 AM.
#14
Posted 30 August 2004 - 07:34 AM
If it doesnt work I guess youll have to make a team for each type of car, at least the ones you see in common maps which should be a lot less!
By the By building outside base/resource areas works by sending a dummy team that can have the AI build something at its location. Coupled with an invisible, AI only unit spawned in the skirmishscripts.scb file that can move very fast, possibilities for building bases all over the place, black market randomization, aggressive tunnel networking and tech building protection all seem too easy...
now try to get the workers across twilight flame in time to rush them
#15
Posted 30 August 2004 - 08:28 AM
Build a team <Carbomb Team 1> where Carbomb Team 1 is the name of the first of the 10 teams. I figured it'd force it to create the team, even if it was empty. Then it would autoreinforce with some of the carbombs lying around. We'll see.
What's this AI only-invisible-fast unit? I want one!
I knew how the AI built the teams out there, if I am going to use that somehow, I want to have it move the dozer/worker out there before it queues it, otherwise its a piece of 1 health scaffold waiting to get killed and cost you money.
If you want your worker across a map, make a team with a technical and a worker loaded into it (once someone posts a complete "how-to-load-a-transport"), move it to X position, unload the transport, disband the team. Voila! A worker across the map. You could even tell the script that builds <whatever> to run exactly 1 frame after the team disbands, using a timer. Then you increase the chances that its that worker that builds the <whatever>... hehe would be a waste if another worker, back at base, calls out "Yep! I'll do it, be right there!" then walks.
Cheers,
Lord Akkrand
#16
Posted 30 August 2004 - 08:34 AM
ill just use a dozer as that team, however im not 100% on its behaviour when the dozer team has scripts running it, even if i disband it, will the AI be stupid and send a dozer from base (since it started constructions while the dozer was still under orders?)
gotta try all that out when i do GLA, for now ill just try and make some combat chinooks/humvees/combat drops/flying ambulances!
good luck with the car issue!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users