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

AI component-based architecture

8 posts in this topic

I currently have started implementing a real-time simulation and I've realized that I will have to design the basic AI architecture soon.

I've found many resources about the different AI algorithms and their implementations but what I miss is the principal (component) based, overall design. The final game AI will be complex, so I want to design it from the beginning in a way that it can later be easily extended.

Can anybody recommend a resource? I'm not searching for high level ppts but a concrete example.

Thanks.
1

Share this post


Link to post
Share on other sites
The most important thing is a clear definition of the interface between the AI and the rest of the game. You will typically end up with some notion of [i]agent[/i], which gets sensory data from its environment and pick actions. You then need to figure out how to implement the action selection, but that's probably what all those resources you found talk about.

Is that what you needed? Edited by alvaro
0

Share this post


Link to post
Share on other sites
No, that was pretty clear for me ;) but anyways thx for you contribution.

I've should written in which areas I see the challenges:[list]
[*]realtime simulation...how to wire the AI component in the game loop ( probably it should run in an own thread to leverage multi-core). My idea was in the end that one core (if available) is reserved for AI. (AI is really very crucial for my simulation and should gain all needed systems resources, I have only 2D graphics).
[*]any experience how to unit test AI stuff? Any best practices how to test it in general?
[*]layering: is there an AI pattern for an AI master, which delegates stuff to tactical/strategic AI layers
[/list]

implementing it with C#/.NET 4.5 Edited by hawkeye_de
0

Share this post


Link to post
Share on other sites
[quote name='hawkeye_de' timestamp='1350741785' post='4992155'][list]
[*]realtime simulation...how to wire the AI component in the game loop ( probably it should run in an own thread to leverage multi-core). My idea was in the end that one core (if available) is reserved for AI. (AI is really very crucial for my simulation and should gain all needed systems resources, I have only 2D graphics).
[/list]
[/quote]
I have some ideas about that (in short, interfacing with the AI is part of the scene update), but perhaps people that have actually implemented something like this should give you their opinion.

[quote][list]
[*]any experience how to unit test AI stuff? Any best practices how to test it in general?
[/list]
[/quote]
This is not specific to AI. Designing your AI as something that has clearly defined inputs and outputs will make it much easier to do unit testing.

[quote][list]
[*]layering: is there an AI pattern for an AI master, which delegates stuff to tactical/strategic AI layers
[/list]
[/quote]

There's something called "subsumption architecture" which sounds pretty much like what you are looking for.
0

Share this post


Link to post
Share on other sites
[quote name='IADaveMark' timestamp='1350747088' post='4992175']
I will attempt to summon him.
[/quote]

Thanks Dave.
I've read 1/3 of your book "Behavioral Mathematics for Game AI" and so far I can say, it's a great book :) Edited by hawkeye_de
0

Share this post


Link to post
Share on other sites
Thank you so much Kevin !!! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
0

Share this post


Link to post
Share on other sites
[quote name='hawkeye_de' timestamp='1350741785' post='4992155'][list]
[*]
[*]any experience how to unit test AI stuff? Any best practices how to test it in general?
[*]
[/list][list]
[*]
[/list]
[/quote]

Visualization ...

I was doing a FSM driven behavior system for a simulation and because of the complexity of how the objects interacted --- a VERY important part of correcting/composing the AI logic was being able to visialize what all the objects were actually doing in the simulation (graphicly instead of reams of numbers), and beyond that was a way to show selected state data (visually/immediately instead of stop motion poking in the debugger) and then when all else failed falling back to some kind of ad hoc logging to show the critical calculations (to spot why it wasnt behaving the way I wanted it to)

The FSM (the high level logic) was part of the system which used proximity scanning to build target lists and pathfinding to sort target priorities/validity and multiple tasks/target types that were all being considered in parallel (priority picking) and it included the ability for an object to abandon a current task ( a multi-turn sequence of actions) when a better opportunity was newly detected. Each object would potentially consider dozens of object in its proximity. (Objects internal state also changed goals that shifted priorities).

So the visualization was the way I spotted something that looked like it wasnt acting right and then the internal data presentation could be turned on to try to trace how /what decsion was being made (with logging for very complex cases)

---

Unit testing would be having an 'arena' setup to place the require mix of objects in a canned situation to force them to interact. Usually tou do it in increasing complexity (to first test undistracted proper behavior and then to try where they conflict to make sure decision priorities were correct and the transitions(like abandoning a previous 'task') were done correctly.

Unit testing the tools used by the AI logic was fairly straight forward - displaying target lists, priority orderings, A* paths was easy to see that they were behaving properly (for a particular simulation situation)

---

For your AI structuring having things set up (from the start) to facilitate the testing is needed (like piping logging info to the screen and to files)

Presentation of the AI logic (CODE) to be easily readable (for when you are tracing the logic to figure out why something didnt act the way you think it should...) I created a high level language for the 'scripting' that was actually a macro expansion system (was in C/C++) -- the high level stuff was much simpler to read/understand (and went far beyond the 'high level subroutine calls' method in what it simplified.)


---

One thing that complicated matters was that the AI logic for object behavior was broken up into 'phases' where execution was broken up into grouped processing (I did a lock step calculate -act- resolve ... to get rid of the issues of the AI to hanlde changing world data). The macro system allowed each 'state' to have its associated logic visually grouped even though they executed in different places (phases) of the 'turn' logic.

Organizing the execution framework that way also allowed mutli-threading, as each objects logic was independant with the input 'world state' data static for each 'turn'. They could all be executed independantly with no 'data change' interlocking needed (which can be a huge source of overhead).


--------------------

Other data constructs for your all-in-one-system :

Target Lists

Priority assignment and sorting and picking (for boths tasks and targets)

flexible temporary state data used for persistant decisions

Map searching (and building relevant symbolized maps from the simulations map data)

Object attribute retrievals/ scanning

Visualization-oriented data (symbols for visual presentations)

Logging data templates (to facilitate tools for log playbacks)

My project was still fairly simple in the structuring of the AI logic and I hadnt yet gotten into 'planners' and hierachical goals/solutions/tasks (but I was headed that way because of limitations of the simplex system)

If your AI processing requirments are such that you exceed what can be done on one multi-core CPU then data replication/update systems will be needed for your AI-engine (that gets ugly).

----

Im not sure how you would structure this - but I found because of the huge amount of processing that AI takes (my simulation was running real-time) that you need methods of culling unneeded processing (ie- quantum priorities). The data driving that is usually imbedded throughout the main AI logic (both the engine code and the AI 'script' data) and the culling itself can happen at many points (In my system it happened in each processing phase in different ways)


I had to have many flags to block certain types of AI processing depending on the current state/actions of the object (which included being in the middle of atomic animations - which could incude locking out another object being interacted with) ---- So thats another consideration ---- of how closely you need the AI to have to interact with other game-engine functions (versus being largely independant) Edited by wodinoneeye
2

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