HFFWS Thesis: Clearly Determining Space for Scenarios and Creating Barriers Between Them

March 11, 2020

Spacing Scenarios and Dividing with Obstacles

Thesis Project

Space Buffering

In the process of creating a simplified version of this generation system, I narrowed down the variability for now with a core focus on better defining the space a scenario has to work with. To keep it easier to work with, it is focused on a single axis for the most part, the x-axis, in spacing. This ties in to making the general space easier to define as well.

The overall spacing is mostly determined by spacing on the x-axis. The entire sequence of scenarios is constrained to a single overall platform with a fixed width, so every scenario is working with that same fixed width as well. The height does not particularly need to be constrained at this time, so determining a general x and z dimension for the space with an arbitrarily given y dimension works to define our space well for now.

Finally, to help visualize this space in the editor, I looked to DrawGizmos methods within Unity. I am currently creating a yellow wireframe cube centered at each of these central scenario locations with dimensions based on the scenario spacing (x-axis), the scenario width (z-axis), and an arbitrarily large height (y-dimension), each of which is determined within the DemoManager.

Creating Obstacles to Sequence the Scenarios

We wanted to start looking into having the chain of scenarios play into each other, so the first concept to look into for that was creating significant obstacles at the “end” of each scenario that needed to be overcome to reach the next one. The idea for the simplest approach for this was to create a significantly tall wall that covered the entire width of the play area and was placed at the end of the scenario space (the end on the x-axis). Again, to simplify the approach, this was investigated solely with ramp scenarios for now.

Creating this wall originates with using the existing CreateObstacleTerrain class I created, which basically makes various rectangular-shaped obstacles. The scenarioWidth information is passed into this creation to ensure that the wall covers the full width of the play area. The scenario spacing information passed from the DemoManager helps with the placement of this wall at the end of the scenario.

The order of operations follows that the ramp is generated, and then the obstacle. With this, the ramp height is recorded and passed on to the wall to determine its height range. This ensures the wall is tall enough to provide a challenge, but not so tall that it can not be overcome.

Finally, to help position this obstacle even more accurately, it is actually repositioned after its parameters are determined. The systems chooses the wall obstacle’s dimensions from its available options, and then feeds this data into a method to finally place the wall. This helps adjust the position of the wall for its thickness especially when making sure it fits in the end of the scenario area without going into the next area.

Updating A* to Move Units in 3D for Elevations

March 11, 2020

Updating A*

Adding 3D Movement (Elevations)

A* Current System

The current A* system I am using solely works on a 2D plane (on the x-axis and z-axis). It creates a grid on this 2D plane and then allows agents to move specifically along this 2D plane, with no regard for heights. It is currently casting rays from above these grid nodes to detect the layer of the terrain the node is on. Each node also casts a small sphere the same size as it to detect collision for obstacles to determine if a node is traversable or not.

A* Update

Since the system already uses raycasts to detect the terrain type, I edited this to detect the height information from the terrain as well. Using RaycastHit.point, the raycast can return information on the exact point it hits, so I can pass the y-axis information from here to the node. I just do this along with the terrain detection, and pass this to the world position data of the node.

Since this update is specifically targeted at working with various elevations, I do not like using the collision spheres on the nodes to detect obstacles. Since I already have raycast incorporated, I thought it made sense to have it detect obstacles as well. Because there are layers involved for obstacles and terrain, I have the raycast check first if it can detect an obstacle (unwalkable terrain), and then if it does not find one, then check for walkable terrain and what type it is.

Finally, just to clean up, I added an extra variable to account for the unit heights when assigning elevation positions. This can be changed in the editor, but it adds a bit of elevation to the exact value from the terrain so the unit’s positioning as it moves along is a bit above the ground (so it is not in or below the ground).

Next Steps

