Bill MacKenty

  Home     Computing     Teaching     Bushcraft     Games     Writing     About  

Procedural generation as a teaching approach

Posted in Computer Science Teaching Diary on 17 - November 2022 at 05:09 AM (about 2 years ago). 563 views.

In computing, procedural generation is a method of creating data algorithmically as opposed to manually, typically through a combination of human-generated assets and algorithms coupled with computer-generated randomness and processing power (ref).

The amazing thing about procedural generation is that infinite unique possibilities can be created with little work from humans (ref). I've been interested in procedural for a few years, and would encourage you to take a peek at the following resources to learn about procedural generation: 

  1. This is an excellent introductory article
  2.  Dwarf Fortress (an incredibly complex game that is largely procedurally generated)
  3.  No Man's Sky (this a wiki article describing how procedural generation works)

What is cool about procedural generation is how easy it is to start with procedural generation.  In the example code below, we can get the following output: 

  1. Discovered in the small village of Tr'lor
  2. Hatched in the ocean of Greenest
  3. Born in the small village of Mirkwood

# procedural generator to write a brief history
import random

origin_1 = ["Born", "Hatched", "Invoked", "Discovered"]
origin_2 = ["in the land of", "in the wilds of", "in the forest of", "in the ocean of", "in the small village of", "in the modest hamlet of"]
origin_3 = ["Tr'lor", "Kor'mer", "Kobiyashi", "Greenest", "Mordora", "Gondor'e", "Rivendell", "Mirkwood"]

story_part_1 = random.choice (origin_1) + " " + random.choice(origin_2) + " " + random.choice(origin_3)
print(story_part_1)

I have some students working at high levels of complexity and other students working with more basic levels, as seen above. But for all of them, this is a fun approach to deconstructing a complex system, identifying the patterns within the system, and introducing the correct randomness to the system to make it unique. 

Procedural generation gets us close to modeling and simulation where a student must understand a system in order to create a model of it. In my opinion, modeling and simulation is close to the the very best learning we can get

Procedural generation goes into the stratosphere when students apply machine learning to highly complex systems.