Ok, so it's not exactly skynet, but I have got my first AI state working, kind of. The first state is "HOLD" in which case the agent stays in place where they are and shoots at any unit that comes in range. When I started writing this module, I found that the existing method of triggering actions wasn't good enough to allow the AI to choose the best weapon or target. It worked by simply sending a command to the unit to trigger the currently selected action. If the action is valid, it triggered, if not it didn't. That's fine for play controlled units, as that's all they need to do. But AI needs to know in advance if the action is valid. The player can get that info from UI feedback, but that wasn't available to the AI player. There were three problems: 1. The UI feedback duplicated code in the action trigger function. These two sets of code could get out of phase so that UI feedback was wrong. 2. The action trigger didn't give enough ...
A blog about my various game dev projects.