WhoBuilt

Using AI to Build an Infinite Game

Feb 1, 2024· 11 min· 1.0K views·Watch on YouTube

Speaker

Jeff Schomay presents an AI-generated exploration game at AI Engineer, explaining how he built its scenes, images, and content pipeline.

A game built for endless exploration

Schomay describes a forest exploration game where players move through scenes and manage vigor and courage while trying to find home. The original game had 16 scenes in a 4-by-4 grid, so he wanted new scenes generated for each playthrough.

Fine-tuning for reliable scenes

Scenes are defined as JSON, including their initial description, what changes on return, and their effects on player stats. After prompt engineering with OpenAI’s completion endpoint, Schomay fine-tuned a model on 50 examples; he says the process cost about one or two dollars and produced valid JSON with a shorter prompt.

Training a consistent image style

Schomay used Leonardo to generate images and train custom image models. He had to balance consistent forest setting, perspective, scale, tone, and texture with variety across scenes featuring people, animals, buildings, or no characters. After trying different training sets and parameters, he found a model that produced cohesive but distinct images.

Connecting generation to the game

An asset server requests a scene from the custom OpenAI model, validates its JSON, sends the description to Leonardo, and returns the scene and image. Since generation could take 10 to 30 seconds, Schomay cached prefabricated scenes and replenished the supply when it fell below a threshold.

Playing and extending the idea

In the demo, vigor affects movement speed and courage affects the viewport size. Generated encounters can restore vigor or reduce courage, and scenes are intended to change with each playthrough. Schomay suggests adding image upscaling or letting players choose themes, with time of day or local weather as possible inputs.

Takeaways

  • Use examples in fine-tuning data to teach output structure when you want shorter prompts.
  • For a custom image style, keep setting and composition consistent while varying the scene content.
  • Validate generated structured data before passing it to the next step in a pipeline.
  • Hide slow generation behind a cache and replenish it before players run out of ready content.
  • Treat higher image resolution as a latency trade-off in an interactive experience.

Mentioned in this talk

Search inside this talk

What was claimed 6

Related talks