These changes worked pretty well to get close to the desired effects. The units will move along altered elevation terrains to some degree. The current testing was done with a further simplified waypoint system after grabbing all of the nodes, so only the position data of points where the unit needs to turn is really taken into account for movement. This results in weird issues since the unit will not move up and down to account for elevation if it is moving in a straight line according to the xz-plane. It only accounts for elevation if the specific waypoints end up on varied elevation points (this is why it looks pretty proper on just a slanted plane).

I will look into reverting the simplified system to see if the standard system going to every single node works first. After I get that working again in all 3 dimensions, I will look to adjust back to the simplified waypoints system.

UnityLearn – AI for Beginners – The Mathematics of AI – Pt. 01 – Cartesian Coordinates

March 6, 2020

AI for Beginners

The Mathematics of AI

Cartesian Coordinates


Artificial Intelligence for Beginners

Unity Learn Course – AI for Beginners

Cartesian Coordinates

Cartesian Plane

Cartesian coordinates:
used to determine locations in space for any number of dimensions
generally used for 2D and 3D space in games (x, y) and (x, y, z)

2 Main Projection Types: Orthographic and Perspective

Orthographic:
3D space represented by a cube or rectangular prism

Perspective:
3D space that looks like a rectangular pyramid with its top cut off

The Camera size in Unity when using the Orthographic perspective dictates how far the camera sees for the smaller dimension of the aspect ratio. It is the number of units in both the positive and negative direction away from the origin the camera sees, so the smaller dimension of the aspect ratio is double that of the Size value given to the camera. The larger dimension in the aspect ratio is then the ratio multiplied by that Size value.

For example, if the orthographic perspective Camera Size is 100, and you select the aspect ratio of 16:10 for your view, the overall height seen is 200 units (+100 to -100 on the y-axis) and the overall width seen is 320 units (+160 to -160 on the x-axis). The size directly correlates with the y-axis since it is the smaller of the dimensions in the aspect ratio, and then the range for x is determined by multiplying that size (100) with the aspect ratio (16:10 or 16/10).

The viewing volume for this orthographic view is a rectangular prism (completely straight on viewing angle). They expound upon this to show movement on the z-axis does not particularly do anything in a 2D game built around the x-axis and y-axis. Placement can matter however as objects do need to be in front of the camera, and objects can be placed in front of or behind other objects.

SUMMARY

  • Unity Camera Size and Aspect Ratio together exactly determine the number of units for the dimensions of place shown on the camera at a time (especially for Orthographic perspective).
  • Orthographic view uses a rectangular prism viewing space, where a Perspective viewing space uses a rectangular pyramid shape.
  • Cartesian planes and coordinates can be used for any number of dimensions (not restricted to just 2D and 3D)

UnityLearn – Beginner Programming – Creating a Character Stat System – Pt. 05 – Accessing Variables in Our System Part 2 (End of Course)

March 6, 2020

Beginner Programming

Creating a Character Stat System

Accessing Variables in Our System Part 2


Beginner Programming: Unity Game Dev Courses

Unity Learn Course – Beginner Programming

Accessing Variables in Our System Part 2

Leveling Up

They created a LevelUp method within the CharacterStats_SO scriptable object. This accesses the leveling array they created earlier and sets all of the max stat values to those designated in the array for that corresponding level (each level is its own individual array element holding an entire list of all the stats and what they should be set to at that level).

Configuring Your Systems

They added the CharacterStats script to the main Hero character. They created empty gameobjects within the Hero character gameobject hierarchy for the character inventory and the character weapon. They then applied this to the base prefab (to make sure it wasn’t only on a newly created variant of the prefab).

They created a method named SavecharacterData, which uses the EditorUtility.SetDirty method from within the UnityEditor namespace to mark this class itself (CharacterStats_SO) as dirty. This does something with letting the system know the data on this object is dirty and needs to be saved again.

They mention this is not a necessarily good practice because they have a script that is using UnityEditor within a gameobject. This would cause an issue for end users playing the game as it will not run if they do not have Unity installed, since it needs access to Unity files.

They reiterate that your game will NOT EVEN BUILD if you have a script with a UnityEditor reference inside your scene. This reinforces that UnityEditor scripts are useful for building tools for your development team and debugging, but it is not to be used for the game itself.

