Posts

Showing posts from August, 2019

HFFWS - Working with Conveyor Belt

August 29, 2019 Human Fall Flat Workshop Conveyor Parameters Conveyor Parameters Name: DarkGreyMetalMechMediumDebrisMovingConveyorBeltBody Parent Mesh the mesh of the overall body of the conveyor belt; the central element Default: DarkGreyMetalMechMediumDebrisMovingConveyorBeltBody Conveyor (script) Item Prefab: objects that the belt is made up of Segment Count: creates the designated number of segments; spread out accordingly Initialized Length: Changes the overall length of the conveyor Changes during Runtime, but only properly works in setup Radius: this is the radius of the curved ends; controls overall thickness of belt system Initialized Speed: Direction and how fast the belt moves around Runtime Node Graph (script) Signal Math Comparte (script) BeltM_RollEnd Just seems to be model for cylinder at a belt end BeltM_RollStart Just seems to be model for cylinder at a belt end ConveyorSegment.001 This just seem...

Tower Defense Project - Testing Losing States

August 28, 2019 Tower Defense Tutorial Project Testing Losing States I believe all the moving parts for my scene management system are finally starting to come together and work properly for this project. The losing conditions are the last state I really need to check with. I just need to make sure it properly ends the game when the player loses, does not allow them to progress, displays the proper UI elements, and moves between scenes from the losing state correctly. GENERAL TESTING Test #1: The first test was going to Level 1 from the level select menu and immediately losing. This seemed to work fine. The game stops when the player loses, and the game over UI comes up. The UI text does not seem to be working properly, so I will have to adjust that. It says the player survived 25 rounds, which is just the default value. I need to tie this into the script controlling the round count. I think tried Retry and Menu from this losing state and both seemed to work properly...

HFFWS Finding Objects to Test

August 27, 2019 Human Fall Flat Workshop Instantiating More HFFWS Prefabs I ended up running into an issue testing the HFFWS. When in Play mode in the Unity editor, my player model was missing. PROBLEM: Missing Player Model in HFFWS Unity Editor SOLUTION: I decided to open HFF to see if there was a direct access to the workshop levels from the main menu, and found out there was not. While I was in the main menu, I decided to have some fun and customize my player model. After doing so, I found out that my player model in the HFFWS editor was missing. It turns out that the editor tries to use your in game model, and if you are not using the "Default" as the option for your character's model, nothing will show up. model The Prefab scenes seem to work pretty well from interacting with them for a bit. I will look to go through these and grab some interesting objects to run some spawning tests on to make sure I find a nice way to approach this. Setting the paramet...

Tower Defense Tutorial - Fixing "Continue" Scene Errors

August 26, 2019 Tower Defense Tutorial Project Fixing Scene Transition Between Levels When Continuing I was able to clean up the scene management enough last time that going through the basic starting game scenes all worked well as far as I could tell. I could get from the main intro scene, to the level select screen, to level 1 without any issues. Progressing to level 2 was not working because of some reference with the enemy spawner object, so I will be looking into that. PROBLEMS PROBLEM #1 Level 2 does not load after playing Level 1 because of some reference issue for setting the spawn object. The error was actually that spawnPoint in WaveInformation was not assigned, so I looked into that and saw that there was a public field for drag/dropping the spawn point object into that I just hadn't done in Level 2. SOLUTION: Just setting this public field with the spawn point allowed the level to work properly. General Testing I edited Level 2 a bit more just to mak...

Unit Testing in Unity

August 25, 2019 Unit Testing How to Use It Youtube - Unit Testing in Unity - Livestream By: Unity3d College Unit testing is used to check that small chunks of your code can pass designed tests. These tests can be made in a way to show why a certain method or snippet of code is designed the way it is, and help inform other programmers on the project of why that is and also if they break some intended uses of the designed code. They just generally ensure that your code is doing what you expect it to, and remains doing what you expect. The tests generally follow a "triple A" format: Arrange, Act, Assert. Arrange: Set up the conditions for the test Act: Perform actions that you want to test Assert: This is the check used to test In this lecture, they have setup a very nice system for holding all of their testing needs in Unity. Their is a specific Testing namespace with all the testing classes that hold public test methods. These are accessible through a spe...

Object Pooling in Unity

August 24, 2019 Object Pooling Unity Youtube - Unity3D Object Pooling - How to use them & why you should By: Unity3d College This tutorial just seemed like a really useful concept so I wanted to make sure to note it down. Destroying lots of objects in Unity can lead to a lot of garbage collection, so you can use this concept of object pooling to help minimize this or remove it significantly. The example used has a lot of objects that are spawning and then being destroyed. This can lead to lots of garbage collection because the newly unused memory needs to be accounted for in some way at some point. Object pooling helps get around this by not destroying the objects. You simply deactivate them, and then add them into a pool of deactivated objects. When you need to spawn another one, you just grab one of these deactivated objects and reactivate them instead. It's a very useful concept that is pretty easy to implement. It will have the most impact when you are creat...

