Jump to content
  • Advertisement
Sign in to follow this  
slicer4ever

How would you do AI for this?

This topic is 2474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello all, i'm having a problem with figuring out how to appoach ai for the game i'm making.

basically, the battle system is a real time version of final fantasy tatics turn based system, only battled with creatures instead of people, and where stamina/Mana governs how creatures can attack/move.

here's a video of an earlier build of me fighting myself.

[media]
[/media]

anyway, i just don't know where to begin with in terms of ai, it's all going to be scripted in lua so i can do things with unique npc's, but the most i can come up with is checking each action a creature the npc controls can do against another creature. and factoring a number to see how it affects(this number can be partially controlled by the action's own scripting.) and eventually choosing the highest action factored. also, as you can see, you can avoid attacks by moving away before they hit, i'd like to approach this as well.

but i also need to figure out how to factor in movement to other spaces and such.

in short, looking at the basic mechanics in the video, i'd like to hear how people would implement ai in this game.

Share this post


Link to post
Share on other sites
Advertisement
The method you are describing uses a utility function to decide the next move. It is a totally valid approach in your situation. You can find some information on implementing such a system by searching around by the name, or checking out this book by the resident utility-master Dave Mark: http://www.amazon.com/Behavioral-Mathematics-Game-Dave-Mark/dp/1584506849

I would probably write a simple finite state machine or behavior tree that then uses utility functions like you described to drive the transitions from one state to another. Check out some of the sites in the stickied resource thread if you want to learn more about those methods!

Share this post


Link to post
Share on other sites

The method you are describing uses a utility function to decide the next move. It is a totally valid approach in your situation. You can find some information on implementing such a system by searching around by the name, or checking out this book by the resident utility-master Dave Mark: http://www.amazon.co...k/dp/1584506849

I would probably write a simple finite state machine or behavior tree that then uses utility functions like you described to drive the transitions from one state to another. Check out some of the sites in the stickied resource thread if you want to learn more about those methods!


What he said.

Share this post


Link to post
Share on other sites

The method you are describing uses a utility function to decide the next move. It is a totally valid approach in your situation. You can find some information on implementing such a system by searching around by the name, or checking out this book by the resident utility-master Dave Mark: http://www.amazon.co...k/dp/1584506849

I would probably write a simple finite state machine or behavior tree that then uses utility functions like you described to drive the transitions from one state to another. Check out some of the sites in the stickied resource thread if you want to learn more about those methods!


That is an excellent book, without a doubt and is a highly recommended read for anyone looking into game AI. But Behavioral Mathematics for Game AI is more about the theory of behavioral mechanics. It sound as though this game would be a perfect canidate for a combination of Finite State Machines and Fuzzy Logic. FSM is a fairly simple AI mechanic, but Fuzzy Logic is a bit more in depth and deals with probabilities. I recommend "Programming Game AI by Example, by Mat Buckland". He provides an excellent implementation of Fuzzy Logic in his book, plus much, much more :)

http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782/ref=sr_1_1?s=books&ie=UTF8&qid=1327336093&sr=1-1

Share this post


Link to post
Share on other sites
Fuzzy logic is utility theory in a different light. And considering that my book is almost entirely about utility theory, you can see the overlap.

That said, Mat's book is great for learning how to do all the different AI techniques such as FSM. However, note that an FSM doesn't decide anything for you. It is an architecture, not a reasoner. The OP didn't want to know about an architecture for representing/storing what he is doing now (e.g. a FSM) but rather suggestions on a reasoner about what to do next.

Share this post


Link to post
Share on other sites
In my opinion, that is what fuzzy logic would help the AI controlled character determine. Based on what the player is doing "now", fuzzy logic can return a weighted value as to what the AI should do next. If the player is, say shooting a lighting ball at the AI, fuzzy logic can determine that the best thing to do next is to try and dodge the players lighting ball. With FSM, the AI can then switch to something like an Evade state in order to try and dodge the incoming attack.

Based on the video posted by the OP, this is how I would construct the AI, which is the reason I suggested this approach. In all honesty, I meant no disrespect, just merely trying to provide a direction in which the OP could take in designing the AI for his game.

Share this post


Link to post
Share on other sites

In my opinion, that is what fuzzy logic would help the AI controlled character determine. Based on what the player is doing "now", fuzzy logic can return a weighted value as to what the AI should do next. If the player is, say shooting a lighting ball at the AI, fuzzy logic can determine that the best thing to do next is to try and dodge the players lighting ball. With FSM, the AI can then switch to something like an Evade state in order to try and dodge the incoming attack.

Based on the video posted by the OP, this is how I would construct the AI, which is the reason I suggested this approach. In all honesty, I meant no disrespect, just merely trying to provide a direction in which the OP could take in designing the AI for his game.

No problem, you're on the right track... you are just enamored with the term "fuzzy logic", that's all. Utility theory is the practice of weighing things based on their pros and cons and deciding which gives the best "return on investment" so to speak. It's a much more flexible superset of fuzzy logic.

Also, the fact that probably 90% of all RTS and TBS AI uses utility theory in some form or another is a pretty solid recommendation. tongue.png

Share this post


Link to post
Share on other sites
thanks all for the input, i'm sorry it's been a little bit since i've responded, i haven't been able to do work on the ai at the moment, as i realized that the ai systems would benefit greatly by incorporating multi threading in my application, to allow my render, ai, and animation routines to be ran side by side, instead of one choking the other.

anyway, that's just about finished now, so, i can again focus on ai.

so, utility theory is the word i'm looking for, thank you for linking me to some book's on the subject, i think i'll purchase both, and gain a better understanding of how to approach ai in my current game, and future game's i work on.

thanks everyone, and if their's anymore input on the subject, i'd be much appreciated to hear more.

Share this post


Link to post
Share on other sites
risk/reward analysis for the evaluations.

complexity may be significant when several moves/actions are required to carry out goals (and factors like facings and terrain blockage effect results)

'planners' might be useful as well as influence maps if multiple object interactions/coordinations are part of the game problem

Share this post


Link to post
Share on other sites

risk/reward analysis for the evaluations.

complexity may be significant when several moves/actions are required to carry out goals (and factors like facings and terrain blockage effect results)

'planners' might be useful as well as influence maps if multiple object interactions/coordinations are part of the game problem

That about covers it. I planner would be an OK solution but might be a bit harder to pull off in Lua. Even then, you need to use the utility theory stuff to create the edge weights of your plan graph. Influence maps, as you mention, are very valuable here but really only if you have multi-unit things going on. Even then, influence maps are pretty much 2D grid-based utility in that they are combining the risk and reward factors into discrete values in space.

Still, all of those terms are very valuable to look up in this situation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!