SUMMARY

  • Use new prefab editor in Unity 2019 versions to work with prefabs
  • The UnityEditor namespace can be very helpful for building tools and debugging, but it is NOT for use for actual gameplay as this will keep the project from building

UnityLearn – Beginner Programming – Creating a Character Stat System – Pt. 04 – Accessing Variables in Our System Part 2

March 5, 2020

Beginner Programming

Creating a Character Stat System

Accessing Variables in Our System Part 2


Beginner Programming: Unity Game Dev Courses

Unity Learn Course – Beginner Programming

Accessing Variables in Our System Part 2

Writing Your Character Stats MonoBehaviour

They simply created the base CharacterStats class (non-scriptable object version). They gave it a constructor that created a reference to the CharacterInventory and had a Start method which initialized all the stat variables automatically if the “setManually” option was not checked.

Using Your Scriptable Objects Methods

They begin to fill the CharacterStats class they just created with many methods that simply call methods from the referenced CharacterStats_SO scriptable object.

Here they also use the UnEquipWeapon method, which has a return type of bool. They use it in the ChangeWeapon method, and have it in the if statement condition. This is interesting as the method here will run as the if statement checks the condition (regardless of the outcome being true or false), then based on the result of this method, decides if it will continue through the if statement block.

The method can be seen here:
public void ChangeWeapon(ItemPickUp weaponPickUp)
{
if(!characterDefinition.UnequipWeapon(weaponPickUp, charInv, characterWeaponSlot))
{
characterDefinition.EquipWeapon(weaponPickUp, charInv, characterWeaponSlot);
}
}

Here, characterDefinition.UnequipWeapon will be performed during the if statement condition check, regardless of the result. The result is determined through running that method, which will then determine if the enclosed if statement block is run or not.

Finally they cover their reporter methods, which are simply methods which when called report back information about a specific variable within CharacterStats_SO. For example, this can just read what the currentHealth of the CharacterStats_SO is.

SUMMARY

  • Scriptable objects can be created as a basis for other classes to use as long as those other classes have a reference to the scriptable object
  • Methods can be called and run from within if statement conditions
  • Reporter methods can be useful for passing read-only information

HFFWS Thesis: Starting Ramp Puzzle Generation

March 5, 2020

Ramp Puzzle Scenario Generation

Thesis Project

Notes

I have added the basic foundation for creating ramp scenarios in my HFFWS generation system for my thesis project. This starts with simply making very standard full ramp objects with a corresponding obstacle object.

The ramp objects are the most straight forward ramp shape, being a flat angular shape. They are scaled randomly given a range of parameters for all three dimensions. These are generated first, and then the obstacle is generated with data passed from the creation of the ramp. Right now it just accepts the height data from the generated ramp and uses it as the new maxHeight option for the obstacle. The idea is that this will keep the obstacle from ever being out of reach of the ramp (but this will actually require the tweaking of a few other parameters as well, such as positioning).

Sample Image of 5 Generated Ramp Scenarios

Human: Fall Flat Level Concept/Skill Breakdown – Medieval

February 27, 2020

HFF Level Concept/Skill Breakdown

Level: Medieval

Playthrough Sources Referenced

Human Fall Flat (No Commentary) (16/09/2017)

Video #1

By: SpeedyAvatar


Human Fall Flat – Full Playthrough w/ summit1g

Video #2

By: summit1g


Title: Automatic Game Progression Design through Analysis of Solution Features
Source:

E. Butler, E. Andersen, A. M. Smith, S. Gulwani, and Z. Popović, “Automatic Game Progression Design through Analysis of Solution Features,” 2015, pp. 2407–2416, doi: 10.1145/2702123.2702330.

Overview

