Posted by: Rusty - Thursday, June 14, 2012 6:46:13 AM
I've tried to search for this via google, but I'm picking up a lot of dud results (references to maps and levels built rather than any scripting explanations). I'm curious about how I would set up a script condition so the AI can check how much money it's got. I notice it's can check the player's income (but I assume that's the human player... unless it means the player using the script...), but I can't find anything for the AI itself? The reason I ask is completely different tactics apply depending on it's starting resources, and this is a level where supply docks won't be available as it's a capture map. It's possible for a base to be self-sufficient from it's starting resources - but how fast the base can be built depends on it's available money.

Posted by: i^love^mixery - Thursday, June 14, 2012 8:26:48 AM
[code]*** IF *** 0 is Less Than the number of credits possessed by Player ''[/code] is what you need when scripting the AI. if you are scripting SkirmishGLA and you put a script with into the script folder for SkirmishGLA then all skirmishGLA comps with use this script set and will refer to the SkirmishGLA comps itself.

Posted by: Rusty - Thursday, June 14, 2012 12:16:02 PM
Okay, I set the condition at 5000 etc. Although I'm having trouble getting the intended behaviour: 1) How do I permanently disable the script, say, after a space of 2-3 seconds has passed? (So it doesn't run any of the other scripts during mid-game). Is there an 'and not' or similar feature for the conditions? 2) Presently, the script has a list of buildings the AI is expected to build in a specific order (reactor, dozer, supply centre, airfield, strategy centre, supply drop), however on constructing the reactor, the dozer just sits there and nothing happens (note the script doesn't yet spawn a dozer, so it should just build the supply centre). Why is this occurring, and how to I prevent it? 3) I attempted to find a way to make the AI build units, but I can only find either 'build' for buildings, or 'spawn' - which seems like it would just make the units magically appear at a waypoint (I tried it and it seemed to crash the map). What command do I use to get it to build units legitimately? 4) How can I get it to build units (rather than buildings) and set them to a specific place? IE a comanche that hovers in a particular spot?

Posted by: DecliningAtom52 - Thursday, June 14, 2012 1:51:42 PM
Hi 1) This is way too complicated and unneccesary, but you would need two scripts, one to set a timer to 2 seconds, and one to detect when the timer expired, and use the action Disable Script. 2) Are you using the Skirmish Only > Build a building? If so this does not work in Single Player maps, you need to click the icon in the control bar (at the top) which says BUILD LIST. This will allow you to place buildings. If you are doing this already, make sure the AI has enough cash to continue building. You may also have set to build buildings of a different faction, eg Air force dozer trying to build Lazer turret. You should also note that Build List is fairly unreliable for building in the order you set, the AI will try to build a structure every 0.5 seconds, so it will just spam reactors until the next level of the tech tree is completed. 3) Click the icon next to scripts (three little people) choose your AI player on the left click 'Add New Team'. Choose how many units you wish to train and what you wish to train in the main section, you will need to create a script which has the Subroutine ticked and the Disable on completion not checked. If this condition is true, the team will be built. 4) In the team menu, set home position to a waypoint. If you need more help just say.

Posted by: Rusty - Thursday, June 14, 2012 4:12:47 PM
1) I've found an alternative (if one of the four scripts runs, it disables the others). 2) Yeah, it's skirmish mode, and I'm using the build a building option. The dozer builds either one reactor (if the start-up reactor script is enabled), or numerous reactors (if the low power (?) script is enabled), but it doesn't build a supply centre or similar - although I've checked the conditions. I wasn't aware of a build list. 2.1) The conditions (for building a supply center) are: SkirmishAmerica has Greater Than or Equal To 1 unit or structure with kind is 'FS_POWER' in the area [Skirmish]MyInnerPerimeter SkirmishAmerica has Less Than or Equal To 1 unit or structure with kind is 'FS_SUPPLY_CENTER' in the area [Skirmish]MyInnerPerimeter 1200 is Less Than the number of credits possessed by Player 'SkirmishAmerica' Both spots have an InnerPerimter (InnerPerimeter1, InnerPerimeter2). So I can't suss why it wouldn't build anything (I included a supply dock in-case that was the reason why). 3) I added a dozer team, which it then created. The dozer didn't do anything, so I assume that is where the sub-routine thing is used? 4) That works. 5) I'm having issues with the viewing area of the map. Although I modified the boundary which shows practically all of the map, there seems to be a dark outer layer that can't be seen (although units can travel on it and units can build on it), as if it was out of bounds. How do I fix that? Modifying the boundary has no noticeable effect.

