This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Artificial intelligence's architecture

Artificial intelligence's architecture
by on (#201343)
How do you handle non-trivial artificial intelligence in your homebrews?

I just re-implemented a new AI for the Smashbros-like that entered the nesdev compo 2016. Since I love to solve problems by myself, I came with my own solution. At any time, the bot has a current action, which is a simple technical move, like "double jump". When the current action is complete, a new one is selected by running a series of subroutines, each trying to solve a specific task, for example a subroutine can try to hit the opponent, another can try to move to a safe area, ... It leads to an easy to write AI, each subroutine focusing on a specific goal. As a bonus, the bot's behavior can be adapted at run time by modifying the list of subroutines used during the selection phase.

Being pretty proud of the thought process and the result, I also wrote an article about the subject. And now that everything is clear in my head, I would be glad to compare with how you guys fix the same problem.
Re: Artificial intelligence's architecture
by on (#201344)
That sounds very similar to the gambit system used (by players!) in Final Fantasy XII, which also happens to be my favourite simple AI: it's just a priority-sorted list of condition-action pairs. The first condition that returns true triggers the action it's paired with. Since FF12 is an RPG all the conditions are actually targets, such as "enemy: HP > 1000" or "ally: poisoned", and the 'condition' is simply that a target matching the criteria exists. The actions are identical to the ones on the player's control menu, using the target provided.
Re: Artificial intelligence's architecture
by on (#201349)
Quick off-topic note:
CPU running at 1.5Mhz

It's actually 1.79 MHz (NTSC), or 1.66 MHz (PAL). (
Re: Artificial intelligence's architecture
by on (#201369)
The gambit system is awesome, it shines by its simplicity. Also, it is particularly adapted for an RPG as the game can naturally unlock it progressively to let the player experiment with a limited version before getting access to the full stuff. FF XII being turn based also helps for accessibility, the player/designer immediately understand when the logic is run. It may be less intuitive on a real-time game as the player must think in ticks while experimenting continuous gameplay, but it would be no problem for a developer/designer.

Oh, and thefox, you are perfectly right and on-point. When writing I didn't even though of using the precise frequency. I may have stick with the rounded 1.5Mhz value, but it would have been better doing it consciously. Lesson to learn: ask proofreading from someone knowledgeable about the subject.
Re: Artificial intelligence's architecture
by on (#201390)
FF XII is realtime, with cooldowns/casting times. The gambit engine will interrupt a spell or action if its target is lost or a higher-priority one becomes available in the meantime, under certain hardcoded conditions. That's actually one of the reasons the gambit system is so useful - it lets you control your whole party without pausing. I like to play entirely by the gambit menu. :P
Re: Artificial intelligence's architecture
by on (#201392)
Hello class. I'm Mr. LeBeau
, and today we'll learn to code by programming this PlayStation 2 to play Final Fantasy XII for us. Now let me get out some cards so I can spin up this generator, and we'll be set.