• 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

Basic AI for turn-based AI (xcom-like) soldiers

5 posts in this topic


Im planning a tactical turn-based squad game. Combat is similar to old xcom (time units is being spent to move, turn shoot etc).
8 vs 8 soldiers, gridbased maps. One team moves all soldiers, then opposing team moves all.

I need something like AI doing:

1. Positioning, use cover/walls depending on known position of hostiles (probably hardest to implement)
2. "Plan" usage of timeunits so doesnt end turn in exposed location
3. Pick suitable firemodes (snap shot, aim fire, full auto) depending on "situation"
4. Choose when/if to use special actions like throw grenade, crouch, heal teammates
5. Choose weather to run after enemies, stay put, scout for additional enemies when noone is visible etc.

To perfect this is VERY hard i know, but how do i go about making a acceptable system that gives a feeling of intelligence (or at least offers some resistance to the player)? Any guide? Where to start?

Thanks a lot

Share this post

Link to post
Share on other sites
Hi suliman

I think your cases are too general and dividing them will help you to deal with them easily .
I will assume you have different soldier classes , just for clarification .

[quote]1. Positioning, use cover/walls depending on known position of hostiles (probably hardest to implement)[/quote]
That depends on many things :
Is the teammate taking/not taking fire ?
Heavy soldiers prefer close cover , Snipers prefer far ones .
Is the teammate injured ? if so he will need to take the closest cover to the medic .
Choosing High areas to expose as many enemies as possible .
Choosing Hidden areas to make surprising attacks .

[quote]2. "Plan" usage of timeunits so doesnt end turn in exposed location[/quote]
You must prioritize your conditions (time , safety , superiority , close / far ... etc) , that will help you determine which position to choose for every situation .

[quote]3. Pick suitable firemodes (snap shot, aim fire, full auto) depending on "situation"[/quote]
That will depend on how far is the your soldier , armored/weak enemies , covered / exposed ...

[quote]4. Choose when/if to use special actions like throw grenade, crouch, heal teammates[/quote]
I think of something like :
Fighting group of enemies ? -> They are far ? -> Throw grenade , They are close ? -> open heavy fire .
Going to positions A ? -> Crouch if that will help you hide from enemy's sight , getting to narrow areas or when getting behind cover ...
Check for close teammates ? -> if no one injured -> check for far ones , if a close teammate is injured go help him . Here you will have to make the other teammate come closer to the healer as well as the healer will go closer to him (if possible) . Also you must make conditions about who will get treated first (closer first or critically injured first ...)

[quote]5. Choose weather to run after enemies, stay put, scout for additional enemies when noone is visible etc.[/quote]
mmm , I suppose chasing enemies will be better if the team is in superior condition , if not then they will have to retreat instead .
Staying will be preferred if you want to ambush the enemy when he comes to your area , or to hide from scouts .
Scout for enemies while your team is recovering from a fight for example , so you can get ready as early as possible .

There are so many conditions and variables here , I think you'd better play XCOM for some more time and try to draw a tree or something to define the situations and actions .

Good luck [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Edited by Delphawi

Share this post

Link to post
Share on other sites
I'd suggest looking into Goal Oriented Action Planning and starting small. For phase 1 try working with perfect knowledge so the AI know everything and build a Kill Nearest Weakest plan.

For this plan you'll want to[list=1]
[*]Move a unit so that at end of turn it is in cover and can attack the weakest target in range.
[*]If it can't move to cover and attack in the same turn prioritize cover.
[*]If already in cover and in range of weakest check if in optimal position and attack or move accordingly.
That should give you plenty to work through for initial iteration. After that's working and you've built your Tests around it then expand on it by adding greater depth and decision making. For example are the chances higher to kill the target if the unit moves to another position or to fire twice. Then move to other areas like adding different types of plans, new behaviours, optimizing, reducing AI knowledge, coordination between units, to the plans.

The're will be lots you'll need to do just with first iteration plan. You'll need to work out how to represent the data. How the planner will work. Implementing search algorithms or heat maps for placement of units. So keep it small testable and with room to expand.

Share this post

Link to post
Share on other sites
But when comparing different options should i work out some "point" system or how do i check priority, like:

In this soldiers situation right now (all this must be calculated every time a soldier needs to take a decision):
1. Moving to a certain cover is worth 45p (doesnt have cover +30p, close to good cover +15p)
2. Staying but firing at an enemy at 24 % hitchance is worth 33p
3. Scouting is worth 0 p (visible enemy closeby so this shouldnt be an option)

And then check, what do i "want" the most (in this case move to cover)?

Share this post

Link to post
Share on other sites
You must set a "weight" for every action , for example :
every hit taken = 3p , so if there is an enemy that could deal 10 hits , then getting to cover will save you 30 points .
every damage dealt = 2p , and for powerful enemies it will be 3p , 4p for medics ...etc .

Notice that there are special cases , like healing your last teammate is more important than dealing some damage (unless that damage is enough to kill the last enemy for example) , but you shouldn't worry about this for now :)

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