Using N-Grams for content generation

In Chapter 8, Learning Techniques, we learned how N-Grams is a probabilistic language model for predicting the next item in a sequence of n-1 elements, and how it can be applied in learning techniques for predicting player behavior. However, it can also be used for procedural content generation—creating new elements by imitating the style of a given set.

In this recipe, we will use the power of N-Grams for creating new levels from a given set, thus imitating the style of the designer.

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.