Posted by: DecliningAtom52 - Thursday, June 14, 2012 4:44:55 PM
Ok, if your using skirmish mode then thats fine, ignore the build list. In skirmish mode you cannot use 'Build a build of type: AmericaSupplyCenter' you must goto Player > AI > Build 'AmericaSupplyCenter' near a supply src with at least:(10000 is a good number). You should also do this for building defences near the supply. The second dozer you made requires no extra scripts, the dozer will do something when there is work for it to do. I also think that the skirmish AI automatically handles building extra power plants if power is low, but leave it there for now. Why don't you use the script Map > Shroud or Reveal > Reveal the world permanantly for player: SkirmishGLA (or any others), instead of using borders.

Posted by: Rusty - Thursday, June 14, 2012 4:59:51 PM
I just want it to build a supply centre. It doesn't need to be near a specific source because it's possible for a base to turn self-sufficient (even if relatively defenceless) with 10,000 credits. I'm basically trying to form an economic powerhouse AI (that builds supply drops) - in short, it echoes my style. I'll try the other way of building a supply center though.

Posted by: DecliningAtom52 - Thursday, June 14, 2012 5:02:31 PM
[quote=Rusty;124705]I just want it to build a supply centre. It doesn't need to be near a specific source because it's possible for a base to turn self-sufficient (even if relatively defenceless) with 10,000 credits. I'm basically trying to form an economic powerhouse AI (that builds supply drops) - in short, it echoes my style. I'll try the other way of building a supply center though.[/quote] If you want the computer to build the supply center inside the base, you will need to use an INI file to modify the build position of Supply Centers, I could send you an INI file to do this, but only if you need it.

