Create photorealistic images of your products in any environment without expensive photo shoots! (Get started for free)

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - Fooling the Neural Net

When training a generative adversarial network (GAN) to create new Angry Birds levels, one of the first challenges is fooling the discriminator network. The discriminator is responsible for determining whether a level is real or artificially generated. Initially, the GAN produces levels that are clearly distinguishable from human-designed levels. The key is getting the GAN to generate more realistic levels that can fool the discriminator.

Researchers have found that training the GAN in a curriculum learning approach improves realism. They first train it on simple levels with just a few birds and obstacles. Once it masters those, they move on to more complex levels with multiple birds, terrain variations, and obstacles. This incremental approach allows the GAN to slowly learn the features that make Angry Birds levels believable.

Another technique is to train the discriminator on both real and artificially generated levels simultaneously. This prevents it from overfitting on the training data. The constant competition forces the generator to output higher quality levels. Researchers have also experimented with training an ensemble of discriminators rather than just one. This makes it even harder for the GAN to trick all of them.

While randomness helps the GAN explore the level space, too much hurts the playability. Researchers constrain the GAN's outputs to maintain basic level design principles. For example, they require a minimum distance between pigs and birds to allow for an initial trajectory. The level also needs an open area for the birds to first travel through. Adding constraints and curricula guides the GAN towards creating playable, human-like levels.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - Pixel Pig, Meet Pixel Bird

One of the most charming aspects of Angry Birds is its cartoony pixel art aesthetic. The birds and pigs have simple but expressive designs that are instantly recognizable. When training a GAN to generate new Angry Birds levels, it must learn to render these characters and objects in the signature style.

Researchers initialize the GAN using a large dataset of screenshots from existing Angry Birds levels. These images contain thousands of examples of pixelated birds, pigs, terrain, and obstacles. As the GAN trains on this data, it learns to mimic the pixelation, colors, and designs.

However, directly copying the source material results in a lack of variety. The GAN simply produces more of the same birds and pigs. To encourage novelty, researchers augment the training data. They apply random rotations, scaling, and elastic deformations to the images. This forces the GAN to generalize rather than memorize.

Once trained, the GAN creates new pixel art for each level it generates. While noticeably stylized, the results capture the charm of the original artwork. The pigs and terrain may be procedurally generated, but they have a hand-crafted feel. Researcher Katja Hofmann at Microsoft Research says “The little pigs still look cute even though they don’t look like the original ones.”

There are still limitations, however. The GAN sometimes struggles with spatial consistency. A pig may detach and float in the air instead of sitting on a platform. Or a bird could warp and deform between frames of animation. Cleaning up these artifacts requires some human input.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - GANs Get Creative

One of the most exciting aspects of training GANs to generate Angry Birds levels is seeing what creative designs they come up with. While the GAN learns from existing levels, it isn’t merely copying them—it’s synthesizing new ideas. This creativity arises from the constant competition between the generator and discriminator. As researcher Sebastian Risi puts it, “The generator is basically asked to come up with something creative that can fool the discriminator.” This adversarial “creativity contest” pushes the GAN to explore the full space of possibilities.

Researchers are often surprised and delighted by the new level elements produced. Katja Hofmann shares an example where the GAN created an unusual structure resembling a “pig corral.” Multiple pigs were enclosed together in a U-shaped terrain. This novel configuration provided an intriguing gameplay scenario not seen before. Another time, the GAN generated a level with pigs placed precariously on narrow ledges and towers of blocks. Reaching them required carefully aimed bird trajectories accounting for gravity and inertia. Players would be challenged to solve this physical puzzle.

Of course, not every GAN creation is a hit. Researchers occasionally see levels that are too difficult, confusing, or even impossible to complete. The key is curating the highlights and iterating on the designs. Katja explains how they pick out the most interesting levels and replay them to understand what’s fun. They can then tweak the GAN's architecture and training process to produce more of those promising concepts. This feedback loop allows them to guide the GAN’s creativity toward inventive yet playable levels.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - Teaching the Machine to Design

Teaching a machine to design creative content like Angry Birds levels presents unique challenges compared to other generative AI tasks. While deep learning excels at pattern recognition, mimicking human creativity requires higher-level reasoning. Researchers must figure out how to translate intuitive design concepts into a formal system. This involves deciding what knowledge to provide to the AI and how to represent it.

