Artificial intelligence's architecture

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
RogerBidon
Posts: 44
Joined: Wed Dec 28, 2016 7:16 am

Artificial intelligence's architecture

Post by RogerBidon »

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.
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: Artificial intelligence's architecture

Post by Rahsennor »

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.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Artificial intelligence's architecture

Post by thefox »

Quick off-topic note:
CPU running at 1.5Mhz
It's actually 1.79 MHz (NTSC), or 1.66 MHz (PAL). (https://wiki.nesdev.com/w/index.php/Clock_rate)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
RogerBidon
Posts: 44
Joined: Wed Dec 28, 2016 7:16 am

Re: Artificial intelligence's architecture

Post by RogerBidon »

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.
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: Artificial intelligence's architecture

Post by Rahsennor »

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
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Artificial intelligence's architecture

Post by tepples »

Image
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.
Post Reply