Devlog 1: Introduction to Procedural Content
Project Outline
This project focuses on the practical implementation of Procedural Content Generation (PCG) algorithms in the context of game development. PCG is widely used to create scalable and dynamic game environments, enhancing replayability and reducing the need for manual asset creation. The project will explore the design and implementation of a PCG system, showcasing how these algorithms can be used to generate engaging and diverse game content.
The blog will cover key aspects of the project, including research into existing PCG algorithms, the rationale behind algorithm selection, and the practical steps involved in integrating the system into a game engine.
This week was focused on a general introduction to procedural generation algorithms and it’s application in the context of game development. As part of this, research was conducted into types of PCG and how they’re used in games to generate dynamic content. Three examples of PCG in video games are:
- Levels
“Often 2D games will use procedural generation algorithms to generate levels in their games.” (Kenny 2021). This is most frequently used in rogue-likes so each new ‘run’ feels new.
- Loot
Quest-based games may use PCG for loot systems so that ingame equipment is based on the player’s current level. (Kenny 2021) A good example of this is the game Neverwinter Nights, as loot is generated upon opening a chest and is always the same level as the player at that time.
- Animation
Procedural animation is used in a wide variety of games in the form of inverse kinematics. This can be used to help animations flow smoothly (Kenny 2021) and to make character appear more natural in their movement, such as having their foot placement change dynamically based on the elevation of the ground they’re standing on.
As a more in depth example of PCG in video games, a case study was conducted on the game Spelunky. Spelunky uses PCG in it’s level generation by having several premade rooms that fall into four different categories:
-
0: a side room that is not on the solution path (Kazemi n.d.)
-
1: a room that is guarnteed to have a left exit and a right exit (Kazemi n.d.)
-
2: a room that is guaranteed to have exits on the left, right, and bottome. If there’s another “2” room above it, then it also is guaranteed a top exit (Kazemi, D. n.d.)
-
3: a room that is guaranteed to have exits on the left, right, and top (Kazemi n.d.)
Below is an image generated using a tool that generates levels in the same way it is generated in Spelunky, along with the solution path shown in red.
Next, a very basic implementation of a PCG was made. By making use of Random.Range within the Random class in Unity (Unity, n.d.), code was written to randomly spawn objects above a plane at varying positions in each axis.
Reference List
Kenny. (2021). Procedural Generation: An Overview [online]. Available from: https://kentpawson123.medium.com/procedural-generation-an-overview-1b054a0f8d41 [accessed 25 September 2024].
Kazemi, D. (n.d). Spelunky Generator Lessons Part 1: Generating the Solution Path [online]. Available from: https://tinysubversions.com/spelunkyGen/ [accessed 25 September 2024].
Unity. (n.d). Random.Range (Unity API) [online]. Available from: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Random.Range.html [accessed 25 September 2024].
Zoltikrys (2024) MyFirstPGC. GitHub [online]. Available from: https://github.com/Zoltikrys/MyFirstPGC [Accessed: 25 September 2024].