Dev Blog

Setting Up HFFWS Project

August 9, 2019

HFFWS

Setting Up Initial Project

Youtube – Human Fall Flat – How to make a map – Ranul

By: Ranul

So following this tutorial, the bare minimum for getting a level started is simply adding the “Level” prefab into your scene. This comes with:

  • InitialSpawnPoint: where the player spawns in; even has an indicator with a ray to show exactly where they will hit
  • FallTrigger: this is the trigger that determines when the player should be respawned
  • PassTrigger: the trigger for finishing the level (the goal)
  • Directional Light: standard directional light

It also sounds like “everything” needs to be childed to this Level prefab, so I’ll stick with that until I find otherwise.

Thrower Tutorial

Youtube – Spinning Thrower + Space Unity Tutorial for Human Fall Flat Workshop

By: Gotcha McFee

This tutorial shows how to use some basic tools that Probuilder affords you in Unity to make a moving, interactable object in your HFF level. This specific object is a “Thrower”, which is a spinning wheel that the player can hold onto then release to get launched to a new area from the wheel’s momentum.

Notes that the mass of objects makes a big difference in HFF in general, so modifying this can help if you aren’t getting the desired results. Generally objects start with a rigid body mass of 1, but in this example they set the wheel to a mass of 500. This significant difference shows you should be careful keeping track of your object masses so you don’t get issues just because you missed a very low mass value.

There are some notes on how to make a Probuilder object into a moving and interactable object in HFF. To allow it to move, there is an Entity Type under the Pb_Entity component that must be changed to “Mover”. To allow it to then be interactable, the Mesh Collider component needs to have the Convex option turned On. I noticed you could still interact with the thrower holders (just long cubes on the sides of the wheel) without changing anything, so it seems the Convex option is only important for moving objects.

Noted important factors for a wheel object:

  • (If Probuilder object) Pb_Entity – Entity Type – Mover
  • (If Probuilder object) Mesh Collider – Convex (On)
  • Hinge Joint component (automatically adds Rigidbody component)
  • Hinge Joint – Axis (Ex. 0, 1, 0)
  • Hinge Joint – Use Motor (On)
  • Hinge Joint – Motor – Target Velocity (Ex. 175)
  • Hinge Joint – Motor – Force (Ex. 500,000)
  • Rigidbody – Mass (Ex. 500)

Rope Tutorial

Youtube – Rope tutorial in Unity for Human Fall Flat

By: Gotcha McFee

This shows how to create a simple rope in the HFFWS from scratch.

The main objects needed as children objects of your overall rope object are:

  • Start
  • End
  • Rope

The Start and End are just Rigidbody objects with certain masses and constraints (want the start to be more solid and fixed where the end is more manueverable and flexible). The Rope holds a lot of the inner workings of the rope object.

Components needed for the Rope object within the overall rope hierarchy:

  • Rope (Script)
  • Mesh Filter
  • Mesh Renderer
  • Net Body (Script)(which has Net Identity attached as required component)
ISSUES

The tutorial shows how to add some objects like spheres and cubes to the rope object to give it an attachment point at the top and interactable objects at the end. I just wanted to quickly test adding the objects to hold onto on the end of the rope, so I just added a sphere as a child of the end and tried running the game. This caused the rope to glitch out and jump around violently. It appears that adding an object that has too much “rope in it” causes some weird collisions that just make everything move around erractically. I was able to get similar results to the tutorial by moving the sphere a bit below the end transform (without completely removing it visually from the end of the rope). This is just something to be aware of if adding to your rope.

PARAMETERS

The tutorial goes over some of their experience with the parameters of the rope script and results that have and have not worked for them.

Rigid Segments:
Having too many of these makes the rope too “heavy” and hard to use. You can change the individual segment weights as well, but too low of a segment mass causes the rope to “break” and become very glitchy. They generally make normal ropes have about 6 or 7 segments, with 15 being about the max for a very large rope.

Segment Mass:
The default value for this is 20 and that seems to be a pretty nice standard value. As mentioned previously, very low values break the rope and cause it to function incorrectly. The 15 to 20 range seems to be pretty consistent, but just make sure to test ropes with varying mass values if you are getting strange results.

Learning from Pokemon Unity Tutorial

August 8, 2019

Unity Pokemon Tutorial

Setup

Youtube – Lets Make… Pokemon in Unity! – Episode 1 – Basic Setup World/Character

By: BrainStorm Games

As a big fan of Pokemon, I wanted to finally jump into this tutorial just to learn from what it has to offer. It could be very helpful for any 2D projects, especially those that are more RPG-based, and I imagine a lot of concepts can be carried over to 3D projects as well.

I am especially interested to see:

  • How they perform the movement in a way that’s consistent and easy to control
  • Setup of the overall “Pokemon” class structure to deal with many different options of very similar creature objects
  • How they deal with encounters (and the implementation of randomness)
  • Connected to points 1 and 3, how they structure the overall class for encounter areas
Using Tiles

Sometimes tiles can have a line between them even though they are connected, but this is normally caused by anti-aliasing. This can be turned off in the quality settings in Unity. Newer versions (I’m using 2019.1.12 currently) seem to have that disable initally in 2D projects.

Since we’re using tiles that are generally positioned pretty precisely, I thought this would be a good time to use Progrids again. This is perfect for continously placing all these tiles in exact incrementally different locations right next to each other. It is a bit awkward that the tiles get placed onto the intersection points of the grid as opposed to filling in the nicely made grid squares, but that’s just an aesthetic pain. It functions perfectly for this.

You can also achieve a similar effect to Progrids just normally in Unity by holding [Ctrl] while clicking and dragging to move an object. This can move the object one unit at a time.

Human Fall Flat Workshop Resources Updated

August 7, 2019

HFF WS Resources

Links to Useful Information

I am getting back into some HFF WS editing for my thesis project, so I gathered a lot of resources together on how to work with it, how the updates change things, and a few tutorials for putting some objects together. I compiled this list of resources while I downloaded the updates, added the new WS package to the Unity project, and updated all the prefab icons in editor to make everything nice and easy to use once I finally started putting a scene together to test things out.

Steam HFF WS Help

[NEW] Human Workshop: Features, Multiplayer Support and Backward Compatibility to 1.2 Alpha2

[NEW] Human Workshop: Example Workshop Levels, Templates and Prefab Testbeds

[NEW] Human Workshop: Editor Improvements and Node Graph System

[NEW] Human Workshop: Post-Launch Fixes, Updates and Additions – v1003292

HFF Tutorials

By: Gotcha McFee

Rope tutorial in Unity for Human Fall Flat

Moving Platform Tutorial in Unity for Human Fall Flat

Unity Controlling Coroutines

August 6, 2019

Controlling Coroutines

More Advanced Coroutines in Unity

Youtube – Unity3D – 2 Ways to Start & Stop Coroutines (the good & bad ways)

By: Unity3d College

Youtube – Unity3D – Using Delegates / Actions as Callbacks in Coroutines

By: Unity3d College
1st Tutorial

This first tutorial is one I’ve looked at before, and it makes more sense now when I want more accurate control of a coroutine in Unity. Basically you can create an IEnumerator variable that can just hold the coroutine you want to run. This same variable can be checked for being null as a way to determine if it is already running, which can be helpful to ensure only one instance of the coroutine is running at a time.

This also suggests a different approach than normal for creating a more accurate timer in a Unity coroutine. Instead of counting a timer up or down with Time.DeltaTime, they set a float value to Time.time when the coroutine is started, and then check if difference of the current time (Time.time) and that set start time is greater than your intended timer value.

2nd Tutorial

This was a bit more advanced, and I need to look more into Unity Actions to fully understand how this works, but I think I got the general concept. It appears the basic premise is using an IEnumerator which takes on a method (methods) as a delegate input to ensure that a certain step is completed before running the input delegate (method(s)).

For example here, they wanted to replace an image but they wanted to ensure that the www object was obtained first to use for that method. Since a delegate was used, they also showed the flexibility of how the same foundation could support different methods.

What I am a bit confused by here, is how the ReplaceImage method that is set as the delegate in the LoadImage IEnumerator gets its input. It requires an input of Texture2D but I don’t see if or how that is set. I believe this may be my lack of knowledge on either Actions or Delegates in Unity, so I’ll need to look into that.

Unity Composition and Inheritance

July 29, 2019

Unity Composition

Composition vs Inheritance

Youtube – Unity Architecture – Composition or Inheritance?

By: Unity3d College

I was looking to use inheritance with an overall parent abstract class to create a few simple scripts, but was having some trouble getting it setup properly. When looking into how to approach this better, I came across the concept of “Composition vs Inheritance”. This is the first time I heard the word composition, but it appeared to be the idea in Unity of creating a bunch of small scripts that perform specific types of functions that can be placed on objects in a varied structure style to create the proper type of object you want.

I thought this was a neat concept that made a lot of sense in Unity, so I ended up using this idea to approach the issue I was working on. This got me into using RequireComponent(typeof) in Unity, which I’d seen before but never really used. This seemed to be a nice feature to keep track of with a composition style approach since there will probably be a lot of cases where certain components will need others to be there, and this is just a good practice to make sure you don’t have any issues when setting up your structured object.

Updating Waypoint System in Unity

July 19, 2019

Updating Waypoint System

Starting with a base waypoint system I created with the Brackeys tower defense tutorial, I wanted to update it so that the overall path could be altered at run time. Basically, I didn’t want objects traveling along the waypoints to travel the full length everytime. I needed them to sometimes travel part way, sometimes more/less, sometimes the full way.

I decided I would have the main script holding the general waypoint information to hold the value for where objects should stop traveling. This way all objects could reference this for how far they should travel, and I could have anything else just change this single value to update where everything is going. This was as simple as adding an int value called currentEnd to this main script, Waypoints. Then I added the methods GetCurrentEnd (to return currentEnd) and SetCurrentEnd (to change the currentEnd value).

Next was updating the Waypoint_Movement script, which is attached to the objects moving along the waypoints to tell them how/where to move along the waypoints. They were originally moving from waypoint to waypoint until they reached the end of the Waypoints array (Waypoints.points.length – 1, the length of the waypoints array minus 1). This causes them to travel until they hit the end of the array. This was simply changed to check for [Waypoints.GetCurrentEnd() – 1] so they would only move to a waypoint determined by the currentEnd value at the time.

Finally, other scripts were able to add in the SetCurrentEnd() method call from Waypoints to their current functionality to have it basically update the length of the waypoint path further objects would travel.

Password Managers

July 8, 2019

Password Managers

LifeHacker – Lifehacker Faceoff: The Best Password Managers, Compared

By: Thorin Klosowski


KeePass Homepage


Youtube – KeePass Tutorial 2017

By: Papercut

As someone that works a lot with computers, it’s been way too long for me to not look into password management to keep everything secure. I happened to come across the top article from LifeHacker here today and decided to finally look into setting something up. Using that as my starting point, KeePass looked like a cool option since it was free and open source.

KeePass seems pretty cool, but being open source it also wasn’t as user friendly as some of those other options, so I looked into some basic tutorials for getting it setup. The one I found above was very straight forward and it ended up being much easier to get KeePass basically setup than I thought it would.

While KeePass was pretty easy to setup its basic capabilities, there are some things I still need to look into getting around. One of those major factors is that it stores your information locally, so I’ll need to delve deeper into some options for sharing the information if I need passwords for things like my email on another computer or device.

Creating a First Person Camera Controller in Unity

July 3, 2019

Creating Basic FPS Camera Controller

FPS Controller in Unity

Youtube – How to construct a simple First Person Controller with Camera Mouse Look in Unity 5

By: Holistic3d

This first tutorial is a good example for setting up the most basic type of first person camera in Unity. Since the project I was using didn’t need a character at all and I was just attaching this directly to the camera, I needed to make some slight modifications to have it setup properly. This is because I didn’t have a parent object to apply the second type of rotation to. This just required me to set both rotations in both directions at the same time (since setting one and then the other to the exact same object had the second rotation constantly overriding the first).

This camera had a slight issue though where it moved relative to wherever the mouse starts on the screen. While I was just creating this camera controller for debugging purposes for an AR project, this would be an issue to investigate in the future if you actually wanted to use the controller for a game. Just implementing something simple using the mouse’s initial position relative to screen space somehow.

Outline Shader in Unity

July 3, 2019

Outline Shader Tutorial in Unity

Youtube – Shader – Smooth Outline – [Tutorial][C#]

By: N3K EN

As someone with very minimal shader experience in Unity still, this step by step tutorial is nice for just getting a feel for how shader code is setup while also creating a useful effect for certain art styles or attention drawing practices. It simply creates an outline around 3D objects of various color with variable width.