html5-img
1 / 15

Project M.AI.S. Multi-threaded AI system Per Erskjäns game engineer

Project M.AI.S. Multi-threaded AI system Per Erskjäns game engineer. Project goals. A system that scales to the number of available cores. AI implemented with a data oriented behavior tree. Work with a data oriented mindset. Flocking behavior with simple graphical representation.

mimis
Télécharger la présentation

Project M.AI.S. Multi-threaded AI system Per Erskjäns game engineer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project M.AI.S.Multi-threaded AI systemPer Erskjänsgame engineer

  2. Project goals • A system that scales to the number of available cores. • AI implemented with a data oriented behavior tree. • Work with a data oriented mindset. • Flocking behavior with simple graphical representation. • AI behavior not the main focus.

  3. Project reasons • Get experience working with a multi-threaded environment. • Get experience working with a behavior tree. • Train my self in data oriented design.

  4. Result • 50 – 85 % framerate gain with 2 threads. • Not tested on quadcore computer. • Gain depends on computational cost. • Only one class with heritage.

  5. Result • A data oriented behavior tree. • A component based entity system. • There are many oppertunities for optimization, was not a focus.

  6. System design Framework Main loop update Scheduler Graphics system update Movement system changes update AI system changes update Sensory system Distribute changes

  7. System design • Onechangeque per thread, usingthreadlocalstorage. • Each system haveownership over 0 – manyattributes. Onlyoneowner per attribute. • Max numberofentitesarepreallocatedinto system specificarrays at application start.

  8. System design • Serial or parallel system updatedepending on entitynumbers. • In parallelupdate the update loop is split in to tasks. • Intel ThreadingBuilding Blocks, used for task managment.

  9. Behavior tree design The implementation is a data oriented solution without heritage, virtual functions and recursion. The whole tree is laid out in a flat array in a depth first order.

  10. Behavior tree design All nodes share the same data structure; struct BehaviorTreeNode { node_types::Enum node_type; union { u32                       end; BehaviorFunction execute; }; }; After the creation of a tree (or loaded it from disk) the array is run through a initiation function to set the correct function pointers.

  11. Behavior tree design • Each AI entity is represented as a BehaviorTreeInterpreterobject, containing a blackboard (keeps the entityknowledge) and a pointer to the appropriatebehaviortree. • On each frame an interpreter  function loops through the behavior tree.

  12. Behavior tree design • The parent nodes are pushed or poped to/from a stack and used to decide how to handle a return state from a behavior function.

  13. Problems • Not to many problems but some things that took more time than needed to solve. • Some really stupid misstakes like a (–) instead of a (+) in some calculations. • Some strange bugs with SFML.

  14. Conclusion • Did learn much, both small and big things. • Learned most from research, not implementation. • Didn’t get as deep knowledge of task managment as planed. Mainly because of TBB. • Unit testing could have helped.

  15. Questions ?

More Related