I am looking into existing HFF levels to analyze the various small puzzle scenarios present in an attempt to breakdown what skills and/or concepts the player needs to understand or be able to act upon in order to complete them. The approach on how these are broken down was inspired by the the way procedural traces and n-grams are used in the above source by Butler et al. It is hoped that this approach to breaking down various puzzle scenarios in HFF will help with the automatic generation of such scenarios. I have also included an object list for each scenario to keep track of how many objects are needed for simple puzzle scenarios.

This breakdown goes throw the Medieval level of the base Human: Fall Flat game. I split up the individual puzzle scenarios the player encounters throughout the level in the steps required for a single solution avenue for completing the puzzle. Each of these steps is them given some simple skill or concepts necessary to understand to perform each step.

Medieval Level Breakdown

Scenario 1

    Intro: Lock Smashing

  1. Picks up rock (Grab)
  2. Breaks lock with rock (Breakable Object)(Apply Force)
  3. Opens door (Grab)(Pull)(Open door)
Object list:

Rock, Door, Lock


Scenario 2

    Cross Gap to Door

  1. Grabs long bar (Grab)
  2. Places bar over gap to act as bridge (Create platform)
  3. Walks across bar to door
Object list:

Long Bar, Stairs, Platform, Door


Scenario 3

    Catapult to Break Walls

  1. Move catapult into position (Push)(Pull)
  2. Wind catapult to loading position (Push)(Pull)(Grab)(Interact)
  3. Lift rock onto catapult (Pickup object)
  4. Press catapult lever to shoot rock (Push)(Interact)
  5. Rock hits wall to break it open: Gravity for aiming (Apply force)(Force = mass * acceleration)(Gravity)(Breakable Object)
Object list:

Catapult, Rock(s), Wall


Scenario 4

    Inside Castle: Rickshaw Platform

  1. Grab rickshaw handles (Grab)
  2. Lift rickshaw up by handles : Helps wheels to roll (Lift object)(Friction)
  3. Move rickshaw with rock on it into place as platform (Create platform)
  4. Lift self onto rock (Lift self)
  5. Jump onto higher area (Jump)
Object list:

Rickshaw, Large Rock (on rickshaw), Platform


Scenario 5

    Swinging Between Lanterns

  1. Lift bar on door to open it (Lift object)
  2. Bring in rickshaw from previous section (Resource management)(Memory)
  3. Move rickshaw with rock on it into place as platform (Create platform)
  4. Lift self onto rock (Lift self)
  5. Jump onto higher area (Jump)
  6. Jump onto lantern to swing (Jump)(Grab)(Hold)
  7. Swing on lantern (Momentum)
  8. Jump from lantern to platform : Falling to lower platform (Momentum)(Gravity)
Object list:

Rickshaw, Large Rock (on rickshaw), Platform (Many), Lantern(s) (Many)


Scenario 6

    Move Very Heavy Rickshaw

  1. Move (heavier) rickshaw with rock on it into place as platform (Create platform)
  2. Jump and lift self onto nearby platform several times (Jump)(Lift self)
  3. Go across platform created by rickshaw moved in place
Object list:

Large Rickshaw, Rock (Very heavy), Small Platforms (Many), Bridge (with gap)


Scenario 7

    Swing Across Gap with Hook

  1. Grab large hook (Pickup object)(Grab)
  2. Hook hook onto protruding bar to swing self across gap (Momentum)(Gravity)(Hold)
Object list:

Large Hook, Protruding Bar, Platform


Scenario 8

    Rotate Pulley-Like Wheel to Lift Board as Ramp

  1. Pickup Large Hook (Pickup object)
  2. Use hook to pull down above large wooden board (Gravity)(Reach)(Pull)
  3. Pull large wooden board so half is on roped stone (Pull)
  4. Rotate nearby wheel connected to rope to lift stone, raising the large wooden board to create a ramp platform (Pulley)(Create platform)
Object list:

Large Hook, Large Wooden Board, Platform, Wheel Pulley Setup (Large Wheel connected to Rope which is connected to Large Stone), Terrain Bump


