How it works...

We used the N-Gram predictor developed in Chapter 8, Learning Techniques, as a base for the level predictor in this recipe. This allowed us to focus on the high-level logic and let the predictor do its work.

We have an initial pattern from a level comprised of prefabs that have attached the LevelSlice component. Then, we use that pattern to create a new level with a similar style, and of the same size as the previous one.

It's important to put a unique identifier on each prefab for the recipe to work.

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.