Katja Hofmann’s team at Microsoft Research spent significant time trying to define Angry Birds level design principles. They identified key gameplay elements like shot difficulty, optimal pig placement, and level pacing. The researchers then faced the challenge of encoding this knowledge so their GAN could learn it. They experimented with conditional training, where auxiliary information is provided in addition to the level images. For example, they added gameplay tags indicating the number of birds or the trajectory shapes needed. This allowed the GAN to associate certain design patterns with specific mechanics.

Researchers also developed a functional scaffolding approach. They generated simple level templates with placeholder entities like “bird start,” “pig,” and “trajectory.” The GAN could then focus on learning spatial relationships and arrangements rather than raw pixel generation. According to Hofmann, this decomposition of the task was essential for the GAN to produce coherent, playable levels.

Of course, the researchers couldn’t possibly specify every design criteria manually. To allow for open-ended creativity, part of the GAN training involved unsupervised learning directly from level screenshots. This less constrained phase helped generate novel ideas within the overall structure. Balancing explicit design knowledge with unguided exploration was key to teaching nuanced creative skills.

Procedural level generation specialist Noor Shaker has also explored ways to impart design principles to AI. In one experiment, his team simulated a fictional player to critique generated levels. The “AI game designer” then updated its models based on this feedback. Over time, it learned associations between design choices and player enjoyment. This allowed it to internalize abstract qualities like challenge, surprise, and pacing.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - No Birds Were Harmed in the Making of This Model

When developing AI systems like GANs, it is important to consider the data used for training. For Angry Birds, the source material is virtual rather than physical. The pigs and birds exist only as pixels on a screen. However, this does not mean training occurs in an ethical vacuum. While no actual birds were harmed to make the Angry Birds GAN, the data has an impact on what the model learns.

Researchers must audit datasets for potential issues before using them for AI training. With Angry Birds, the source levels come from the game designers at Rovio Entertainment. But even professionally created content can reflect social biases and problematic themes. For example, the pigs in Angry Birds are often portrayed as dim-witted foils for the vengeful birds. Frequent violence against them could promote harmful assumptions.

Katja Hofmann's team was cognizant about setting good examples while training their GAN. They filtered the level dataset to remove potentially insensitive material. According to Hofmann, "We were careful so it doesn't learn undesirable things." This curation ensured the model learned only ethical game design principles.

However, balancing creative freedom and ethical AI remains an ongoing research problem. OpenAI recently released a text-generating bot called GPT-3 which infamously produced racist and offensive content. The researchers quickly restricted its training data, but harmful artifacts still occasionally emerge. The bot inherits unpredictable biases from its billions of web parameters.

For procedurally generated content like Angry Birds levels, the risks extend beyond just language models. If the GAN learns to associate certain level elements with difficulty or rewards, it may unintentionally create ableist and exclusionary gameplay. Katja Hofmann's team acknowledges they cannot prevent all problematic generation, saying "We can't guarantee the GAN will never create an offensive level."

Striking the right balance involves transparency, ethics review processes, and user studies. Researchers should document exactly how models are trained and publish results openly. Having external auditors and diverse focus groups play GAN-generated levels helps reveal potentially harmful implications that engineers may have overlooked.

AI designers also suggest collaborating directly with affected groups as co-creators. Activists and advocates can guide the training process so models respect a wider range of perspectives. This human-AI partnership helps the GAN learn values as well as mechanics. It ensures no one is left out of the design process or marginalized by the final results.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - Exploring the Possibilities of Procedural Generation

Procedural generation opens up exciting new possibilities for game designers and creators. By using algorithms to automatically construct content, developers can create worlds that are endlessly unique and engaging. For Angry Birds specifically, procedural generation allows for an unlimited number of fresh, original levels. Players will never run out of new challenges to master. This extends the game's longevity far beyond what human designers could produce manually.

Researchers like Katja Hofmann are drawn to explore procedural generation because it pushes the creative limits of what’s possible. Hofmann shares that "We as designers can come up with maybe 100 levels, but procedural generation allows you to create a million Angry Birds levels." With a GAN continuously outputting new levels, players could enjoy years of novel gameplay.

Procedural generation also enables designers to experiment with radically different level elements. The pigs could be given wings to fly around obstacles. Birds might need to wield cartoon bombs and dynamite to demolish stronger structures. Entirely new characters like wolf or clown enemies could be introduced. By recombining and randomizing gameplay ingredients, the possibilities are endless.

However, realizing these possibilities requires overcoming significant technical hurdles. Teaching an AI system to design levels that are purposeful yet unpredictable is very difficult. Michael Cook, creator of the game ANGELINA, says "The biggest challenge is holding on to your vision for what makes games meaningful while allowing space for the unpredictability that makes games magical." The question for researchers is how much control to exert versus how much freedom to allow.

