Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn...

70
Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building in the popular game Minecraft

Transcript of Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn...

Page 1: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 1: Pseudo Random Numbers

On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture

A player-created building in the popular game Minecraft

Page 2: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Some of Gearbox Software's Borderlands procedurally generated weapons each generated from asset modules

Random number noise signals – on the left is a random number pattern that does not repeat and on the right is a PRNpattern that repeats

2

Page 3: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A forest scene created with Unity Terrain Engine which uses PRNs

Unity launch screen

3

Page 4: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

4

Page 5: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Workflow to get the Canvas in Main Camera view

5

Page 6: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Finished canvas and text formatting

Hello World program's result

6

Page 7: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Hello World with PRNs Program Result

7

Page 8: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 2: Roguelike Games

Image of Rogue (1980) by Michael Toy and Glenn Wichman

Tile sprite sheet from the popular game, Pokemon, developed by Game Freak

8

Page 9: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Unity Technologies' 2D Roguelike—courtesy of Unity Technologies

Results of importing the package and clicking on play

9

Page 10: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Folder structure for the Roguelike project

10

Page 11: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 3: Generating an Endless World

This is what our Roguelike endless PCG Game Board will look like

11

Page 12: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Imagine the Game Board within a grid

12

Page 13: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Visualization of a 2D array

13

Page 14: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Visualization of a linked list

Visualization of a dictionary/map

14

Page 15: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The initial Game Board grid with the player

The line of sight grid squares are shaded

15

Page 16: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Revealing more tiles as the player moves right

The tiles are iterated over to check whether they have already been discovered

16

Page 17: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The grid will correspond with the x-y plane

All our sprites are 32 x 32, which is 1 unit of measure

17

Page 18: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Import settings

The Camera 2D Follow settings screen

18

Page 19: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

No Game Board

19

Page 20: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The Layer settings

20

Page 21: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Initial Game Board

PCG Game Board

21

Page 22: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

PCG Game Board plus wall tiles

22

Page 23: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 4: Generating Random Dungeons

Image of final result of dungeon generator

23

Page 24: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the simple grid

24

Page 25: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the simplest essential path

25

Page 26: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the winding essential path

26

Page 27: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of random paths in blue

27

Page 28: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the chamber in red

28

Page 29: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Diagram of outer wall tiles in black

29

Page 30: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the outer wall tiles enclosing the dungeon in black

30

Page 31: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of possible starting points

31

Page 32: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of the placement of exit based on the path

32

Page 33: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of a path cycling back

33

Page 34: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A diagram of a queue

34

Page 35: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Diagram of essential path in queue

35

Page 36: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Image of exit tile sprite

An image of sorting layer order

36

Page 37: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

New options in the GameManager prefab

Image of dungeon overview

37

Page 38: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 5: Randomized Items

Food item setting

38

Page 39: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Health item appears when a wall is destroyed

Where to find and set health point

39

Page 40: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Imported sprite sheet settings

40

Page 41: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Sprite Editor

41

Page 42: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

A randomly spawned chest

42

Page 43: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

chest and item but no visible inventory

Picked up item shows in inventory

43

Page 44: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 6: Generating Modular Weapons

The final result of the modular weapon implementation

Weapon module sprites

44

Page 45: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Weapon modules in their respective bounding boxes

Measurements of a module

45

Page 46: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Pivot points for each type of module

Weapon Component's settings

46

Page 47: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The expanded Weapon prefab

Chest spawning a weapon

47

Page 48: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The weapon is unhidden and follows the player, while there is a blank image to the right

The sword is hidden and the icon to the right appears

48

Page 49: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Weapon animation

The player faces to the right and the sword swings to the right as well, while the wall on the left is damaged

49

Page 50: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The player can now face the left

The Player can swing the sword toward the left

50

Page 51: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 7: Adaptive Difficulty

Player among enemies!

Enemy Sprite

51

Page 52: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Enemy walking on black space

Enemies on world board

52

Page 53: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Enemies on Dungeon Board

Attacking an enemy

53

Page 54: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Diagram of simple enemy movement

Enemy stuck on wall

54

Page 55: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Player is 1 space away horizontally and 2 away vertically so enemy moves vertically

Enemy going around wall

55

Page 56: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Smarter enemy getting stuck on a wall after two attempts of picking the best path

56

Page 57: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 8: Generating Music

Visualization of tempo

57

Page 58: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Visualization of tempo divisions

58

Page 59: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Visualization of sound length variations

59

Page 60: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Visualization of the measure with sounds

Measure with sound division

60

Page 61: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Measure with random sound lengths

The interval in which sound is not played

61

Page 62: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 9: Generating a 3D Planet

A procedurally generated sphere

62

Page 63: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The 2D quad a sprite is drawn on to

3D cube made into a sphere

63

Page 64: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Sphere triangles splitting when moved

Procedurally generated sphere

64

Page 65: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Icosahedron sphere on the left and polar sphere on the right

Procedurally generated planet

65

Page 66: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

The first-person camera placement

The first-person view of the planet

66

Page 67: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

Chapter 10:

67

Page 68: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

68

Page 69: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

69

Page 70: Chapter 1: Pseudo Random Numbers · Chapter 1: Pseudo Random Numbers On the left is a hand-drawn texture, and on the right is a Procedurally Generated texture A player-created building

70