With Loren Sherman
This is the first in a three-part series on Engineering Peridot.
In a world filled with endless possibilities, where creativity and uniqueness reign supreme, the Peridots have arrived! From the moment we embarked on this journey, we knew that bringing these creatures to life would be no easy feat. Our team of engineers and designers faced the daunting challenge of crafting a generative system that would bring forth a limitless array of one-of-a-kind Peridots. Thus the revolutionary “Perigenetics System” was born. Join us on this exciting journey as we delve into the world of Peridot and explore the innovative technology that brings these creatures to life.
Peridot is Niantic’s new and adorable AI-powered real-world adventure pet game. The groundbreaking and entirely novel pet simulation game stands out with its unique generative system known as the Perigenetics System. Players, which are called “keepers”, care for one-of-a-kind creatures called “Dots” and their journey in exploring the world together while raising them to adulthood. But what makes these Dots truly special is the way they are generated. Similar to real animals, each Dot has a set of unique “genes” that determine its appearance, and the game’s various generation algorithms use these genes as input. In this blog post, we will take a closer look at the engineering behind the Perigenetics System that makes each player’s Dot absolutely unique and special.
To generate the unique Dots in the game, we employ a combination of techniques that involve 3D artists’ skills and algorithms. The process begins with a set of “base models” for the adult, teenage, and baby Dots created by the 3D artists. From there, the Perigenetics System applies different algorithms to generate textures, materials, plumage, horns, and even reshape the ears. Each Dot’s unique genes determine which algorithms are used to generate its appearance. For example, blend shapes are used for the ears, iterative extrusion for the horns, and cellular automata for some patterns. Although none of these algorithms are as advanced as the game’s AR technology, they work together to create a special experience for players.
Designing the Perigenetics System
Designing the Perigenetics System in Peridot was an intricate process that required careful consideration of various parameters. We worked closely with our concept artists to create a selection of hypothetical Dots that we wanted the system to generate.
Then we analyzed those Dots: how were they different? How could we represent their unique elements as parameters in an algorithm? What else could we create using combinations of those parameters? We divided the Peridot “genome” into eight chromosomes, each with its own data structure, including pattern, color, face, ears, horns, material, plumage, and tail. In selecting parameters for each chromosome, we had to balance variety and visual style, ensuring that there were enough different-looking Dots while still being able to curate the genes in a more controlled way.
This led to the creation of tags, which are ranges of genetic numbers that produce a specific look. For instance, the “rabbit ears” tag says that the “earLength” number must be between 0.1 and 0.6, and the “earFlattenTip” number must be between -0.2 and 0, and so on for all 24 numbers in the ear chromosome. We’ve added a variety of tags for each chromosome, such as “glassy material” or “goat horns.” Because tags are ranges and not values, two Dots with the same selection of tags can look very different! These tags enable the system to generate unique Dots that are incredibly diverse resulting in a vast array of possibilities for players.
Although some Dots’ patterns are artist-created and adjusted by code, some are generated entirely from scratch using cellular automata. This is a type of algorithm that uses a grid of “cells” to generate patterns for some of the Dots. Each “cell” has a color, and with each step of the algorithm, a cell’s color changes based on the color of its neighbors. In this case, those cells are the pixels of the Dot’s pattern. Our team uses a type of cellular automaton called Reaction-Diffusion, which simulates chemical reactions and is a good approximation of how some real animals develop their patterns. Conway’s Game of Life is the most famous cellular automaton, but Reaction-Diffusion produces more realistic patterns. By adjusting the numbers fed into the algorithm, the system can generate patterns like “giraffe” or “tropical fish” or “Spotted” or even weirder patterns like “circuit” or “maze.” And because the patterns are being generated from code, we can make every Dot’s pattern truly unique: even two similar-looking “giraffe” patterns will be different, just like human fingerprints.
Examples of possible patterns the system could generate
Finding the right balance between allowing for chaos and diversity while also maintaining control was challenging. The team started with narrow ranges for more curation and control and gradually broadened them as they discovered new and interesting combinations. We are also designing ways for higher-level Keepers to push past the boundaries set by tags, giving them even more creative control over the game.
“With roughly 2.3 x 10^24 possible Dot combinations, which is around the number of stars in the universe, or grains of sand on all the earth’s beaches, we have created a generative system that is both exciting and seemingly endless.”
In developing the generative system for Peridot, we encountered a challenging decision point: how wide should the permissive ranges be for generating new Dots? On the one hand, setting wide ranges allows for greater diversity and the potential for unexpected, chaotic combinations. On the other hand, narrower ranges provide more control and curation over the generated Dots. After much consideration, we decided on a compromise: starting with narrower ranges and gradually expanding them as we and our players discover new and interesting combinations. With roughly 2.3 x 10^24 possible Dot combinations, which is around the number of stars in the universe, or grains of sand on all the earth’s beaches, we have created a generative system that is both exciting and seemingly endless.
Implementation of the Perigenetics System in the game
The Perigenetics system used in Peridot has a lot of different possible outputs, which makes it impossible to account for all of them when working with other systems. At one point, the Dot was able to have different body types, for example corgi vs. greyhound, but this made some of our animations look unnatural. To avoid this, we decided to keep all the Dots with the same basic proportions.
The structure of the Dot genome plays a critical role in the reproduction process. Every time a new Dot is generated, it chooses a random tag for each chromosome and then chooses random values within that tag. When two Dots reproduce, the baby Dot gets a random gene for each chromosome from one of its parents. This system is incredibly efficient in terms of storage since we don’t need to save the Dot’s textures or 3D models. Instead, we only need to save its genome, and then we can use that information to generate everything when the game needs it.
However, generating all these Dots from scratch requires a significant amount of computation. Every time a player looks at a new Dot, the game needs to generate everything about it from scratch, which requires optimization to make the generation process take only about a second on a mobile device without impacting the frame rate. The cellular automata system used in the game is one of the most significant performance considerations. To make the process more efficient, we simulate the cellular automata on a tiny texture that is then up-scaled in the final step. Additionally, we do the whole thing on the GPU, which is incredibly efficient at simulating cellular automata.
“This system is incredibly efficient in terms of storage since we don’t need to save the Dot’s textures or 3D models. Instead, we only need to save its genome, and then we can use that information to generate everything when the game needs it.”
The generative system used in Peridot is both efficient in terms of storage and complex in terms of computation. While the Dot genome informs the breeding process, generating new Dots from scratch requires significant optimization to ensure that the game runs smoothly on mobile devices.
The Future of the Generative System
The generative system used in Peridot has proven to be a powerful tool for creating a vast array of unique Dots. As we look to the future, we’re excited to continue expanding the system and exploring new genetic features. In particular, we’re working on re-introducing different body types that can be used to create more diverse and interesting Dots. We’re also exploring the use of detailed alpha-masked plumage that incorporates custom designs, giving players the ability to create Dots with unique features like ferns, fins, or butterfly wings. With these new features and continued optimization, we’re confident that Peridot will continue to push the boundaries of what’s possible in the world of mobile gaming.
Loren Sherman
Loren is a Senior Technical Artist working on Peridot. Their core responsibility is the procedural systems that generate the Dots’ unique appearance.