• 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
infernapelover

AI in RPG game

6 posts in this topic

Hello everybody,
not sure weather this post should go in the Ai category, i've got 2 questions for you all.

So ive been doing lots of c++ recently and i think i'm ready to make an rpg.

1)I was looking at games like dragon warrior for a good start. Then I thought, there must be Ai involved (beacuse the monsters actually have to think to pick moves). I do not know [i]anything[/i] about Ai programming and where to start it. I thought that maybe just a random rumber system would work, but it would make my game extremely dumb and artificial.
Any advise, guides, anything?

2)While this is obviously a highly debated subject, which c++ api should i use to make my game.
I've decided to use DirectX for 3d games( is that a good option?) , but my rpg is going to be 2d:
Which C++ Api is best for 2d games? : I tried SFML, but it didn't have some key features like animation.



Thanks in advance for any help.
0

Share this post


Link to post
Share on other sites
Ai for something like dragon warrior probably can be done with state machine ai - as in bunch of if -> else if combinations that ai can use. I think this is probably the way most of ai's work. As for the second question you could try SDL it has everything you will ever need for 2d rpg game, this is something i would use for 2d rpg game myself. Edited by proanim
0

Share this post


Link to post
Share on other sites
All you need to know about simple RPG AI you can learn from Final Fantasy 12. (You can create an AI for each of your characters in that game using the "gambit" system, with additional slots for making the AI more complex as you level up. Looking up a guide on the gambit system could probably give you a general idea of how these things work.)

In most simple RPGs the AI is simply a series of condition tests (looking at things like HP values, turn number, etc) that are in order of preference and end with a 'default' action.

[source lang="cpp"]ACTIONENUM chooseAction() {
if(myHP > 100) {return FIRE_BREATH;}
if(turnNumber == 3) {return HEAL_ALLY;}
if(enemyHP < 50) {return FINISHING_MOVE;}
return BASIC_ATTACK;
}[/source] Edited by Khatharr
2

Share this post


Link to post
Share on other sites
A lot of turn based strategy games can make good use of a [url="http://en.wikipedia.org/wiki/Minimax"]minimax algorithm[/url]. This is good for deciding which action is the most effective one before executing it. Do you run away and heal your character? Or do you close in with the enemy and try to deal more damage? With the minimax tree, you can play out all the possible scenarios and responses to see which one is best. So, if the enemy is a warrior and you run away and heal, the warrior will have to chase you to attack the next turn. But, you can run out of his range, so this is a "good" move. If the enemy is a wizard and you run away and heal, he'll just cast a ranged fireball at you, dealing more damage than you'd heal. So, its more beneficial to just attack the wizard and do what damage you can.
If you build your game model correctly, you don't have to write pages of complicated If statements to capture this type of reasoning. Just give your minimax tree a list of the possible actions your character can do each turn, the possible responses, counter-responses, etc. and let the algorithm calculate the best move based on the scenario.
For complicated games like Chess, where there are dozens of possible moves each turn, your tree is going to get a lot of [i]breadth[/i]. Since the essence of chess is thinking further ahead than your opponenet (and not making mistakes), breadth * depth will start to great very large trees. This will create some memory and processing limitations as the tree grows large. So, typically the tree depth will be limited to a set point. If the player chooses the easy difficulty setting, then the AI may only maintain a depth of 5 tree. If they choose medium, the AI will maintain depth 10 tree. If they choose hard, they'll get a depth 15 tree. The harder the AI is, the more time it will need to spend building deep and wide trees and evaluating the best branches to traverse. If you want to go insane, build a super computer with massive banks of CPU's and RAM and let the depth go really high, like 40. You'll get something like Deep Blue which can take on the worlds greatest chess players.
One technique you can use to save yourself some processing and RAM is to prune the tree a bit. If there is an obviously bad move (such as putting yourself into checkmate or losing your queen), you can stop traversing any subsequent moves down the tree. This is what people are really good at. The techniques for trimming and pruning your decision tree is where the specialized AI programmers differentiate themselves from the unspecialized programmers (I'm just a unspecialized programmer).

If your game is running in real time, you *may* be able to still get away with using this. If every ability has a cooldown time before it can be executed again, you can create a turn which is a set timespan in which actions can be performed, ie, you can swing your sword three times every five seconds, so a standard turn lasts for five seconds. Scripting complex if/else statements consisting of actions may also be a good way to go.
2

Share this post


Link to post
Share on other sites
Start with [url="http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782/ref=sr_1_1?ie=UTF8&qid=1351949179&sr=8-1&keywords=game+ai+programming"]Programming Game AI by Example[/url]
In your case, implementing a finite state machine is suitable
1

Share this post


Link to post
Share on other sites
[quote name='slayemin' timestamp='1351947130' post='4996845']
A lot of turn based strategy games can make good use of a [url="http://en.wikipedia.org/wiki/Minimax"]minimax algorithm[/url]. [/quote]

I think you've misunderstood both the genre and depth of involvement in the Dragon Warrior series. People don't like RPGs where the enemies are impossible to beat. Minimax is great for strategic games, but simple RPGs rely more on giving enemies cool-looking and overpowered abilities while leaving them with a fatally flawed strategy. The fun of that kind of game is finding the flaw in the enemy's strategy and exploiting it to beat them. Edited by Khatharr
0

Share this post


Link to post
Share on other sites
[quote name='infernapelover' timestamp='1351893125' post='4996677']
I've decided to use DirectX for 3d games( is that a good option?) , but my rpg is going to be 2d:
Which C++ Api is best for 2d games? : I tried SFML, but it didn't have some key features like animation.

Thanks in advance for any help.
[/quote]

You aren't going to find an "Api" set that has animation built in. You might find some engines that help with that. A previous used suggested SDL, well, it's OK, but it doesn't have built in animation support either. I think SFML is perfect for C++ 2D game development. You'll have to learn to handle the animations yourself.
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