Forest Strike - AI

Started by
17 comments, last by LukasIrzl 6 years, 2 months ago
On 1/29/2018 at 12:03 AM, IADaveMark said:

One major problem with your stack is that, while executing a stack over multiple turns, the game state will have changed therefore possibly (likely?) invalidating your current stack -- either because it is now impossible or just plain silly.

Could this be fixed by having it action base? An example:

ActionLookForItem[ MoveUp,MoveLeft,PickUpItem] So if the Item disappears the stack can be removed. So stacks inside stacks or stacks under behavior tree.

How are stacks even used in games if they have large flaw like this?

Advertisement

I never thought about one stack for multiple turns. As mentioned, the stack could be invalid because of different reasons.

Basically, when speaking of the stack, I was thinking about creating the command stack every time when starting the round. In that case it is impossible, that something except the current AI instance is changing. So there is no need to fix the commands.

4 hours ago, LukasIrzl said:

never thought about one stack for multiple turns. As mentioned, the stack could be invalid because of different reasons.

True if they are all done in sequence it will not invalidate them. The question then is why use a command stack at all?

It doesn't reduce branches or loops, it doesn't do anything special and only adds complexity. Maybe it allows for more random behavior?

 

I'm looking into it but can't see any real use for it in small games. In large games it looks like it makes things more modular. Still they are interesting things these command stacks.

The only real reason why I could use it is because of performance reasons. If using a command stack, you calculate everything at the start of the round. Maybe even in a thread to avoid the game to stop. After calculating your commands, you can just execute the commands and do not need to calculate what to do next every step.

But in my game, the performance won't be a big deal, so I might not use the stacks at all. It may just add more complexity.

Sorry, I was under the impression that there was only 1 action per turn -- in rereading, I see that I missed the "multiple moves" bit. In that case, yes, building a stack would be a viable option. Look into Goal Oriented Action Planning (GOAP). This is one of the few situations where this beats out other methods. In essence, you work backwards from a goal to figure out how to accomplish it. However, you would still have to select your "goal" for that turn which is a higher level AI. ("What do I want to accomplish this turn?") The problem is that you have a finite number of steps to get there which narrows down your goal selection significantly.

Another way is to search forward from your current state evaluating the tree of things you could do. This is very similar to a tic-tac-toe or chess tree search. You have a branching model of all the stuff you could do with the moves available and score each end point -- i.e. "if I were to do X it would be worth N while Y is worth O." You would have to have some sort of scoring function that makes sense, though. How much is doing X worth?

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

The GOAP is just something I was looking for. I will definitely take a look, as it sounds promising.

About finding the goal I was thinking about something like this:

* if item is in reach (steps to item <= steps remaining) ---> get the best path to nearest item

* else ---> get the best path to the opponent (calculate path by using weights)

These would be the main goals. Would it be useful to define the destroying of blocks as a goal? e.g. the character just found the best path to the opponent. Now I do know, that there is a block in the way. Maybe set the goal to destroy the block then?

 

The other method you mentioned sounds like u use some sort of weights (???) to measure, what to do next. So basically, I would decide what goal I want to accomplish by calculating the "worthiness". So lets say defeating the other character would be worth 2. If there is only one character of the opponent left it may increase to 4 (or whatever). Getting an item would be worth 1, if it is in reach it may be worth 3.

Am I getting that right?

Pretty close. Look up utility-based AI. It is described in the link I put in this thread a while back.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Thank you. Seems like I overlooked the link.

This topic is closed to new replies.

Advertisement