Scenario 9

    Push Barrel Down Ramp and Climb Many Platforms

  1. Open Door (Pull)
  2. Go up stairs
  3. Open Door (Pull)
  4. Roll barrel down ramp to get to other side (Pull)(Push)(Gravity)(Ramp)(Roll)
  5. Move barrel in position to reach next platform (Create Platform)(Pull)(Push)
  6. Jump onto barrel and next higher platforms (Jump)(Lift self)
  7. Jump up onto several higher platforms (Jump)(Lift self)
  8. Turn wheel to open gate (Interact)(Grab)(Open door)
Object list:

Barrel, Ramp, High Platform, Platforms (Many), Gate (with attached wheel opening device)


Scenario 10

    Free Lantern to Swing From

  1. Grab Large Hook (Pickup object)
  2. Use hook to free stuck lantern with chain (Reach)(Interact)
  3. Swing on lantern to next platform (Jump)(Hold)(Momentum)(Gravity)
  4. Grab platform and lift self up (Lift self)(Hold)(Grab)
Object list:

Large Hook, Lantern (w/chain), Platforms (Two)


Scenario 11

    Launch Self with Windmill

  1. Grab onto windmill (Grab)(Hold)
  2. Let go of windmill to launch self to next area (Momentum)(Gravity)
Object list:

Windmill, Platform


Scenario 12

    Build Ramp with Board, Anvil, and Cylinder

  1. Remove heavy anvil from board to free board (Push)(Pull)(Reduce Mass)
  2. Move anvil, board, and cylinder in front of open area of higher platform
  3. (Push)(Pull)
  4. Place board over cylinder so cylinder acts as fulcrum of ramp
  5. (Ramp)(Push)(Pull)(Create platform)
  6. Place anvil at far end of board to keep it pinned to the ground (Increase mass)(Ramp)(Cantilever)
  7. Walk up created ramp and jump and lift self to next area (Jump)(Lift self)
Object list:

Board, Anvil, Cylinder, High Platform


Scenario 13

    Build Ramp to Get Tethered Bucket into Hole

  1. Remove board from covering hole in ground (Pull)
  2. Move board to tree to use as ramp (Ramp)(Pull)
  3. Go up ramp to reach higher platforms (Jump)(Lift self)
  4. Free tethered bucket from high platform (Push)
Object list:

Bucket (connected to rope connected to tree), Tree, Boards (x2 on hole), Platforms (x2)


Scenario 14

    Loose Rock Pillar Cave Platforming

  1. Jump onto loose rock pillar to fall onto next platform (Momentum)(Jump)(Breakable Object)
  2. Walk across next rock platform
  3. Jump to rock platform which breaks and falls to next platform (Jump)(Hold)(Breakable Object)(Momentum)
  4. Lift self onto next rock platform (Lift self)
  5. Jump to next loose rock pillar to fall into next area (Momentum)(Jump)(Breakable Object)
Object list:

Loose Rock Pillars (Many), Platforms (Many)


Scenario 15

    Launch Self to Castle Gate with Catapult

  1. Move catapult into position (Push)(Pull)
  2. Wind catapult to loading position (Push)(Pull)(Grab)(Interact)
  3. Load self into catapult
  4. Press catapult lever to shoot self (Push)(Interact)
  5. Hold onto draw bridge, which pulls it down (Hold)(Lever)(Torque)
  6. Lift long loose piece of bridge out (Pull)(Pickup object)
  7. Place long piece into opening in gate to create ramp (Ramp)
Object list:

Catapult, Draw Bridge


Using LM-GM Analysis on Human: Fall Flat for Thesis (Condensed Lists)

February 5, 2020

HFF LM-GM Analysis

Thesis Project

Title: Mapping learning and game mechanics for serious games analysis
Source:

S. Arnab et al., “Mapping learning and game mechanics for serious games analysis: Mapping learning and game mechanics,” British Journal of Educational Technology, vol. 46, no. 2, pp. 391–411, Mar. 2015, doi: 10.1111/bjet.12113.

List of Game Mechanics

