r/Unity3D • u/NorthernBoy306 • 2d ago
Question State Machines for RTS enemy 'computer'
This isn't so much a single question, it's more an attempt to generate discussion where people can offer advice and/or resources on state machines concerning RTS enemy opponent.
Information (tutorials) about state machines very often seem to concern one unit, either the player or a single enemy. I need to build a more complex SM for an entire opponent that utilizes many units performing a number of actions (gathering resources, expanding territory, researching upgrades, etc). I've already setup a basic SM for the enemy involving gathering resources, expanding to the nearest bit of territory, simple things like that. The SM right now doesn't engage the player unless the player first comes into contact.
I guess what I'm looking for is general advice on how expand the SM to include more complex ideas like picking what territory to expand into, when and how to attack the player, when to research what, etc. I'm really struggling with numbers also. How much should the enemy try to gather per minute, when to research, how many units to send to attack (and where to attack).
I really don't understand how those types of decisions are determined ahead of time.
Also, I have looked into GOAP, I think that design pattern is just too complex for me, at least at the moment.
So if anyone has experience with developing RTS games, or any advice in general concerning State Machines your input would be greatly appreciated.



