Evolving Behaviour Tree Structures Using Grammatical Evolution

  • Diego Perez-LiebanaEmail author
  • Miguel Nicolau


Behaviour Trees are control structures with many applications in computer science, including robotics, control systems, and computer games. They allow the specification of controllers from very broad behaviour definitions (close to the root of the tree) down to very specific technical implementations (near the leaves); this allows them to be understood and extended by both behaviour designers and technical programmers. This chapter describes the process of applying Grammatical Evolution (GE) to evolve Behaviour Trees for a real-time video-game: the Mario AI Benchmark. The results obtained show that these structures are quite amenable to artificial evolution using GE, and can provide a good balance between long-term (pathfinding) and short-term (reactiveness to hazards and power-ups) planning within the same structure.


  1. 1.
    C. Ryan, J.J. Collins, M. O’Neill, Grammatical evolution: evolving programs for an arbitrary language, in EuroGP 98 (1998), pp. 83–96. Available:
  2. 2.
    J. Togelius, S. Karakovskiy, J. Koutnik, J. Schmidhuber, Super Mario evolution, in IEEE Symposium on Computational Intelligence and Games (2009), pp. 156–161Google Scholar
  3. 3.
    S. Karakovskiy, J. Togelius, The Mario AI benchmark and competitions. IEEE Trans. Comput. Intell. AI Games 4(1), 55–67 (2012)CrossRefGoogle Scholar
  4. 4.
    M. Nicolau, D. Perez-Liebana, M. O’Neill, A. Brabazon, Evolutionary behavior tree approaches for navigating platform games. IEEE Trans. Comput. Intell. AI Games 9(3), 227–238 (2017)CrossRefGoogle Scholar
  5. 5.
    R. Colvin, I. Hayes, A semantics for behavior trees. ARC Centre for Complex Systems (ACCS), Technical report ACCS-TR-07-01 (2007)Google Scholar
  6. 6.
    M. O’Neill, C. Ryan, Evolving multi-line compilable c programs, in Genetic Programming, 2nd European Workshop, EuroGP 99, Göteborg, May 26–27, 1999, Proceedings, ed. by R. Poli, P. Nordin, W.B. Langdon, T.C. Fogarty. Lecture Notes in Computer Science, vol. 1598 (Springer, Berlin, 1999), pp. 83–92. Available:
  7. 7.
    J. M. Swafford, M. O’Neill, M. Nicolau, A. Brabazon, Exploring grammatical modification with modules in grammatical evolution, in European Conference on Genetic Programming, EuroGP 2011, Torino, April 27–29, 2011, Proceedings, ed. by S. Silva, J.E. Foster, M. Nicolau, P. Machado, M. Giacobini. Lecture Notes in Computer Science, vol. 6621 (Springer, Berlin, 2011), pp. 310–321Google Scholar
  8. 8.
    E. Murphy, M. Nicolau, E. Hemberg, M. O’Neill, A. Brabazon, Differential gene expression with tree-adjunct grammars, in Parallel Problem Solving from Nature - PPSN XII, 12th International Conference, Taormina, September 1–5, 2012, Proceedings, ed. by C.A.C. Coello, V. Cutello, K. Deb, S. Forrest, G. Nicosia, M. Pavone. Lecture Notes in Computer Science, vol. 7491 (Springer, Berlin, 2012), pp. 377–386Google Scholar
  9. 9.
    E. Galván-López, D. Fagan, E. Murphy, J.M. Swafford, A. Agapitos, M. O’Neill, A. Brabazon, Comparing the performance of the evolvable PiGrammatical evolution genotype-phenotype map to grammatical evolution in the dynamic Ms. Pac-Man environment, in IEEE Congress on Evolutionary Computation (2010), pp. 1587–1594Google Scholar
  10. 10.
    R. Harper, Co-evolving Robocode tanks, in GECCO, Genetic and Evolutionary Computation Conference, ed. by N. Krasnogor et al. (ACM, New York, 2011), pp. 1443–1450Google Scholar
  11. 11.
    R. Harper, Evolving Robocode tanks for Evo Robocode. Genet. Program Evolvable Mach. 15(4), 403–431 (2014)CrossRefGoogle Scholar
  12. 12.
    J.E. Murphy, M. O’Neill, H. Carr, Exploring grammatical evolution for horse gait optimisation, in EuroGP 2009, ed. by L. Vanneschi, S. Gustafson. Lecture Notes in Computer Science, vol. 5481 (Springer, Berlin, 2009), pp. 183–194Google Scholar
  13. 13.
    N. Shaker, M. Nicolau, G. Yannakakis, J. Togelius, M. O’Neill, Evolving levels for super mario bros using grammatical evolution, in IEEE Conference on Computation Intelligence and Games, CIG 2012, Granada, September 11–14, 2012, Proceedings (2012), pp. 304–311Google Scholar
  14. 14.
    N. Shaker, G.Y.J. Togelius, M. Nicolau, M. O’Neill, Evolving personalised content for super mario bros using grammatical evolution, in AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, AIIDE-12, 8th Conference, Stanford, October 8–12, 2012, Proceedings (AAAI, Palo Alto, 2012), pp. 75–80Google Scholar
  15. 15.
    S. Bojarski, C.B. Congdon, REALM: a rule-based evolutionary computation agent that learns to play Mario, in IEEE Conference on Computational Intelligence and Games (2010), pp. 83–90Google Scholar
  16. 16.
    E.R. Speed, Evolving a Mario agent using cuckoo search and softmax heuristics, in International IEEE Consumer Electronics Society’s Games Innovations Conference (ICE-GIC) (2010), pp. 1–7Google Scholar
  17. 17.
    N.C. Hou, N.S. Hong, C.K. On, J. Teo, Infinite Mario Bross AI using genetic algorithm, in IEEE Conference on Sustainable Utilization and Development in Engineering and Technology (STUDENT) (2011), pp. 85–89Google Scholar
  18. 18.
    A.M. Mora, J.J. Merelo, P. García-Sánchez, P.A. Castillo, M.S. Rodríguez-Domingo, R.M. Hidalgo-Bermúdez, Creating autonomous agents for playing super Mario bros game by means of evolutionary finite state machines. Evol. Intell. 6(4), 205–218 (2014)CrossRefGoogle Scholar
  19. 19.
    J.-J. Tsay, C.-C. Chen, J.-J. Hsu, Evolving intelligent Mario controller by reinforcement learning, in International Conference on Technologies and Applications of Artificial Intelligence (TAAI) (2004), pp. 266–272Google Scholar
  20. 20.
    H. Handa, Dimensionality reduction of scene and enemy information in Mario, in IEEE Congress on Evolutionary Computation (2011), pp. 1515–1520Google Scholar
  21. 21.
    E.J. Jacobsen, R. Greve, J. Togelius, Monte Mario: platforming with MCTS, in GECCO, Genetic and Evolutionary Computation Conference (2014), pp. 293–300Google Scholar
  22. 22.
    J. Liu, J. Togelius, D. Perez-Liebana, S.M. Lucas, Evolving game skill-depth using general video game ai agents, in IEEE Conference on Evolutionary Computation (2017)Google Scholar
  23. 23.
    K. Kunanusont, R.D. Gaina, J. Liu, D. Perez-Liebana, S.M. Lucas, The N-tuple bandit evolutionary algorithm for automatic game improvement, in IEEE Conference on Evolutionary Computation (2017)Google Scholar
  24. 24.
    A. Champandard, M. Dawe, D.H. Cerpa, Behavior trees: three ways of cultivating strong AI, in Game Developers Conference. Audio Lecture (2010)Google Scholar
  25. 25.
    D. Isla, Managing complexity in the Halo 2 AI system, in Game Developers Conference (2005)Google Scholar
  26. 26.
    L. McHugh, Three approaches to behavior tree AI, in Game Developers Conference (2007)Google Scholar
  27. 27.
    M. Mateas, A. Stern, Managing intermixing behavior hierarchies, in Game Developers Conference (2004)Google Scholar
  28. 28.
    C.-U. Lim, R. Baumgarten, S. Colton, Evolving behaviour trees for the commercial game DEFCON, in EvoApplications 2010, vol. 6024 (Springer, Berlin, 2010), pp. 100–110Google Scholar
  29. 29.
    J.R. Koza, Genetic Programming: On the Programming of Computers by Means of Natural Selection (Complex Adaptive Systems), 1st edn. (A Bradford Book, London, 1992)zbMATHGoogle Scholar
  30. 30.
    A. Klöckner, Behavior trees for UAV mission management, in INFORMATIK 2013: informatik angepasst an Mensch, Organisation und Umwelt (2013), pp. 57–68Google Scholar
  31. 31.
    M. Colledanchise, P. Ögren, How behavior trees modularize hybrid control systems and generalize sequential behavior compositions, the subsumption architecture, and decision trees. IEEE Trans. Robot. 33(2), 372–389 (2017)CrossRefGoogle Scholar
  32. 32.
    I. Millington, J. Funge, Artificial Intelligence for Games (CRC Press, London, 2016)Google Scholar
  33. 33.
    M. Nicolau, Automatic grammar complexity reduction in grammatical evolution, in GECCO, Genetic and Evolutionary Computation Conference Workshops (2004)Google Scholar
  34. 34.
    R. Harper, GE, Explosive grammars and the lasting legacy of bad initialisation, in IEEE Congress on Evolutionary Computation (2010), pp. 2602–2609Google Scholar
  35. 35.
    N.J. Nilsson, Artificial Intelligence, A New Synthesis (Morgan Kaufmann Publishers, San Francisco, 1998)zbMATHGoogle Scholar
  36. 36.
    A. Champandard, Behavior trees for Next-Gen game AI, in Game Developers Conference. Audio Lecture (2007)Google Scholar
  37. 37.
    M. Nicolau, I. Dempsey, Introducing grammar based extensions for grammatical evolution, in IEEE Congress on Evolutionary Computation (2006), pp. 2663–2670Google Scholar
  38. 38.
    M. Nicolau, D. Costelloe, Using grammatical evolution to parameterise interactive 3D image generation, in EvoApplications 2011. Lecture Notes in Computer Science, vol. 6625 (Springer, Berlin, 2011), pp. 374–383Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.School of Electronic Engineering and Computer ScienceQueen Mary University of LondonLondonUK
  2. 2.Natural Computing Research and Applications GroupUniversity College DublinDublinIreland

Personalised recommendations