Tower Defense Tutorial Fixing More Scene Timing Issues

August 24, 2019 Tower Defense Tutorial Project Fixing Problems with the Scene Manager A major issue I may have to deal with is updating the version of this Unity project. To clean out space on my computer, I wanted to condense the versions of Unity I was using on several projects so I removed one of the older 2018 versions I was using originally for this tutorial. I wanted to upgrade it to a 2019 version, so I just used the most recent one I had. I don't believe this should have very major impacts on this project, but it is worth noting for any extra strange behavior or errors. First things first, I need to do a bit of play testing to get a feel for the current errors and go over the main scripts (mostly those dealing with scene management) to see where to start. The opening scenes seem to work well (the initial main scene into the level select menu). Selecting level one works ok. Any other level leads to weird errors (not properly closing other scenes so lights add up...

Unity Prefabs (Unity 2018) - Overall Coverage

August 24, 2019 Unity Prefabs Youtube - Unity Prefabs - The Complete Animated Guide | Game Dev Classroom By: Lost Relic Games While this tutorial on Unity prefabs is slightly behind (the version they're using in the tutorial looks to be 2018.3.5) it still covers a lot of the fundamentals of using prefabs in Unity, as well as some of the pros and cons of using them and how to use them properly. It will still be important to follow this up with more recent Unity prefab information since some concepts (like prefab variants) may already outdate some of the information in this tutorial once I understand them better. The basic starting point is that a prefab is a container for a gameobject and all its children that you can package together into one nice, tidy, and reuseable object. You can then make several instances of this object from this one prefab. Editing Prefabs You can approach editing prefabs and their instances from multiple directions. You can edit the master ...

Instantiating HFFWS Platforms with Parameters Determined in Script

August 23, 2019 Human Fall Flat Workshop Instantiating Moving Platforms with Varied Parameters Goal: Instantiating various HFF prefabs with varied parameters determined in script - Should be able to work with multiple prefabs or provide a base foundation that can make further scripts which can work with other prefabs - Should be able to work with the signal and node system of prefabs - Should also work with more standard values (basic Unity components) CreatePlatforms Test - This script focuses on working with the MovingPlatformVertical prefab - It seems that using initialValue works to set values in the node system for this object when doing it upon instantiation - Need further testing to determine the difference between value and initialValue and when to use both - Interesting components and values to check: The components for MovingPlatformVertical that we need access to are: - Parent - Mesh Renderer - Mesh Filter - Mesh Collider - Signal Math Mul (Scri...

Pokemon Unity Tutorial - BattleManager [Pt.8]

August 23, 2019 Unity Pokemon Tutorial BattleManager Youtube - Lets Make... Pokemon in Unity! - Episode 8 BattleManager Code By: BrainStorm Games This tutorial focuses on the scripting the actual functionality of all the UI in the battle scenes. This includes giving all of the different text selections their various functionalities when the player selects them during a battle. The intial setup for the BattleManager script was a huge pain in this tutorial. It started with creating a bunch of public GameObjects and Text objects to provide input fields in the inspector. There were almost 20 different elements created at once here. Then, we had to plug in all of the corresponding UI Text and Panel objects from the last tutorial into these fields. Many of these objects were never renamed at all (or named poorly as the script name does not match the object name in any manner). This will be workable since this is not the main reason I am doing these tutorials. After setting ...

Pokemon Unity Tutorial - Battle GUI [Pt.7]

August 21, 2019 Unity Pokemon Tutorial Battle GUI Youtube - Lets Make... Pokemon in Unity! - Episode 7 Battling GUI By: BrainStorm Games This tutorial focuses on setting up the GUI within a battle encounter. This includes creating the panels necessary for holding all of the information about the battle and the player's input options. The UI panel holding the moves was given a Grid Layout Group component. This helps when you want to layout children UI elements in a grid pattern. This component holds information such as padding (spacing added around borders of current UI elements) and cell size (how much space to give each individual grid component). Working with UI elements in Unity is always weird and unpredictable for me, and this time was no different. When making the health bar UI canvases, I created the background (health container) and foreground (current health) health elements for the player's pokemon first without any issue. However, when I duplicated ...

Colon Uses in C#: Chain Constructors

August 20, 2019 Colon In C# Language StackOverflow - In C# what category does the colon “ : ” fall into, and what does it really mean? C# Corner - Constructor Chaining In C# I was reading over some C# code and came across a weird use of a colon and decided to look into some of its uses to get a better understanding of when it is being used. The stack overflow answer I came across was the most inclusive and helpful for looking into it more, as it described the colon as a "simple syntactic symbols, like [] or {}" as opposed to being a type of operator. The case I was looking at using the colon appeared to be a chain constructor setup. A colon can be used to call another constructor (or the base constructor class) prior to the current one. This led to the next link when I searched for more help on constructor chaining. Examples: public Foo() : base() { } public Foo(int bar) : this() { } public class mySampleClass { public mySampleClass(): this(...

Pokemon Unity Tutorial - More Pokemon [Pt.6]

August 19, 2019 Unity Pokemon Tutorial Encounter List Creation Youtube - Lets Make... Pokemon in Unity! - Episode 6 More Pokemon! By: BrainStorm Games This tutorial is about actually creating BasePokemon GameObjects and using them as a prefabs. The general prefab structure is pretty simple. The object is a SpriteRenderer (with the pokemon's sprite) and has a BasePokemon script attached that just has all the base stats filled in in the editor, along with typing in the name and also hading a sprite reference here. We created 5 different types of this prefab for different pokemon objects and used those to populate the GameManager BasePokemon list. It turns out this list won't be holding every pokemon that exists in the game, this will just the list of possible encounters in the current area. The method for encountering pokemon included creating an EmptyPoke prefab as well, which acts as a placeholder that becomes one of the referenced Pokemon objects from the cur...

Pokemon Unity Tutorial - More Pokemon Integration [Pt.5]

August 19, 2019 Unity Pokemon Tutorial Class Data Management Youtube - Lets Make... Pokemon in Unity! - Episode 5 - More Pokemon Integration By: BrainStorm Games This tutorial focused on creating the Player class and increasing the functionality of the BasePokemon class. The Player class contained a list of OwnedPokemon, which was a newly created class within the Player script. The BasePokemon class added some new features to work with evolution. The PokemonEvolution class was created, which held a BasePokemon that is the next evolution and an int for the level at which the evolution should occur. A PokemonEvolution variable was created within the BasePokemon class which would hold a reference to what pokemon a single one could evolve into. There was also a lot done with the GameManager script. A PokemonMoves class was created that would provide the foundation for all the different types of attacks in the game, as well as a new MoveType enum, which categorized the mov...

Pokemon Unity Tutorial - Player Movement [Pt.4]

August 15, 2019 Unity Pokemon Tutorial Random Encounters Youtube - Lets Make... Pokemon in Unity! - Episode 4 Encountering Pokemon in Long Grass By: BrainStorm Games This tutorial sets up the random encounter mechanic. This starts with the script LongGrass, that deals with 2D colliders to allow for a probability check when the player collides with certain tiles to see if they encounter a random battle and what is encountered. The setup places a 2D box collider on each LongGrass tile that is a trigger. The player character has a 2D box collider (not as trigger) and a RigidBody 2D component. They just set the gravity scale of the RigidBody 2D to zero and that was it. These seems like an improper time to use a RigidBody 2D component as we're just using it to detect a trigger collision. I also tried modifying some values in the RigidBody 2D so it fit the situation better, but none of them interacted with the LongGrass colliders properly. I tried making the Body Type ...

Tutorial - Creating a Realistic Boat in Unity

August 14, 2019 Realistic Boat Physics Unity Harbrador - Make a realistic boat in Unity with C# By: eriknordeus As someone interested in using real world physics and applying it with Unity's physics engine, this tutorial just looked very interesting and promising. It appears they do a lot of work determining buoyancy as well as air and water resistance using the actual mesh of an object. They also split the code up in a nice way, separating a lot of the math into its own class to keep scripts organized and easier to use/read, so I wanted to look into that organizational setup. Overall, this is just a cool project that has a lot of factors I want to learn more about (physics in unity, organizing scripts, applying real world concepts to Unity/games).

HFFWS Object Instantiation and Setting Their Node Values

August 13, 2019 Human Fall Flat Workshop Instantiating Objects with Nodes Youtube - Moving Platform Tutorial in Unity for Human Fall Flat By: Gotcha McFee I just wanted to reference this tutorial again as this is how I got the moving platform in the first place for HFFWS. This also shows why I am interested in the specific components and their values when instantiating the object. This object also has a lot of node graph involvement, which is a big part of HFFWS in general, so it shows why being able to control their values in script is so necessary. Creating Object Spawner I wanted to create a script that could take some of these HFFWS prefabs and start spawning them with various values for their variables to see if I could produce varied objects in real time in the game. This script needs to be able to: Take a prefab reference Access certain components (or children's components) Access the parameters of the components(s) Randomly set them (within a given thr...

HFFWS Moving Platform Tutorial

August 13, 2019 Human Fall Flat Workshop Moving Platform Tutorial Youtube - Moving Platform Tutorial in Unity for Human Fall Flat By: Gotcha McFee To start, they just went to the IntermediateLevel 1 scene to grab a copy of the moving platform prefab from there. They just placed this in a prefabs folder to use later. This moving platform has a ton of script components on it, but the main one they focused on was called "Signal Math Nul". Changing the second input value here changes how quickly the moving platform changes directions. A high value will make it go back to start very quickly, where a low number will take longer (and if it's low enough, it will actually wait at the end point for some time before coming back). Next, they showed that the child object, Axis, controls a lot about how the platform moves. By rotating this object, you can change the direction the platform moves. The other simple variables they show are: Min Value: Normally just keep...

Pokemon Unity Tutorial - Player Movement [Pt.3]

August 13, 2019 Unity Pokemon Tutorial UI and Pokemon Class Youtube - Lets Make... Pokemon in Unity! - Episode 3 Basic Pokemon and UI By: BrainStorm Games This tutorial covered the very basics of starting to get the UI setup in the game, as well as starting the overall base Pokemon class. The UI portion was just grabbing an image and setting it as the image for a Unity UI Panel. To help present the image in a certain way, they did go into the sprite editor to apply an all around 4 pixel border to the image. The base Pokemon class started with two enums, this time for rarity and type. This class, BasePokemon, also references an outside enum that was created called BiomeList, which will set out the different types of environments a Pokemon can be found in. Other than these enums, the rest was just preparing the class by setting up a lot of the variables, like the Name, image, and all the stats (like hit points, attack, and defense).

Pokemon Unity Tutorial - Player Movement [Pt.2]

August 13, 2019 Unity Pokemon Tutorial Player Movement Youtube - Lets Make... Pokemon in Unity! - Episode 2 Basic Player Movement By: BrainStorm Games Player movement in the overworld of Pokemon games is tile based. To emulate this, the tutorial uses a Coroutine which can move the player a full tile at a time while locking the player out from further inputs until the player character has completed its full tile of motion. It also uses a simple setup where it reads the player's horizontal and vertical input, but checks which is greater and reduces the other to zero to ensure the player is moving only on the two intended directions. Since the player is a 2D sprite, they used an Enum setup to tie certain sprites to certain movement directions. This way it would look like the character is facing the direction they are moving. This setup had the 4 directions (North, South, East, West) for the Enum Direction. The player's input would set the Direction variable, current...

Top Down Movement in Unity Tutorial

August 13, 2019 Unity Top Down Movement Brackeys Tutorial Youtube - TOP DOWN MOVEMENT in Unity! By: Brackeys This seemed to fit well with the Pokemon tutorials I was doing recently so I decided to give it a look. It's been a while since I used Animator variables to control 2D animations so this was a nice refresher for that, but they also used Blend Trees which is something I had not seen before. The initial script was very simple. This was a 2D Rigidbody setup, so it's more physics based than the Pokemon tutorial I am doing. As usual for physics in Unity, they do the physics work in a FixedUpdate method, however, they still receive the input in a standard Update method. I always see you should do your physics in FixedUpdate to deal with frame rate variance, but had not seen anything specific about splitting up the input and physics into the two different Updates. The Animator starts by adding two simple parameters: float Horizontal and float Vertical. The Bl...

Using Coroutines to Control Animation in Unity

August 12, 2019 Coroutines for Animation Timings Unity Youtube - Coroutines and Animation: Beyond Beginner Unity Tutorials By: Tom coAdjoint For a Unity project, I needed to control the flow of my program to process an animation fully before moving on to the next operations. Timing concerns normally lead me to coroutines, so I looked into controlling animations with coroutines in Unity. The approach I ended up using for a quick fix solution was just to use WaitForSeconds in Unity. I basically just had the operation start the animation and then WaitForSeconds approximately the duration of the animation (which needs to be hard coded in at this point), and then continue with operation. While this works, it feels a bit clunky and hard to work with. For example, changing out the animation will require changing the time accordingly every time. Also different animations will need different values entered individually. I came across this tutorial linked above which seemed pr...

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 speci...

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 t...

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 Pl...

Unity Clean Architecture - Switch Statements

August 6, 2019 Cleaner Architecture in Unity Switch Statements Youtube - Code Smells - 'Switches' in Unity3d / C# Architecture By: Unity3d College This tutorial just seemed like a nice one to come back to to get some insight on when to use/not use switch statements in Unity, and how to implement them (or suggested replacements) properly. Cleaner coding practices are always helpful.

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 th...