Posted by: Rusty - Thursday, June 14, 2012 5:08:19 PM
[quote=DecliningAtom52;124706]If you want the computer to build the supply center inside the base, you will need to use an INI file to modify the build position of Supply Centers, I could send you an INI file to do this, but only if you need it.[/quote] That's more the sort of thing I'm after. Your suggestion with the near a supply source worked - but now the dozer just keeps building a supply center (I added in an audio effect to the script - and the audio is silent after it starts building the first supply center... so I don't know why it keeps building other supply centers). Argh... this AI has a mind of it's own!

Posted by: DecliningAtom52 - Thursday, June 14, 2012 5:13:03 PM
Ok, I'll upload an INI file tommorrow (sorry), in the meantime you could use Build of type "AmericaSupplyCenter" on the flank, make sure that Deactivate on Success is ticked on the build Supply Center Script.

Posted by: Rusty - Thursday, June 14, 2012 5:26:22 PM
[quote=DecliningAtom52;124708]Ok, I'll upload an INI file tommorrow (sorry), in the meantime you could use Build of type "AmericaSupplyCenter" on the flank, make sure that Deactivate on Success is ticked on the build Supply Center Script.[/quote] Don't worry, take your time! You've helped me get this far, and I think I understand how the scripting works - it seems to 'backlog' the scripts. If I enable 'deactivate on success', can the script then be re-enabled using the enable script command, or does it only run the once? Edit: I'd also ask: how do you create a flag? This would help solve a lot of the problems.

Posted by: i^love^mixery - Thursday, June 14, 2012 6:45:01 PM
Scripting -> Flags -> Create [code]*** IF *** True. *** THEN *** Set Flag named 'Flag001' to FALSE [/code] as simple as that. you dont have to initialize them or anything. i also have noticed the AI to build as it sees fit regardless of my script orders. it seems to be buggy.

Posted by: Rusty - Thursday, June 14, 2012 11:59:34 PM
[quote=i^love^mixery;124712]i also have noticed the AI to build as it sees fit regardless of my script orders. it seems to be buggy.[/quote] I've noticed the AI is acting as if the build orders are more 'suggestions' - although I've managed to successfully get it to build the intended base in close enough the right order (reactor, supply center, airfield, strategy center, supply drop, additional reactors). Noted bugs though include: unwanted additional supply choppers, refusal to build additional reactors despite insufficient power supply script (and insufficient power - preventing the other scripts kicking in), dozer teams working in serial (rather than parallel IE two dozers, one will often wait for the other despite being able to build), refusal to build firebases (which are permitted as they don't take power so power conditions don't apply), refusal to build supply center unless there is a supply dock (it's possible to survive without a dock with 10,000 or more - supply drops). Despite this, as a computer games programmer personally speaking, the system works counter-intuitively - if I destroy a building, rather than the AI not doing anything (which it should - as I haven't set up any events for it), it attempts to rebuild the lost building as if it remembers where it is. Given I've not set anything to enable this and it's implicit, I find to be surprising. Individuals might argue that replacing any building is the correct course of action, but if I lose a reactor in my base, I often upgrade the non-upgraded (I always have a few un-upgraded for this purpose) reactors instead to compensate - so the dozers can repair other structures first (unless it's low power, then building a reactor is faster than an upgrade). Actually, I find a lot of it's behaviour is surprising. For example, if it builds a supply center, it will automatically assign additional choppers (regardless as to whether or not the supply source is valid for it, IE has sufficient funds to validate purchase), but if it builds anything else, it doesn't build any other additional units unless commanded to do so. This is terribly inconsistent behaviour. Either the AI should be fuzzy in it's interpretation of all things, or literal - but not both (as you lose the advantages of either) - better yet, there should be an option for literal versus fuzzy commands (enable fuzzy interpretation... or something). I want to build an economic powerhouse AI so I actually have a challenge. But at the moment it's proving difficult.

Posted by: DecliningAtom52 - Friday, June 15, 2012 2:52:39 AM
Haven't got round to the ini file yet, but the file can also solve the too many choppers issue, I am currently building a boss general AI, and I would agree that skirmish ai is hard to script, the ai moves buildings so that the base fits within the InnerPerimeter. But I don't know why your dozers refuse to work in paralell, would you be able to PM an .scb of your skirmish scripts? (I won't steal)

Posted by: DecliningAtom52 - Friday, June 15, 2012 11:42:11 AM
Here is the INI (I don't know if it could be smaller) Paste this into a file called map.ini in the map folder (My Documents/Cnc Generals Zero Hour Data/Maps/MyMap/map.ini [quote]AIData StructureSeconds = 0.0 ; Ai tries to build a new structure every N seconds. TeamSeconds = 10 ;Ai tries to build a new team every N seconds. Wealthy = 7000 ; Number of resources for the AI to consider itself wealthy Poor = 2000 ; Number of resources for the AI to consider itself poor StructuresWealthyRate = 2.0 ; (2=twice as fast) Rate modifier for structure building when wealthy. StructuresPoorRate = 0.6 ; (0.5=half as fast) Rate modifier for structures when poor. TeamsWealthyRate = 2.0 ; (2=twice as fast) Rate modifier for teams building when wealthy. TeamsPoorRate = 0.6 ; (0.5=half as fast) Rate modifier for teams when poor. TeamResourcesToStart = 0.1 ; (1.0=100%) Amount of resources required to start building a team. GuardInnerModifierAI = 1.1 ;The radius modifier to vision which a guarding (AI Controlled) unit will agressively attack GuardOuterModifierAI = 1.333 ;The radius modifier to vision which a guarding (AI Controlled) unit will chase after GuardInnerModifierHuman = 1.8 ;1.1 ;The radius modifier to vision which a guarding (Human Controlled) unit will agressively attack GuardOuterModifierHuman = 2.2 ;1.333 ;The radius modifier to vision which a guarding (Human Controlled) unit will chase after GuardChaseUnitsDuration = 10000 ;The number of msec for which a guarding unit will chase attackers before giving up GuardEnemyScanRate = 500 ; when actively guarding, how often to scan for enemies (msec) GuardEnemyReturnScanRate = 1000 ; when returning to "active" guarding (from pursuing someone), how often to scan for enemies (msec) AlertRangeModifier = 1.1 ;The adjustment applied when a unit is alert and doing various scans for enemies (AI units only) AggressiveRangeModifier = 1.5 ;The adjustment applied when a unit is aggressive and doing various scans for enemies (AI units only) AttackPriorityDistanceModifier = 100.0 ;The distance required to reduce attack priority by 1. MaxRecruitRadius = 500.0 ;The maximum distance a unit will be from a unit that recruits it. SkirmishBaseDefenseExtraDistance = 150.0 ; Instead of placing base defenses on the template edge, bump it this much farther out ForceIdleMSEC = 67 ;The number of milisec a unit must be idle before looking for an enemy, 2 frames. ForceSkirmishAI = No ; Use skirmish instead of solo ai. For development till the skirmish ui is finished. jba. RotateSkirmishBases = No ; If yes, rotate base layout so same side of base faces center of map. AttackUsesLineOfSight = Yes ; If yes, attack for ALL UNITS (player and ai) uses line of sight. EnableRepulsors = Yes ; If yes, KINDOF_CAN_BE_REPULSED will run from enemies & repulsors. RepulsedDistance = 150.0 ; How far beyond vision range a repulsed civilian will run before stopping. ; so if vision range is 120.0, he will move to a point at least 270.0 away from the enemy, and then stop running. WallHeight = 43 ; Height of the "Wall", made of KIND WALK_ON_TOP pieces. AttackIgnoreInsignificantBuildings = Yes ; If yes, units will ignore enemy-owned buildings that are not faction buildings ; SkirmishGroupFudgeDistance is the distance that is multiplied by the number of units in a group to ; determine if they are close enough to the waypoint to consider themselves AT the waypoint. This is ; only used for "Follow Waypoint Path as a Team." SkirmishGroupFudgeDistance = 5.0 ; Group pathfinding parameters. MinInfantryForGroup = 3 ; Have to have 3 infantry to do group movement. MinVehiclesForGroup = 3 ; Have to have 3 vehicles to do group movement. MinDistanceForGroup = 100.0 ; Have to be moving at least this far for group movement. DistanceRequiresGroup = 500.0 ; Force group movement if moving at least this far. ; Note that these group pathfind parameters are inter-related, and modifying them may produce really ; ugly results & require code changes. jba. InfantryPathfindDiameter = 6 ; Number of pathfind cells wide group path is for infantry. VehiclePathfindDiameter = 6 ; Number of pathfind cells wide group path is for vehicles. SupplyCenterSafeRadius = 300.0 ; Radius to scan for enemies to determine if a supply center is safe. RebuildDelayTimeSeconds = 30 ; Delay this many seconds when a base building is destroyed or captured before attempting rebuild. AIDozerBoredRadiusModifier = 2.0 ; Multiplier to dozer scan radius for repair & mine clearing. 2.0 means ai uses twice the radius as human dozers. AICrushesInfantry = Yes ; If yes, ai will attempt to crush infantry with vehicles. ; Retaliation parameters. MaxRetaliationDistance = 200.0 ; If the attacker is more than this far away, won't chase. Keeps from chasing artillery. RetaliationFriendsRadius = 120.0 ; Retaliator gathers allies within this distance & attacks. SideInfo America ResourceGatherersEasy = 1 ResourceGatherersNormal = 1 ResourceGatherersHard = 1 BaseDefenseStructure1 = AmericaPatriotBattery SkillSet1 Science = SCIENCE_PaladinTank Science = SCIENCE_StealthFighter Science = SCIENCE_A10ThunderboltMissileStrike1 Science = SCIENCE_A10ThunderboltMissileStrike2 Science = SCIENCE_A10ThunderboltMissileStrike3 Science = SCIENCE_SpectreGunshipSolo Science = SCIENCE_DaisyCutter End SkillSet2 Science = SCIENCE_PaladinTank Science = SCIENCE_StealthFighter Science = SCIENCE_Pathfinder Science = SCIENCE_Paradrop1 Science = SCIENCE_Paradrop2 Science = SCIENCE_Paradrop3 Science = SCIENCE_DaisyCutter End End ;Skirmish AI Build List SkirmishBuildList America Structure AmericaCommandCenter Location = X:501.22 Y:546.25 Rebuilds = 0 Angle = -135.00 InitiallyBuilt = No AutomaticallyBuild = Yes END ;Structure AmericaCommandCenter Structure AmericaPowerPlant Location = X:770.43 Y:727.79 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPowerPlant Structure AmericaPowerPlant Location = X:759.90 Y:555.84 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPowerPlant Structure AmericaPowerPlant Location = X:374.82 Y:371.69 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPowerPlant Structure AmericaPowerPlant Location = X:477.11 Y:174.62 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPowerPlant Structure AmericaPowerPlant Location = X:189.19 Y:522.00 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaSupplyCenter Structure AmericaPowerPlant Location = X:418.35 Y:827.10 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPowerPlant Structure AmericaAirfield Location = X:767.04 Y:376.40 Rebuilds = 0 Angle = -135.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaAirfield Structure AmericaBarracks Location = X:247.52 Y:734.59 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaBarracks Structure AmericaParticleCannonUplink Location = X:594.59 Y:635.72 Rebuilds = 0 Angle = -45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaParticleCannonUplink Structure AmericaStrategyCenter Location = X:384.36 Y:652.24 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaStrategyCenter Structure AmericaSupplyDropZone Location = X:515.66 Y:347.88 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaSupplyDropZone Structure AmericaSupplyDropZone Location = X:637.41 Y:490.20 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaSupplyDropZone Structure AmericaSupplyDropZone Location = X:488.83 Y:760.27 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaSupplyDropZone Structure AmericaSupplyDropZone Location = X:322.39 Y:502.03 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaSupplyDropZone Structure AmericaWarFactory Location = X:650.93 Y:843.45 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaWarFactory Structure AmericaWarFactory Location = X:259.56 Y:289.71 Rebuilds = 0 Angle = -135.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaWarFactory Structure AmericaPatriotBattery Location = X:676.07 Y:670.51 Rebuilds = 0 Angle = 45.00 InitiallyBuilt = No AutomaticallyBuild = No END ;Structure AmericaPatriotBattery END ;SkirmishBuildList FactionAmerica End [/quote]

Posted by: i^love^mixery - Friday, June 15, 2012 6:37:49 PM
[quote=Rusty;124714]This is terribly inconsistent behaviour. Either the AI should be fuzzy in it's interpretation of all things, or literal - but not both (as you lose the advantages of either) - better yet, there should be an option for literal versus fuzzy commands (enable fuzzy interpretation... or something). I want to build an economic powerhouse AI so I actually have a challenge. But at the moment it's proving difficult.[/quote] thats exactly what i am thinking too. you are just better in finding the correct words than me[grin] and thats exactly the reason why i have given up on scripting my own AI. all i tried was to make a AI use humvee rush tactic. i got it to work but it was such a "slapped together" thing that i gave up really fast. the chinook thing annoyed my also because the AI always built 2 additional chinooks AUTOMATICALLY yet 1 additional chinook is really all you need. also i couldnt tell him to sell his command center for a very "pro-like" rush properly..

Posted by: DecliningAtom52 - Saturday, June 16, 2012 3:59:16 AM
@i^love^mixery: You can use the ini file above to create only one extra chinook, If you wanted to sell your command center at the beginning, you could use Team Uses Command Button , however you may need to delay the building of the first building for a frame.

Posted by: i^love^mixery - Saturday, June 16, 2012 8:20:32 AM
i know that too but the comp automatically sold his power plant after it was finished too when i told him to sell everything. so i had to wait until 2nd dozer was built, then sell command center, then start building 1st power plant. and that took far too long.

Posted by: Rusty - Saturday, June 16, 2012 10:13:17 PM
[quote=DecliningAtom52;124715]Haven't got round to the ini file yet, but the file can also solve the too many choppers issue, I am currently building a boss general AI, and I would agree that skirmish ai is hard to script, the ai moves buildings so that the base fits within the InnerPerimeter. But I don't know why your dozers refuse to work in paralell, would you be able to PM an .scb of your skirmish scripts? (I won't steal)[/quote] Don't worry about using anything I give you, I consider all work I do open use (with the exception of commercial usage). I think I know why - initial start-up buildings can't be built before others, and often only one can be built before another (so it can only work in series between the dozers). The newest issue is it reaches an in-cap of 4 supply drops before it stops building them (it can only stop building them temporarily when there's too little money, or if it exceeds 100000) - even when a supply of money is apparent. I would give it more space but I'm afraid it might build the supply drops in stupid places, like half-way across the map or something. I just want to build an AI that mimicks my tactics (but does it better than I can) so it can challenge me to invent new tactics - I'm a turtle defender who uses economic roll-over to mass produce super-weapons and depending on the general, ground units. I want an AI that will just continuously spam defences, supply drops, reactors and super-weapons pretty much everywhere.

Posted by: Rusty - Saturday, June 16, 2012 10:25:21 PM
[quote=DecliningAtom52;124718]Here is the INI (I don't know if it could be smaller) Paste this into a file called map.ini in the map folder (My Documents/Cnc Generals Zero Hour Data/Maps/MyMap/map.ini[/quote] Does map.ini have to be renamed to be the same name as the map? For example, mine is called 'City.map', so would the .ini be renamed to City.ini? Could you explain to me how the .ini works? I vaguely remember something about .ini files (I am sure I've done something like this before in a deja vu esque feeling but... I don't think I've done AI programming for generals before...). If I 'recall' correctly, the X and Y co-ordinates are relative to the command center? Angle is obviously which direction it faces when built. Rebuilds, if 0, is infinite rebuilds, correct? Or does that mean it doesn't attempt to rebuild it? Would it be possible for me to specify numerous supply drops etc next to each other using this?

Posted by: Rusty - Saturday, June 16, 2012 10:46:31 PM
[quote=i^love^mixery;124720]and thats exactly the reason why i have given up on scripting my own AI. all i tried was to make a AI use humvee rush tactic. i got it to work but it was such a "slapped together" thing that i gave up really fast. the chinook thing annoyed my also because the AI always built 2 additional chinooks AUTOMATICALLY yet 1 additional chinook is really all you need. also i couldnt tell him to sell his command center for a very "pro-like" rush properly..[/quote] Whilst generals was a quirky game (I like some of the ideas implemented), it seemed glichy overall and the AI left something to be desired - I know on the underlying level the AI are cheating too, but a single hard AI should be really difficult. Tiberium wars brutal AI was extreme (the fact it didn't harvest any tiberium and cheated disappointed me), but I don't think AI need to cheat in order to be better. Cheating says to me 'I'm too lazy to program a decent AI'. For example, I think the AI could easily be made to micro a lot better than a human being, and made to specialise in specific roles - for example, a rush AI versus a much slower economic roll-over AI, a large oversized army or super-weapon spam (both would make a player poop their pants, because, what AI do they prepare for?). For example, the stealth general, with a micro-ing AI, had lots of potential to cause havoc by literally and rapidly filling the entire map with invisible traps. The demo general could easily cause havoc if his bomb trucks didn't queue in a straight line to the destination building (and get stuck behind one another), but instead spread out as a horde or disguised themselves (they should have really invented 'branching' where vehicles can split off onto an arbitary secondary path from the main one based on a pseudo random number). Or a general who tries to build everywhere. Or a general who works on building such a large and overwhelming rush horde (who can be disabled in-case of low end machines). Or one who builds super-weapons. The exception being the super-weapon general. Who would built 3-5 super weapons. But there'd be no difference in tactics. Instead all the AI did was built vaguely similar bases with vaguely similar goals (build one super-weapon, send continuous stream of cannon fodder). I built a buggy pac-man game in micro java in 2 days - the ghost AI had only simple rules (you can never go back the way you came unless it's a 'dead end' or blocked, you cannot head in the same direction as another ghost/cannot share the same space as one, and you must head towards pac-man) but the ghosts were so effective it actually looked like they were teamworking and the game was nearly impossible to complete (I had to slow down the ghosts and even then - they'd block all the exits and head towards me!).

Posted by: i^love^mixery - Saturday, June 16, 2012 11:35:20 PM
[quote=Rusty;124736]Instead all the AI did was built vaguely similar bases with vaguely similar goals (build one super-weapon, send continuous stream of cannon fodder)[/quote] thats because all they did was copy & paste, simple as that[grin] i totally agree with you that they could have done unique tactics for each general easily if they werent so lazy. and i too think that a properly programmed AI could beat human players simply because its able to react without latency. on 50k matches the stealth general could indeed fill the entire map with his demo traps faster than any human being. also its really disappointing that even if you give the computer players $500.000 they will NOT expand their bases once they reach the maximum default size. they will never build more than 4 war factories etc.. yea the AI scripts really totally suck if you take a deeper look at it. [quote=Rusty;124735]Does map.ini have to be renamed to be the same name as the map? For example, mine is called 'City.map', so would the .ini be renamed to City.ini? Could you explain to me how the .ini works? I vaguely remember something about .ini files (I am sure I've done something like this before in a deja vu esque feeling but... I don't think I've done AI programming for generals before...). If I 'recall' correctly, the X and Y co-ordinates are relative to the command center? Angle is obviously which direction it faces when built. Rebuilds, if 0, is infinite rebuilds, correct? Or does that mean it doesn't attempt to rebuild it? Would it be possible for me to specify numerous supply drops etc next to each other using this?[/quote] map.ini is the right name. i think -1 rebuilds = unlimited (i have no idea if thats right) about the other questions you will have to wait for somebody who knows .ini files better than me[grin]

Posted by: DecliningAtom52 - Sunday, June 17, 2012 3:54:57 PM
Yes the map file needs to be called map.ini, do not rename it to the name of the map, if you place an object Civillian > Structure > TempBuildingSize in the bottom right of the default (when you open world builder) this is the area and coordinates that things will be built in ( so it is relative to this object ). The parameters on the build list are ignored by the skirmish ai, the ai will always attempt to rebuild. If you wanted to create extra supply drops you can create (near) unlimited buildings, so go ahead, if you would prefer me to do this just say. The top section of the file is fairly self explainitory, the second decides what generals powers the ai selects, the third is the build list.

Posted by: Rusty - Sunday, June 17, 2012 6:47:55 PM
[quote=DecliningAtom52;124745]Yes the map file needs to be called map.ini, do not rename it to the name of the map, if you place an object Civillian > Structure > TempBuildingSize in the bottom right of the default (when you open world builder) this is the area and coordinates that things will be built in ( so it is relative to this object ). The parameters on the build list are ignored by the skirmish ai, the ai will always attempt to rebuild. If you wanted to create extra supply drops you can create (near) unlimited buildings, so go ahead, if you would prefer me to do this just say. The top section of the file is fairly self explainitory, the second decides what generals powers the ai selects, the third is the build list.[/quote] So for the TempBuildingSize, I place that in the bottom-right of my City map and the AI will place things relative to that, or inside the AI's base or...?

Posted by: BR-Alexandre - Monday, June 18, 2012 4:57:36 PM
[quote=Rusty;124736]I built a buggy pac-man game in micro java in 2 days - the ghost AI had only simple rules (you can never go back the way you came unless it's a 'dead end' or blocked, you cannot head in the same direction as another ghost/cannot share the same space as one, and you must head towards pac-man) but the ghosts were so effective it actually looked like they were teamworking and the game was nearly impossible to complete (I had to slow down the ghosts and even then - they'd block all the exits and head towards me!).[/quote] Nice, i always liked playing pac-man, that AI seems intersting [quote=rusty]So for the TempBuildingSize, I place that in the bottom-right of my City map and the AI will place things relative to that, or inside the AI's base or...? [/quote] I don't know much about this one but i think it orients an AI with new coordinates having (0,0) on object's center. [quote=i^love^mixery]i totally agree with you that they could have done unique tactics for each general easily if they werent so lazy. and i too think that a properly programmed AI could beat human players simply because its able to react without latency. on 50k matches the stealth general could indeed fill the entire map with his demo traps faster than any human being. also its really disappointing that even if you give the computer players $500.000 they will NOT expand their bases once they reach the maximum default size. they will never build more than 4 war factories etc.. yea the AI scripts really totally suck if you take a deeper look at it.[/quote] yeah they do same stuff all the time but isn't that easy to script the AIs here as each map have its own areas, paths, etc so you just can't make a virtually perfect enemy. With each map being different you also can't make it a micro, and not only because of the terrain, players consider a lot more "data" than we can program a computer to do. check TW3's brutal AI, on all levels, he steamroll you but, unlike generals, micro moving don't works as well as in generals. For now lets look foward to generals 2 and expect it to be more like its "father" but may have better AI. what this one needs is a tool that tells an AI unit to stay out of range of enemy units, pretty sure i saw one in ZH's china campaing, the one china will liberate a city by taking down GLA statues, each statue you remove trigger one rocket buggy that just fires at you but if any of your units get close to him, he retreats and fire again from distance. I made scripts for skirmish play, with an almost unbeatable AI as he likes "clicking" all buttons he see. I am too lazy to make a good AI (i admit) but made one different for each general but they do what the TW3 guys do, cheat money plus steamrolling army. Also added my own mark as the lazer general use F117s and target mainly artillery, a tactic i like using. If you want the challege i can upload it here. they mass armies but they still very dumb [quote=Rusty]For example, the stealth general, with a micro-ing AI, had lots of potential to cause havoc by literally and rapidly filling the entire map with invisible traps.[/quote] they'd need money, as they risk 200 for a worker and a bit more in a trap that will probably fail because of its location

Posted by: i^love^mixery - Monday, June 18, 2012 8:07:14 PM
[quote=Rusty;124746] So for the TempBuildingSize, I place that in the bottom-right of my City map and the AI will place things relative to that, or inside the AI's base or...?[/quote] as far as i know this thing doesnt do anything except showing you the recommended size for reach base. also you normally place it on top of each player startposition and then adjust the perimeters to it. and you delete it again when you are done with that. its just an orientation.. BR-Alexandre i think your AI scripts would be really interesting for Rusty. go ahead and post them![+1] it definitely was the best steamroll AI i have ever seen.

Posted by: Rusty - Tuesday, June 19, 2012 12:21:57 AM
[quote=BR-Alexandre;124756] yeah they do same stuff all the time but isn't that easy to script the AIs here as each map have its own areas, paths, etc so you just can't make a virtually perfect enemy. With each map being different you also can't make it a micro, and not only because of the terrain, players consider a lot more "data" than we can program a computer to do. check TW3's brutal AI, on all levels, he steamroll you but, unlike generals, micro moving don't works as well as in generals.[/quote] Whilst this might be the case, AIs that don't adapt to their map are non-heuristic (EG non-learning). In the pac-man game I built, because I was so short of time, the map actually consisted of a series of 'parts' (corners, corridors, T-junctions), which meant new levels could be quickly built - but the AI I wrote could still navigate new maps based on just those simple rules. Conventional pac-man AI uses a series of pre-programmed 'way-points' (with interconnecting lines), using a localised search algorithm to 'plot a course' to the human player. Whilst this algorithm would permit a ghost to find pac-man in short time by 'searching the paths', it meant that no alternate or new levels could be built without additional waypoints. In a sense, I traded efficiency (waypoint searching) for adaptability (simple ruleset to navigate the map). The only point my AI fell down on was the off-screen teleport (as it makes pac-man seems further) - but this would occur on a waypoint system too without more specific rules implemented. An additional rule here and there and it'd probably be able to tackle the teleport. My point is, it is possible to trade efficiency in an AI to get adaptability. Given generals is technically speaking a '2D' game in terms of movement (maybe a unit can travel up and down a ramp but that's part of the physics - units could in theory still be co-ordinated by X/Y), it would be possible for the AI to figure out how a map works. In-fact, I would implement the spherical rebound method (basically sonar detection) I was thinking of for light modelling. The AI 'transmits' an expanding circle from it's origin, which, if it finds a gap, it marks a 'point' between the two obstructing points, and repeats another circle from that point, through-out, rebounds until it has an interconnected self-built network towards every player's base. Sorry, going off on a tangent there. Smart AI can be built, people just have to see it from the AI's perspective.

Posted by: BR-Alexandre - Wednesday, June 20, 2012 3:55:49 PM
Here is the AI, you just have to import them to WB. they're hard so put them on easy if you're going to fight them. about AI adaptability, the game standard scripts are made to fight in almost any map, the problem is that you can't make it fight well as there is no "fire from outside enemy range" and situations demand different tactics, units and coordination. for example, i have a raptor and i see an enemy scorpion coming to my base, but near the scorpion there is a quad cannon -My options: --attack the scorpion ignoring the quad (suicide, unless the quad is busy) --attack the scorpion without being targeted by the quad (micro moving) -AI options: --do nothing --attack the scorpion --attack the quad (if you have 3 raptors and quad is not promoted...or you planes are...you kill it) problem: you can't set AI to check if the quad is busy neither set it to attack without getting in quad's range or detect their numbers/veterancy. your options are "attack: yes or no?" generals is almost 2D game, but you have to consider the air units so....3D [ATTACH]1120[/Attach]