The following is the list of game mechanics I observed in Human: Fall Flat according to the source above (with noting for those that are major factors, and those that are only really present in multiplayer):

  • Behavioral Momentum
  • Cooperation (*multiplayer only)
  • Collaboration (*multiplayer only)
  • Cascading Information (*multiplayer only)
  • Resource Management (Major factor)
  • Strategy/Planning (Major factor)
  • Infinite Gameplay (offered by game somewhat, but major focus of developed system)
  • Levels (Major factor)
  • Pavlovian Interactions
  • Feedback (major factor)
  • Movement
  • Design/Editing
  • Simulate/Response (Major factor)
  • Realism
  • Tutorial
  • Urgent Optimism

List of Learning Mechanics

The following is the list of learning mechanics I observed in Human: Fall Flat according to the source above (with noting for those that are major factors, and those that are only really present in multiplayer):

  • Instructional
  • Guidance
  • Action/Task (Major factor)
  • Observation (Major factor)
  • Feedback (Major factor)
  • Identify (Major factor)
  • Explore
  • Discover
  • Plan (Major factor)
  • Objectify (Major factor)
  • Experimentation (Major factor)
  • Hypothesis (Major factor)
  • Repetition (Major factor; system focus)
  • Analyze
  • Simulation (Major factor)
  • Ownership
  • Motivation (Major factor)
  • Incentive

Summary

These are just the condensed lists of mechanics I observed within HFF by applying those found in the source above. I will put up a post with my more in-depth analysis of how I believe each of these apply in HFF to support why I chose them.

I created this list to better understand what HFF provides as a possible learning tool. This also helped link the game mechanics with the learning mechanics to get a better idea of which parts of the game to focus on generating with our system to enhance the learning opportunities.

What Are Neural Networks? – Basics Videos

February 17, 2020

Neural Networks

Youtube Videos on the Basics

But what is a Neural Network? | Deep learning, chapter 1

Information #1 – Link

By: 3Blue1Brown


Neural Network Architectures

Information #2 – Link

By: Steve Brunton


Notes

I am following up on my original research into working with neural networks and machine learning. I started looking into the programming more before really looking into the full background of it, so I am going back to make sure I have a better understanding of the theory and concepts behind neural networks and machine learning. These sources I found seemed to be useful lectures to get a hold of the basic foundations for the concepts behind such ideas.

Basics of System.Random in C#

February 14, 2020

System.Random Methods

C# and Unity

Random Class (from Microsoft)

Information – Link

By: Microsoft


General Methods Looked Into

Random.Next

This selects a random integer either between 0 and maximum value, or between two different designated values.

Random.NextDouble

This generates a random floating point value between 0.0 and 1.0. This is the main one I will be looking to use since I have a lot of parameters where floating point values make sense, however since it only returns values between 0.0 and 1.0 specifically, I will have to just use it as a random multiplication factor.

Random.NextByte

This requires an input of an array of bytes. It will then fill that array with random byte values.

Why I am Investigating

My thesis project uses a lot of random values with its focus on varied procedural content generation, but I want to control the randomness a bit more with the implementation of a seeding system. A tutorial I did a while back on cellular automata uses a very basic seeding system for its randomization that I was looking to copy. It centers around this line where seed is just a string variable that can be set in the editor:
System.Random psuedoRandom = new System.Random(seed.GetHashCode());

As long as the seed string is the same and a value is randomly selected using this Random variable psuedoRandom, the value selected for that particular case will remain the same over multiple plays of the program. This helps provide control and consistency to the random system generation so if I find good samples they can be recorded by their seed string.

Random.Next and Random.NextDouble are going to be the main two that I use, as they help generate random ints or random floating point values (doubles that can be cast as floats if necessary). Random.Next will be very useful in cases where I am generating a specific number of objects, where Random.NextDouble will be used to generate the varied values for parameters that are within specific ranges (such as the length or size of an object). As noted previously Random.NextDouble can only specifically generate values between 0.0 and 1.0, so it will be used as a random multiplication factor to get the results I need.