1 of 15

Lab 5 – LLMize

Procedural Content Generation for Computer Games

Vojtěch Černý

cerny@gamedev.cuni.cz

2 of 15

Prerequisites

  • Previous HWs

3 of 15

The Task

Enhance one of your creations so far with LLMs!

​

It has to affect gameplay (!)

​

Attempt solving one of the big issues ☺

4 of 15

Codebase

Start with any of your previous HWs...

​

The most designed for are murder_mystery and roguelike

​

Both of the repos got an „llm“ branch

  • You can rebase your solution on top of it
  • (or just copy the last commit there)

​

5 of 15

Google Gemini

We‘re going to be utilizing Gemini models?

​

Why?

  • Probably the best free option right now
  • Watch out that your data may be used for LLM training

​

For Gemini-3.1-flash-lite (pretty small model, but useful)

  • 15 requests per minute / 500 requests per day

(enough for some tasks, for some might need to split work to multiple days)

Gemma 4 is also decent, two variants, each get another 1500 requests/day

​

Gemini-3.5-flash (decent model all around, came out 2 days ago)

  • 5 requests per minute / 20 requests per day

(can do final test in)

6 of 15

Google Gemini - technical

Need an API key (for free):

  • https://aistudio.google.com – get API key

​

For Python:

.env

GEMINI_API_KEY=xxxx

​

For Kotlin:

local.settings

GOOGLE_API_KEY=xxxx

7 of 15

Watch out for repetitions

LLMs want to repeat themselves

​

Why? LLMs are predicting text.

What text is likely to follow? The one that has already followed!

​

Beware of this when you want the llm to feel original or have choice...

​

This sneaks up when you don‘t expect it.

e.g. NPC chooses to be joking/serious for a question based on circumstance

​

But because he was joking on the question before (and it‘s in the context)

He will most likely be joking again... And again...

8 of 15

Watch out for not enough variability

LLMs want to repeat themselves

​

Why? LLMs are predicting text.

What text is likely to follow? The one that has already followed!

​

Beware of this when you want the llm to feel original or have choice...

​

This sneaks up when you don‘t expect it.

e.g. NPC chooses to be joking/serious for a question based on circumstance

​

But because he was joking on the question before (and it‘s in the context)

He will most likely be joking again... And again...

9 of 15

Options (for inspiration)

  • For roguelike:
    • Talking NPCs
    • LLM generating a high-level concept/story of the levels
    • Combat by describing player‘s actions
    • LLM generated effects in game (combining building blocks?)
    • ...
  • For murder_mystery:
    • Talking to NPCs directly
    • LLM coming up with details of the puzzle
    • LLM adding new rules for each game
    • ...

​

​

​

10 of 15

Options (for inspiration)

  • For mario:
    • LLM thinking like a designer and adding „intent“ into the level
    • ...

​

  • For minecraft:
    • LLM designing objects that get spawned in biomes
    • ...

11 of 15

Big issues to solve

  • LLM letting the player do anything they want
  • Characters saying out-of-place things
  • Consistency across time
  • Drifting away from design
  • LLM design and content are not in-sync
  • Multiple people sounding different each time
  • Characters being bad at lying
  • ...?

​

​

​

12 of 15

Criteria

  • LLM enhancement of one of your HW – 1pt
  • Has effect on gameplay – 1pt
    • (meaning it‘s not just a „new“ UI for the game, like NPCs just chatting)
  • Solving one of the big issues – 1pt

​

​

​

13 of 15

Submission details

  • Submit via this form
  • Submit:
    • link to your fork of the project (or zipped)
      • Don’t forget to have comments in your code!
    • 3 screenshots
    • describe your approach
    • describe what you have tried, what worked or didn’t, the problems you faced
    • how much time you spent with the project (will not be part of evaluation)
  • Deadline is 10.6.2026
    • If you need more time, talk/write to me before the deadline

14 of 15

Questions / Problems

  • You can always e-mail me at cerny@gamedev.cuni.cz
  • I’m also frequently online at Discord https://discord.gg/4nfAzG

15 of 15

Q & A

Vojtěch Černý

cerny@gamedev.cuni.cz