• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Scouting Ninja

How to make a AI choose?

18 posts in this topic

I have very little experience in AI programing and was wondering how I would make the AI choose the best option for it's self.

 

example:

 

Small Sword     = 1   dmg   /cost: 1 point  

 

Medium Sword = 5   dmg    /cost: 5 points

 

Large Sword    = 15 dmg    /cost: 10 points

 

Total points = 12

 

So any player seeing this will know that the large sword is the better option, but I want the AI to know this.

 

I can't just tell it to use the highest costing attack because the values will be random.

I don't only want it to compare attacks it should also be able to decide what enemy to attack if there is more than one?

2

Share this post


Link to post
Share on other sites

Enter utility-based AI.

 

Thank's this does look like what I want, but it seems like a lot to learn.

Will I really need to know this for a gaming AI?

1

Share this post


Link to post
Share on other sites


you want the AI to select the weapon with the best value, where value = dmg/cost.

 

This does seam a lot simpler and I guess for healing items mixed in I could check -1*dmg.

 

Thanks for all the help, it seams that I can work something out from here.

0

Share this post


Link to post
Share on other sites

This does seam a lot simpler and I guess for healing items mixed in I could check -1*dmg.

 

are you selecting items to use, or buy?

 

for use, you first want to check your state:

1. i need to retreat and heal, or

2. i'm still ok, press on with the attack.

 

in case 1, you select the best healing item.

in case 2 you select the best weapon.

 

but you want a layered approach:

1. decide what in general you need to do  ( attack vs heal).

2. decide the particulars of how to do it  ( use best search algo to select best wpn or best healing item).

 

so your AI might first decide on attack vs heal, then invoke one of two sub-AI's: one that specializes in attack, the other in healing.

 

divide and conquer.

Edited by Norman Barrows
1

Share this post


Link to post
Share on other sites

 

Enter utility-based AI.

 

Thank's this does look like what I want, but it seems like a lot to learn.

Will I really need to know this for a gaming AI?

 

 

It is the fastest-growing AI architecture out there. Between behavior trees and utility systems, you can handle most of the AI needs out there.

2

Share this post


Link to post
Share on other sites

Alright so AI is basically logic. Unless you have some syntax or impanation problem you need to set priorities and think about how you want the AI to think.

 

 

Here is something I would try.

 

 

First I would read the health of the player to see what is best suited for killing them.If the player has really high health and a single big sword swing won't give the AI an advantage I would make it choose second best to save points If the player is on it's last leg about to die I would have the AI go all out to ensure the player will die If the player has a chance to be killed by a big sword swing but the AI doesn't have enough points I would make it choose the light attack to build up quickly

 

AI is just logic and you should think about what's the most effective way to get the result you want which mainly involve killing the player.

0

Share this post


Link to post
Share on other sites

Thank's everyone for all the help.

I now have a npcs that walk around and can engage in combat, the layered approach produced a great AI with out too much of a struggle.

 


It is the fastest-growing AI architecture out there. Between behavior trees and utility systems, you can handle most of the AI needs out there.

 

I have been reading up whenever I can, it's been really interesting.

I hope to implement it into my game at some time, just need to learn more.

 


First I would read the health of the player to see what is best suited for killing them.If the player has really high health and a single big sword swing won't give the AI an advantage I would make it choose second best to save points If the player is on it's last leg about to die I would have the AI go all out to ensure the player will die If the player has a chance to be killed by a big sword swing but the AI doesn't have enough points I would make it choose the light attack to build up quickly

 

I will consider this for a hard mode.

At the moment my AI always makes the best attack choice, making it really hard to win when you accidentally selected the wrong option or when you are out numbered by even one enemy.

To solve the problem I weakened the attack of regular enemy's, it's still the same for boss battles or important battles, on easy the opponent has a one out of five chance of choosing the worst possible attack.

0

Share this post


Link to post
Share on other sites

Game mechanics are also often more complicated

 

Such as : the large swords swings slower - taking more time for the complete cycle, thus it is not  damage-per-swing but damage-over-time.

 

This also may tie into other game mechanics like having to do another action quickly and that longer swing now delays doing some other needed operation quickly.

 

Another might be BIG swords take 2 hands when with a small the other hand could hold a shield or second weapon.

 

The bigger sword may have more reach than a smaller one or it may deliver more power to a strike that isnt soaked off as much by certain kinds of armor (or be more useful to block strikes from a equivalent large sword because of its mass)

 

DIfferent swords often have slash moves or thrusting moves  

 

A smaller weapon can be handier in a close fight.

 

Consider similarly for other weapon types available.

 

So the decision can be more complex and be effected by the situation (and thus the logic growing quite a bit more)

 

0

Share this post


Link to post
Share on other sites

Just try them all :)

In complex games with many arbitrary factors, using a MCTS (Google it) search can be very effective. 

 

You don't personally have to have any idea what strategy is best, and you won't have to rejigger

your whole strategy every time something changes in the game.

0

Share this post


Link to post
Share on other sites

Just try them all smile.png

In complex games with many arbitrary factors...

 

Hi,

 

I usually use a different goal functions and different goal value for different situations and different strategies. This function is usually selected from a possible goal value in the knowledge base table.

 

Thanks.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0