I think we should flip the situation entirely. Our default setup should be built around search. Everything in the AI should be hooked up with search in mind. Action selection, animation selection, dialog selection, target selection, and so on should all be setup as searches.
I can already hear my colleagues screaming. "Search is too slow!" "It uses too much memory!" "Don't search if you already know the path!" And of course all of those statements are perfectly correct. My contention is that even with this in mind we should still be using search. Essentially I think if we develop the 'craft' of using search we will find that we can mitigate many of the problems of search while gaining most of the benefits.
When I say craft of search I'm trying to describe how you use and implement search. If you naively implement search then the time space behavior of search will be prohibitive. Instead you need to architect your search to work in a real time environment. To do this we need to do four things.
- Pick the right algorithm
- Constrain the search space
- Expand the solution space
- Guide the search
Constraining the search space means that we limit the number of possible states that we consider. How much you constrain the space is dependent on your problem. The craft/trick/magic is constraining your search space without excluding your solution from the remaining search space. In the general case this can't be done. In most game situations I think this can absolutely be done.
Expanding the solution space means accepting more possible solutions. This has the same effect as constraining the search space. So instead of looking for one possible end state you need consider a range or the best available.
Guiding the search will speed up the search in the general case. A heuristic or hard coded expert knowledge is perfect for most game situations. If before you were able to explicitly path the AI to the desired action now you can guide the search to the same exact results.
Given there is some overhead to using search that would not exist in a non search environment you might ask what do we gain for all this hard work. You might also be thinking "I'm not a dumbass I know all this already and you're still wrong". In either case let me explain what I think the benefits are/could be to take a more search oriented approach.
AI would be smarter
AI would be more robust
AI would be easier to develop
The AI would be smarter because it would consider more of the state space than you could ever hope to explicitly encode. The best example I can think of is considering future actions. It is hard enough to encode all the responses to current state without having to encode responses to future state. Searching would trade some runtime cycles to explore this space to find better smarter solutions.
The AI would be more robust because it could find solutions to situations we have not explicitly encoded. We might have a rule for jumping on turtle heads but what if those turtles have wings? Searching would allow us to find solutions to problems we haven't planned for. It would also enable us to escape the local minimum. The AI could get stuck in the valley never able to escape because the tuned thresholds don't account for the fact that turning around just hits the same threshold on the other side. Searching allows us to get past this issue into the state space of correct solutions.
Search is easier to develop because it requires the AI developer to have less expert knowledge. You don't have to add as many tuning parameters and better yet you don't have to tune those parameters. Instead of the AI developer heuristic of we should jump at velocity X, height Y, and Time T we can search and find the optimal best point to jump without the AI programmer ever spending any time trying to figure out good strategies and tuning values for when to jump.
There you go. That's my manifesto on why we should be using search in games. I've done hacky one off search stuff but never anything on the scale I'm proposing. I do have the architecture ready to go though if ever I get something close to a sure lets try it out on project X.
As a follow up I found this article today. I'm not totally alone.
https://www.skatgame.net/mburo/ps/aiide12-combat.pdf