• 0

    posted a message on Need help with stopping Melee AI expansions.

    My mod is intended to be for Campaigns but I am making use of both Melee and Campaign AI. The Melee AI is heavily "controlled" and manipulated to guide how it plays. Everything is done "programatically" through triggers and data, taking in only input from specific maps through the use of "template" starting triggers (the same way the actual Campaign does it) to modify aspects of how the modified Melee AI might operate.

     

    I'm a super noob but I've been managing so far by bumbling my way through things with trial and error. My problem is that I cannot figure out how to make the Melee AI stop expanding or not expand at a certain location. I also don't really understand how to make/force the AI to expand- but this isn't really an issue, at least at the moment. Though knowing how to would be helpful as well. Specifically, I want to do this "programmatically" in my mod and not on actual maps, which can then be modified later on the map if needed.

     

    My understanding of how towns and expansions work is very rough:

     

    There are towns, -1 and specifically 0 being main at start (and always at Starting Location point) but not necessarily the case throughout the game. The AI increments its towns by one each time it expands, unless a town is destroyed and considered permanently lost, in which it will re-use a town slot. The main town will be updated to another existing town if the main dropoff building (CC, Hatch, Nexus) and nearby production buildings are destroyed, especially if the main town resources are exhausted.

     

    With the default melee stock, all production buildings, regardless of location, belong to the main town unless it was instructed to build at a specific town. Expansions only contain the dropoff building, harvesters, and defensive buildings based on difficulty level of AI.

    The placement of town is not clear to me but I've gathered that towns must be within distance <= 8 of resources and the AI "knows" exactly how many expansions are possible at the start of the game. I don't know how it calculates it but it must be based on the above requirement and Starting Location points that are not used by any player.

     

    I know that there are cycles of activity, where APM spikes (>250% of average), coinciding with when the Melee Attack Wave is sent and probably at a certain point in the melee script stock, where the AI will attempt expansions. This is very evident in the beginning of the game at around 8 min in. I've isolated parts of the Galaxy script that determines whether it "wants" to expand but I don't know how to modify or manipulate it.

    The AI will always try to expand with a preference for "open" expansions without obstructions initially, even if it is at a strategically bad location, e.g., all the way on the other side of the map, near the enemy. If it cannot find any and there are obstructed expansions, then it uses the obstruction clearing wave to attack the obstruction.

     

    So far I figured out how to "block" an expansion by disabling building of the townhall unit or spawning a neutral townhall building off-map (off playable region), specifically a flying CC, instructing it to land at the best placement for a townhall at an expansion then pausing the unit so that it is "stuck". However, this still leaves me with the AI trying to expand, even if it will inevitably fails to expand at that location. Not exactly the most elegant solution.

     

    There exist 3 states for towns, "Claimed", "Building" and "Established" that towns are in and I suspect it is through these states that the Melee AI determines whether it will try to expand at a particular location. I know that "Building" state is active when the townhall unit is under construction or the worker unit is moving towards the expansion and "Established" is when a town is counted as owned by a player (which increments the "Next Town Slot" for that player). What I don't know is how the AI assesses these states in its decision making, specifically, how it determines whether a location is "Established" for another player- and whether it does this at all for another player.

     

    In my tests, an established town that is destroyed is still established until the AI drops it from its owned towns, and even if it still established by another player, i.e., an enemy player, the AI will sometimes still attempt to take it anyway.

     

    "Claimed" is what I suspect determines whether the AI considers a location taken by another player, possibly used towards friendly/neutral players, but I don't know how to retrieve the state value of a town when it isn't occupied by a player at all and how to manually set this state.

     

    The essence of the problem is that I have no idea how to make the AI just stop trying to expand, either at all, or after a certain point (after certain conditions are met) so it doesn't send Drones/Probes/SCVs repeatedly at an expansion. With the hacky blocking methods above, it will just keep doing this over and over again if it has selected an expansion and skip over all other possible expansion locations that are not blocked.

     

    This isn't desirable in a Campaign setting where I want an enemy or ally AI to not take over all the expansions that are meant for the player while retaining usage of the Melee AI's expansion logic at the very start so it tries to take 1-2 expansions for itself.

     

    Would appreciate any hints, advice or instruction on solving this problem.  Thankyou.

    Posted in: AI Development
  • 0

    posted a message on How to give AI Commands

    I'm working on something like this for my mod but I'm not close to implementing it yet. Still working on getting a solid AI framework set up first, but I think I have the solution to do this without messing with the galaxy script or anything hardcore. My idea is to just use the same method that the GlobalCaster and SOAGlobalCaster topbar calldowns do. At initialization, you spawn a hidden caster unit at the corner of a map or at some point outside Playable Map Region. The unit has abilities that will be shown in the command card when selected using simple UI button placed somewhere on the screen like how the AI Comm. works.

     

    The abilities on the unit will trigger an event calling whatever actions are necessary. Targeting will be pretty much accomplished the same way most of the calldowns are.

     

    The allied player will have a set of unit groups and variables set up for it when initialized at start or when first triggered and then you just work out the logic for which units to use, etc. At that point it is just a matter of issuing AI order/suggesting AI order and then disabling script control if you force it.

     

    Theoretically, you can do much more than what currently exists with the AI Comm. My plan is be able to "request" allied calldowns, suggest buildings, setup "forward bases" that are not real towns, and create a sort of gameplay where you manage one or more allies strategically and economically in order to win the game.

     

    I'm thinking this might be better than messing around with the original or trying to reverse engineer it, because with this, you can use the Campaign AI and not be limited to Melee AI.

    Posted in: Triggers
  • To post a comment, please or register a new account.