Understand AI

Hi guys recently I begin to build my own Rgss AI in rpg maker this my first really time so I was tempted to open a conversation about it 

so here how I see for myself how AI works 

Of what I understand a AI is simply a script where the system ask you a question "what I should do " and after normally you input a "condition" for force him to know a action 

like this : 

def what_should_i_do? AI_action end but even ...the system don't know when implement a action the system do not know WHEN he have to do unless you call him...

def give_order what should_i_do?enddef what_should_i_do? AI_action end but now now ...we want our AI to be less baby like and always giving him the order can get boring...so let's make a auto_system

by a flag

LIBERTY_FLAG = truedef liberty?LIBERTY_FLAG == trueenddef what_should_i_do?if liberty?AI_actionendendwith that we can be sure each time we be sure we don't have to repeat the AI order

but now ...this not really diversify the AI in their action I mean the AI only do one action ..and using multiple bolean flag  is not the best for the AI so...it's now we pass on a more intelligent  AI by using a when who permit to allow more knowledge to the AI 

def AI_actioncase my_master_reactionwhen :angryreturn I_am_scarewhen :happyreturn I_am_happyelseI_am_neutralendendwith that it's permit to implement multiple reaction to the AI

but after we can push more knowledge to the AI by example to add him special condition to their flag so they will know how to react to a specific way

example ....we can make our AI to know how to recognize the clock time ...what a kind master you are to teach to your little cute AI how to count is time

def AI_action if time <= 100I_sleependif time >= 600 I_should_wake_up_my_masterendI_do_my_usual_chore if time >= 650 and time != 0end#or to a specific numberdef AI_actioncase time when 100I_sleepwhen 600I_should_wake_up_my_masterelseI_do_my_usual_choreendendall these are one of the numbers way for make AI so please don't hesit to share you own idea of the AI or such : D

PS: all these observation go with my own experience on my first AI so bare with me I just give my opinion on that 

Original thread: https://forums.rpgmakerweb.com/threads/understand-ai.40551/