-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable counterintel by default for AI units #6635
base: develop
Are you sure you want to change the base?
Conversation
URL0101: Cybran land scout cloaking URAxxx: Cybran aircraft personal stealth UEA0304: UEF Strat jamming
@lL1l1 Rather than doing this at the unit level. Since its for AI only could we perhaps tackle at the aiBrain layer? Jip introduced callback triggers against the aiBrains for OnUnitStopBeingBuilt which I believe could tackle this. A reason why this is a good approach is that we can make it only impact the AI's that we are interested in such as the default and campaign. 3rd party AI's handle their own counter intel units(which isn't really relevant since this just changes the on built state). There is a set of brain files that live under /lua/aibrains with one for each AI type. You can see the default one in the aibrain.lua file under /lua/aibrain.lua, make the change and paste into the other brains to maintain separation. Just a thought. |
So you want me to put the callback into |
I was just having a look as I've forgotten. I couldn't find a reference to it using the base-ai.lua file In the OnCreateArmyBrain function I could see this.
}` Provides all the key references. So I think the base-ai.lua is a base template rather than something that is used. So in theory if we want all the default AI including campaign to use it we update all the brain files for the various AI. In answer to your other question. Sadly no it won't apply to spawned units since they don't perform that callback. The callback is just for when a unit is built (I couldn't remember if it applies to just factories or if both factories and engineers). If you want me to validate first I can run the changes locally here before you put in the effort. disclaimer : The default skirmish AI can also handle enabling the counter intel stuff itself when it forms its platoons, it just hasn't been done yet. |
@relent0r I moved the counterintel enabling to the campaign AI and the default AIs. Can you review it please? |
Yep, looks good indeed, although I do have a question. When it comes to spawning units, doesn't |
Yea OnCreate does get called. From an AI developers pov OnCreate would be better (its what m28/m27 use as the hook for assigning units to logic). I always assumed there was a valid reason why it was never used as a callback for ai. e.g why have a heavy platoon manager when you could just use oncreate callbacks. |
I second the idea of having the whole thing handled by As for why GPG did things this way, I think they preferred the idea of manually enabling these whenever the mission, and/or AI developers have seen it fit, or simply didn't have the time nor resources to seperate AI and player cases. |
I think for the sake of getting this implemented we should run with what we have as hooking OnCreate is something that requires a bigger discussion given the potential for impact where as this change is a known quantity. I know Jip spent a bunch of time attaching callbacks to the aiBrain class so that we could leverage added functionality but I never thought to ask why he didn't add OnCreate as part of that work. Perhaps we could create an issue and get a wider discussion on it? |
Agreed, this might be an issue that could have further implications. |
I just attempted to test this but for some reason its not setting stealth. In this screenshot there is a cybran strat bomber and ASF's that did not enable stealth. I logged the callback and its firing, its detecting that the unit supports stealth and attempts to set the script bit but the unit itself never goes into stealth. I double checked the unit id and its passing the correct unit. Thoughts? |
Description of the proposed changes
Implements a discord suggestion.
Testing done on the proposed changes
All units work as expected when spawned for the player and the default civilian AI.
Spawn command:
Checklist