I'm thinking implementing for some parts of my game an AI based on decisions. I need your help to achieve it.
First, I'm not even sure this is the name I should be using. But basically I'm thinking of implementing a matrix that will define conditions for an action to be taken. Each element in a row determines a condition. The whole row determines the needed state for an action to be taken. A small example:
Matrix legend (row): Rainy, Night, Winter, Full Moon, Action
0,1,1,0,load_vampire_into_room
0,1,0,1,statemachine(choose monster from other data)
...
This type of AI is meant to be a simple one. One of the places where it will be used is with CRoom objects as exemplified above. The second row shows an example of me wanting to eventually implement it also in conjunction with a state machine.
Now... I have two problems with this.
First, do you think this makes a good framework for an AI?
Second, the matrix rows can grow considerably (vertically). However, the actions will be finite. There's only a bunch of actions that I want to put through this AI (some monster placement, some doors being closed or opened, some lights on or off).
What I can see in this is an excellent opportunity to turn this matrix into a tree and speedup considerably the lookup phase. However, I've been working around an algorithm to do it, but simply can't find one. Mentally, I can envision the tree and I can envision the matrix... so this can only mean it is possible to express programatically the conversion. I just can't see how.