Striking the ideal balance involves artist-AI collaboration. Hofmann has human designers filter the GAN’s creations and iteratively improve the model. She says "You want the human to be in the loop to guide the content generation." With the GAN handling the grunt work, developers are free to focus on high-level creative direction. This partnership results in innovative levels that still embody the soul of Angry Birds.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - The Future of Level Design?

Procedural level generation through AI promises to revolutionize game design, but some worry it could minimize the human element. While algorithms can rapidly produce endless content, is something lost when levels lack intentional craft? Can AI truly recreate the artistry and meaning that connects players to worlds?

Developers like Robin Hunicke emphasize the importance of hand-authored experiences, saying “Procedurally generated content lacks the distinctive signature of a human designer.” Her company Funomena focuses on hand-sculpted levels to ensure emotional resonance.

Others argue procedural creation frees designers to focus on the big picture. Jake Elliott of Cardboard Computer explains “The human becomes curator rather than sole creator.” By handling lower-level construction, AI systems let developers shape the overall world and experiences.

Striking the right balance is key for many. Steve Swink of Steel Crate Games combines procedural elements with tightly designed scenarios in their games. “We use algorithms to create a possibility space for us to then author tight, highly-authored narrative moments.” This provides the benefits of both approaches.

Some envision future teams of AI and humans working together. AI researcher Gillian Smith describes “mixed-initiative level design tools that seamlessly blend human and machine creativity.” The AI could propose themes, layouts, and quests for the designer to refine or reject. This collaborative ideation would enhance innovation.

Procedural methods may be especially helpful for massive open worlds. No Man’s Sky developer Sean Murray explains “You can't possibly design 18 quintillion planets by hand.” Their algorithms construct fully explorable galaxies.

Other studios like Ubisoft are more cautious, only using procedural elements to populate predefined worlds. AI R&D analyst Ahmed Khalifa explains “100% procedurally generated worlds often lack handcrafted appeal.” They prefer blending algorithmic with scripted content.

Flying Pigs and Green Bombs: Training GANs to Generate Angry Birds Levels - Balancing Difficulty and Fun Through AI

One of the toughest challenges in game design is balancing difficulty and fun. Levels that are too easy quickly become boring, while those that are frustratingly hard fail to engage players. For procedurally generated content like Angry Birds, getting this balance right is especially tricky. With infinite permutations possible, how can developers ensure AI-created levels remain playable and enjoyable?

Researchers have explored various methods to address this. One technique is training AI agents to play generated levels and provide automated feedback. Katja Hofmann’s team at Microsoft Research developed an AI player called AIBIRDS that rated levels on challenge, memorability, and uncertainty. The generator model learned from this critique to avoid repetitive or overly hard designs.

At the University of California Santa Cruz, professor Michael Mateas takes a data-driven approach. His team built the Game-O-Matic system which creates arcade-style games using what Mateas calls “chunk-based generation.” It recombines bits of existing games into new arrangements. But rather than generating randomly, Game-O-Matic makes probabilistic models based on player data. If certain enemy patterns or level chunks prove too difficult in playtesting, it lowers their likelihood of reuse. This incremental feedback cycle helps steer the generator toward the sweet spot of engaging challenge.

Some researchers train AI via reinforcement learning models like Deep Q-Networks. Algorithm “agents” play through procedurally generated levels, earning rewards for solving puzzles and progressing farther. The generator then tweaks its parameters to produce levels which maximize the agent’s earned rewards. Since the agents are incentivized to take efficient paths to level goals, this nudges the generator toward appropriately challenging designs. Researchers can also shape rewards to encourage exploration, gathering items, or other desirable player behaviors.

Of course, challenges still exist in defining exactly what constitutes “fun” for reinforcement learning. Reward functions designed by human researchers inevitably embed their own biases and preferences. Striking the right balance requires carefully considering which actions should be incentivized and how diverse player experiences are supported.

Open-ended evolution methods are another promising AI technique. Researchers like Sebastian Risi at IT University of Copenhagen apply genetic algorithms which mutate and crossover level elements over generations. Player feedback informs selection of the fittest designs. Risi explains “You’re really doing crowdsourced game design. The players’ reactions are driving the evolution.” This collaborative approach helps identify levels that different players find fun based on their skills and playstyles.



Create photorealistic images of your products in any environment without expensive photo shoots! (Get started for free)



More Posts from lionvaplus.com: