Dev Blog

GPU Instancing in Unity

April 25, 2019

GPU Instancing

Tutorials for Unity

Youtube – GPU Instancing Tutorial (No, Seriously, This Is Easy)

By: Craig Perko

Youtube – [Unity] GPU Instancing Tutorial

By: Blendcraft Creations

Youtube – Unity3D – 2 Minute Tips – Use GPU Instancing to reduce drawcalls when batching won’t

By: Unity3d College

Youtube – GPU Instancer – Features Showcase

By: GurBu Technologies

I am starting a project in class that is potentially looking to instantiate a lot of flower objects in Unity, so I wanted to take a look at GPU instancing and see if this was a practical solution for us if we ended up going down this route. If not, this is still a good opportunity for me to get a taste of working on purposefully passing certain information to the GPU and using it for specific tasks.

The first three videos are direct tutorials showing how to set this up or how to use it, while the last one is an already made asset in the Unity Asset Store showcasing a very strong GPU Instancing heavy asset and some of its capabilities. I think the final one is nice to have to at least show some of the more interesting capabilities this can lead to.

Tower Defense Scene Management Issues

April 25, 2019

Scene Management Solutions

Identifying Issues and Possible Solutions

Scene Conflict
  • There are two scenes that load at the same time that have scripts within them that want to reference scripts within the other or both reference the Logic scene which needs to be updated simultaneously
  • Even though they should ideally be loading at the same time, one is always loading ‘just before the other’
  • This causes the first scene loading to miss its references since the other scene does not exist to it yet when it goes to get those references
  • The second scene loading in does however load its references properly
  • I’ve tested switching the order of loading and the second scene functions properly consistently, while the first scene has errors
Current Issues
  • Level scene loading second to make sure the nodes can get the BuildManager reference
  • However, the Level scene sets the number of lives the player has (LevelPlayerStats passes lives in to the PlayerStats script in the Logic scene)
  • The LevelManager in the Base scene checks the player lives to see if it should end the game
  • Since the Base scene is loading first, it checks and sees there are 0 lives before LevelPlayerStats can set the correct amount of lives for the level
  • This is setting the game to Game Over immediately
Proposed Solutions

Find way to time events: Setup the scene manager system in a way that it makes sure everything is loaded before attempting to setup references. Functionality of the game also needs to wait some time to make sure the newly loaded scenes have time to set the values necessary in the Logic scene before actually starting so they don’t try to work with default values instead.

Move references: Currently the issue is that no matter which scene loads first, there are reference timing issues with one of them. This could be evaded by placing all of the references that should be done first into the same scene and just making sure that scene loads first.

I believe the timing control solution is the better and more powerful solution, as this will help anytime I really need to have multiple interscene references in the future. That is also the much more difficult solution though. I may go with the simpler solution for now just so I can continue experimenting with the more game design heavy concepts of working on the tower defense game and then come back to figure out the stronger solution later.

Houdini Vex

April 23, 2019

Houdini Vex Code

cgWiki – HoudiniVex

As I was working on a chandelier project in Houdini, I needed a lot of help learning the ropes of Vex. In my research I came across this huge resource that was not quite useful at the time, but looked like a really good place to start for some vex tutorials. I want to come back later to this resource to help get a hang of the basics of vex in Houdini.

Intro to Python Programming with Mosh – Pt. 04

April 22, 2019

Intro to Python Programming

Tutorial – 04

Youtube – Learn Python 3 for Machine Learning & Web Development [2019]

By: Programming with Mosh
Progress

End Time: 1:41:55

Next Part of Tutorial: For Loops

NOTES

Weight Converter

This was a simple exercise to try and create a simple weight converter. It would take a user input weight and ask if it was in Kilograms or Pounds (lbs), then convert it to the other unit.

Their solution to this exercise provided a nice way to make strings less case sensitive. Since the unit input was just the first letter of the unit abbreviation (L for pounds and K for kilograms), this could make it completely non-case sensitive. You simply use the upper() method on the string you are comparing a value for before checking what it is. Then you only have to compare it to the capital case instance and either they will have already typed in the capital instance, or you will have converted the lower case to an upper case before comparing.

While Loops

These are used to execute blocks of code multiple times. The syntax for while loops is similar to C#. You just use the while key word with a condition, ending with a colon. Then the following indented code will be executed as long as the condition is met.

Guessing Game

This uses a while loop to build a simple guessing game.

This example went over “refactoring”, which is renaming a variable and all the instances of it in your code. This can be done with the keyboard shortcut: Shift + F6.

The Break command is used to immediately exit the program out of a while loop. This is useful when a varied condition is met that doesn’t need the loop to run again. This also prevents any Else counterparts of the while loop from executing.

While loops can also have Else counterparts. These will execute if the entire while loop is completed without the use of a Break.

Car Game

This was another exercise to do on your own. This time it was creating a “Car Game” that just said you started the car if you typed ‘start’ and stopped the car if you typed ‘stop’. I used a simple while loop to contain the game as a whole, with a game_started bool. The entire game ran in this while loop while game_started is true, and terminates when that is set to false. This gave me a way to quit the game when the user typed in quit.

Within the main game while loop, there were just a lot of if statements (with elif) to determine what to print based on what the player typed in. There was also an extra bool added which was car_started, which could be used to determine if the car was already started or stopped. This could be used to make sure the player couldn’t stop an already stopped car or start an already started one.

Human Fall Flat Workshop – Getting Started

April 18, 2019

Human Fall Flat Steam Workshop

Original Human Fall Flat Workhop Steam Group Page

Steam – Human Fall Flat Workshop

Setting Up Human Fall Flat Workshop in Unity

Steam – Human Workshop: Getting Started – Configuring Unity, Making your First Level, Publishing and Subscribing to Levels

This documentation gets you through the process of initially setting up Human Fall Flat Workshop to work in Unity. It starts with the proper version of Unity, which is 2017.4.13f1. You create a new 3D project and import the workshop Unity package that is part of the Human Fall Flat game files you get from Steam. Then, close out of Unity and copy over the “Project Settings” folder from the HFF game files into your Unity project, overwriting the existing “Projece Settings”.

That’s the gist of getting it all setup in Unity. The rest of the documentation gets into setting up your first level and getting a basic understanding of the core objects such as the Spawn Points and Pass Triggers.


Editor Improvements and Node Graph System

Steam – Human Workshop: Editor Improvements and Node Graph System

This write up talks about overall Editor improvements for the workshop, such as being able to teleport the player anywhere in the scene to help with testing and a lot about the signal event references and node graphs.

This documentation has a Node List with simple descriptions of what all the different nodes do in the node graphs, as well as a lot of helpful hints and functions for organizing and utilizing the node graphs. This covers topics such as color coding nodes, using nodes and their inspectors in general, and how to properly use the cheat nodes to efficiently debug/test. This is a very useful resource for getting started with the node graphs for HFFWS specifically.


HFFWS Discord

There is also a discord community for the HFFWS that can be a useful resource for getting help figuring out different aspects of this tool as well as getting player feedback for creations.

Exporting FBX from Houdini with Color

April 17, 2019

Exporting From Houdini

FBX and Color Information

Exporting the Model

Using my balloon Houdini example from class, I was able to export the geometry using the Educational version (the Apprentice version does not allow exporting FBX, but you could export an OBJ for my purposes possibly). This was very straight forward, as you can just use File -> Export -> FBX in Houdini.

Since I was doing this for a class to use in a Snapchat filter (using LensStudio), I wanted to reduce the poly count a lot. I opened the FBX in Maya and used a basic Reduce to reduce the poly count a lot before exporting that for use in LensStudio.

While this was good enough to export the geometry, I could not get any of the color information to come with it. I originally exported out an OBJ and had the same issue, so I exported FBX in hopes it would keep the color information somehow, but this was not the case.

Exporting the Color Information

My first thought to get the color information out of Houdini (since the colors of my balloons were being created with color nodes assigned directly to the primitives) was to create a material or texture of some kind with the information. My first attempt was simply adding a PrincipleShader to the balloon and hoping that would hold on to the color data. While the material did come out with the FBX export, it still did not have the color information.

Next, I looked to the output channel of Houdini to see if there was something I could use there. This is where I came across the BakeTexture node. This node has a huge amount of options that I could not really get a hold of everything, but this ending up being a good starting point to my process. I could use a lot of the default settings, including the “Texture Format” UDIM. This format however, requires that there be UVs on the geometry, which mine did not.

Using this to determine my next step, I looked into how to create UVs for my model. This led me to the UVProject node. This node can actually create a UV map from your model. It has several settings to change the plane it projects onto and the projection method, but the defaults were all good enough for me. It created a simple rolled out horizontal texture of my balloon model with its current color information.

Now, with UVs I could go back to the BackTexture node. This allowed me to use the UDIM “Texture Format” now. The selections I used under Images – Main, were “Extract Image Planes” (with Extract Format of PNG) and “Surface Unlit Base Color (basecolor)”. Basecolor ended up being the file I actually used in the end. Finally, I selected my balloon object as the “UV Object 1” and selected a path to output the file in “Output Picture 1”, as well as setting the “Resolution” to 256 x 256. This gave me my PNG texture file.

Using the Model and Texture

When I placed the FBX model in LensStudio, it came with the PrincipledShader as a material naturally now. I placed my exported basecolor PNG texture file in as the base texture file for the PrincipledShader material and this got my colors onto the balloons. Since the models did not seem to be exporting perfectly true to form of the Houdini geometry, I am not completely sure how accurate the color information is to the Houdini version, but it looked similar enough for my purposes.

Setting Up Java

April 15, 2019

Setting Up Java

Dev Kit, Eclipse, and Working in Command Prompt

Oracle – Java SE Development Kit 8 Downloads
Eclipse Site

Basic Setup

As I’m preparing for a foundational programming course, I needed to get Java setup on my computer. This started with downloading the Java Development Kit (JDK) and Eclipse (an IDE package for working with Java). I had to make sure to run and install the JDK first, as Eclipse needed some of its components to setup initially.

I needed to do some work using the command prompt on Windows, and found I was having trouble using the javac and java commands. This turned out to be an environment variable issue (something I ran into similarly when starting Python). I was able to easily resolve this by checking the “Edit the System Environment Variables” section of my control panel and adding the path to the Java jdk bin file to my “Path” system variable.

Houdini Flower Tutorials

April 13, 2019

Houdini Flowers

Tutorials

Youtbe – CGI Rose using Houdini and Redshift by Stephen Bester | VFX

By: CG Record

Youtube – Houdini Tutorial: Creating Water flowers blossoming | Project File for download

By: CG Record

Vimeo – Water flowers blossoming in Houdini. Tutorial + project (HIP,comp,ae)

By: Mike Stoliarov
UPDATE 4/29: This is the same video as the one above, but has higher resolution options so you can see the steps much clearer.

These are a couple tutorials showing how to create flower-like objects in Houdini. I’d like to get into making plants with Houdini at some point, especially flowering plants, so I just wanted to start gathering some resources for that.

While one of these tutorials is for creating water flowers, a lot can be taken from that for the core of the flower making process. The other tutorial is for making a rose, which is perfect for a lot of flower uses. It also says it uses Redshift, which I’m not sure what that is or how much of a difference that makes in Houdini’s workflow for any reason.

GDC 2019 Talks – Into the Breach and Dead Cells

April 11, 2019

2019 GDC Vault

Talks

GDC 2019 – Into the Breach’ Design Postmortem

By: Matthew Davis
From: Subset Games

GDC 2019 – ‘Dead Cells’: What the F*n!?

By: Sebastien Benard
From: Motion Twin

Into the Breach Design Postmortem

Constraint Focused Design: This basically has them set constraints as early in the game design process as possible that help direct and restrict future design choices. This can be something like a genre, or a game mechanic like health.

Gameplay focused design: They approach making games by starting the the main gameplay they want to create, and then building everything else to fit around that. Everything such as narrative or theme ends up following the gameplay.

They used a very board game inspired design for “Into the Breach”. They like to keep numbers small, easy to understand, and meaningful. The difference from 1 to 2 should be impactful. This also leads into how they designed enemies. There is a “chess-like” feel to enemies, and the overall gameplay in general, in that the player should have a good understanding of how a piece operates and its zone of danger it creates and be able to play around that.

Randomness was something to be kept to a minimum. This went very well with the idea of having the enemies forecast their attacks. Again, this also ties in with making as much information available to the player as possible. Even though they wanted to reduce randomness to a minimum, they still implemented it when they deemed it a much better option.

As most game designers do, they wanted a strong focus on interesting decisions. This led to keeping out a lot of complex systems that were too difficult to use for what they really brought to the game. This was also done a bit differently on their team since they only have two people, so they could iterate quickly and often and scrap ideas and designs much more easily.

‘Dead Cells’: What the F*n!?

They really wanted to focus on “permadeath” as a game mechanic. Focusing on this led them to some core mecahnics to “make death fun”. The core of this was death being a way to progress in the game. It gave you a way to improve your character’s abilities, as well as access previous areas again (since the game does not allow back tracking).

They wanted to focus the design on combat, NOT platforming. Even though it is still a 2D platformer, they really wanted the player to use their skills for fighting and limit or even remove punishments for platforming. To achieve this, they used many small mechanics such as allowing players to jump a few frames after leaving a platform, teleporting the player onto a platform if they missed a jump by a few pixels, and implementing an edge grabbing mechanic.

This player helping system in platforming got carried over into over mechanics as well, such as helping aim attacks. If the player is facing the wrong direction when going for an attack, the game can actually assist them and switch them around the other direction. I initially was very against this concept, but I appreciated their take on it and was much more accepting after their explanations. This helped reduce the mechanical demands for the game, rewarding the player much more for strategic combat gameplay. Then in this way, this actually allowed them to make the game more difficult in some respects since the player wouldn’t be punished for these less important game aspects.

Just a small note, since they use a lot of community feedback to update their game, they will leave comments in the patch notes stating who inspired the change. This is just a good way to let the community know how impactful they are and make them more willing to help in the future.