7 mart 2025: Neural Networks Generate a Game Map. Part 1

Creating a game map is a labor-intensive process, even if you have an editor.
Personally, I often lack the creativity for it.
So why not use AI for this?
If LLMs can discover new cancer treatments, surely generating the interior of a house isn't that difficult for them?

Previous Experience

A year ago, things were terrible!
I had already tried generating a house layout before. For the game TrappedTogether, I wrote a level editor that generates a JSON file containing objects such as walls, roofs, furniture, and interior details—along with their coordinates. Unity then loads and places them accordingly.
About a year ago, when OpenAI's flagship model GPT-4o had just been released, I fed it a couple of houses I had created and asked it to generate something similar. The result was disastrous: random objects with incorrect orientations.

A New Model and New Knowledge

Before talking about generating houses, I need to explain which models I use and why. This is important because the outcome depends on it.

A Side Note: My Disappointment with OpenAI’s New Flagship "Thinking" Model

Since then, so-called "thinking" models have emerged. Why not give them a try?
I have a side project called LetTheTinCanDoIt (website, GitHub), which helps me with programming. It uses OpenAI's paid API, allowing me to attach multiple files to a request. The program then parses and saves corrections received in the response, making coding much more convenient.
I had been using GPT-4o for a long time, and it generally helped me save time.
When o1 was released, I was excited—thinking I wouldn’t need to describe my requests in such detail anymore and that the model would produce error-free, well-validated code.

But no… I didn’t notice a big difference. o1 often produced the same nonsense as GPT-4o.
Worse still, it was insanely expensive! LetTheTinCanDoIt sends entire files, and if they’re large, that means a ton of tokens.
In just 2-3 requests, it could easily cost me over €10!
And it wasn’t like I was getting a perfectly working solution in return. No, for those €10, it often produced complete garbage.
(That said, I still use GPT-4o from time to time—it saves me a lot of effort.)

To be fair, newer models like GPT-4.5, o1-mini, and o3-mini have been released, but I haven’t compared them yet.

The Hype Around DeepSeek

Recently, DeepSeek was introduced, and many rushed to test it—I was no exception.
I integrated DeepSeek’s API into LetTheTinCanDoIt and occasionally ask it to generate code.
The non-"thinking" model deepseek-chat is much worse than GPT-4o, but the "thinking" model deepseek-reasoner is quite good.
And since its pricing is similar to GPT-4o, it’s practical to use without draining your balance in 10 minutes.

House Generation: A New Approach

Last time, I simply asked the model to generate something "similar," which was a mistake. The model doesn’t really understand what "similar" means or exactly what I need.

So this time, I approached it in two stages:

  1. First, I asked the model to write a prompt for another model—describing in words what needs to be done. The prompt was based on the JSON representation of a house I provided.
  2. Then, I gave the second model only the prompt—without the original JSON—so that it would generate a house based purely on a clear, human-readable description.

I borrowed this approach from research tasks that involve multiple AI agents, each specializing in a specific task.

Results

The First Network Generates a Prompt

Here’s the prompt the first model created:

Generate a Unity-compatible house JSON structure adhering to these rules:
    Exterior Structure:
        Perimeter walls form a closed 6x6 grid. Use Corner models at (0,0), (5,0), (0,5), (5,5) with rotations (0, 90, 270, 180) respectively.
        Fill remaining perimeter edges with Wall models. Use Window models on exterior walls (avoid corners) with rotations matching wall direction.
    Doors:
        At least 1 exterior Door (rotation 270 or 90) on the perimeter.
        Use DoorInternal and WallInternal to divide rooms (e.g., at y=2 or x=3).
    Floors:
        Every (x,y) coordinate under walkable areas (non-wall) must have a Floor model at z=0.
    Furniture:
        Place Bed2p against walls in bedrooms.
        Group kitchen items (SinkOven, Fridge, Counter) in one area.
        Add Sofa, TableChairs, and Light models in living areas.
        Ensure no overlap: Each (x,y,z) must have only one object.
    Roof:
        Add PitchedRoofHalf/FlatRoofHalf at z=2 above walls. Match rotations to wall directions (e.g., PitchedRoofHalf rotated 0 above a north-facing wall).

    Lighting:
        Place Light models near furniture (e.g., above tables, in room centers).
    Validation:
        All tiles must be filled (use Empty for unused z=0 spaces outside the house).
        Ensure JSON includes width and height as 6.

Output only the JSON, no explanations.

Example Output Structure (truncated for brevity):
{  
  "version": 1,  
  "squares": [  
    {  
      "rotation": "0",  
      "model": "Corner",  
      "x": 0,  
      "y": 0,  
      "z": 0,  
      "w": 1,  
      "h": 1,  
      "id": "..."  
    },  
    // Additional objects...  
  ],  
  "width": 6,  
  "height": 6  
}  

Internal Thoughts
Yes, I used DeepSeek, and its internal reasoning absolutely fascinated me!

DeepSeek map generation internal thinking
It’s simply amazing.

The Second Network Generates a House

The second model produced a result, which I loaded into the editor.

LLM generated house for a game. First try
Surprisingly, it generated a coherent house—with an entrance door and four walls.

Sure, the door was blocked by furniture, there were two holes in the bedroom wall, and the fridge was standing in the middle of the room—not exactly ideal.
But don’t forget, this was just the first attempt! The prompt can always be improved.

There’s probably a limit to what AI can do.
I’m skeptical that a neural network can create a fully functional house interior the way a human level designer would.
But it’s fascinating to explore these limits and see how different models handle the task.

Read the continuation in the next article!
Next, I will try to improve the prompt to achieve the generation of a proper house.

I also really want to compare different models, including the flagship GPT-4.5 and o3-mini.

Add comment