Modding Monster Train – Editing Name of Champion Tutorial

June 22, 2021

Modding

Monster Train


Title:
Monster Train – Shiny Mark mades mods

By:
Good Shepherd Entertainment


Youtube – Tutorial #1

Description:
Extremely basic introduction to setting up a C# project for modding Monster Train (slightly outdated).


Overview

This was an introductory tutorial mostly meant to help you learn how to setup a C# project to mod Monster Train. It has however become slightly deprecated since the DLC was launched, however it did lead to me gaining a better grasp on the logging system for debugging.

Following Tutorial

This tutorial is rather straight forward, but even this had its fair share of issues. One of the first major blocks I ran into and resolved was how strict Harmony is with some of the ways it interacts with the base game code. Specifically, the __result parameters used in the Postfix() methods specifically require EXACTLY 2 underscores before ‘result’. This is actually just part of their system of naming conventions, and is further explained in other Monster Train modding documentation.

The other issue I encountered is that one of the renaming conventions was not working. I was able to change the name on the card (the CardState change), however changing the name while the unit was in the train (the CharacterData change) was not performing as expected. I was able to find through logging that the method being called was indeed returning the string “Hornbreaker Prince” and my system was identifying that, but for whatever reason the result was not changing the ‘in train name’. My suspicion is that an updated underlying system is actually returning the name of the unit back to ‘Hornbreaker Prince’ and it also needs to be changed somewhere else, but I am unsure where that would be.

Either way, changing the name of a card can be done in better ways so this issue does not particularly need resolved. Some others mentioned going through Monster Train’s localization system to find a better place to change the name of a card.

Confirming Updated DLC as Error

To check that this was not just an error in my code or program, I downloaded the existing mod created in the above mentioned tutorial (as it is available in the Steam Workshop). Sure enough, even though it is seen working in the old video, the download of that mod had the same result as my mod. The name on the card was changed to ‘Frank’ but the name on the unit in the train was still ‘Hornbreaker Prince’.

Fig. 1: Showing Side by Side of Where the Name Change Worked and Did Not Work

via Blogger http://stevelilleyschool.blogspot.com/2021/06/modding-monster-train-editing-name-of.html

Unity Shader Graph – Grid Shader by UGuruz

June 16, 2021

Shader Graph

Unity


Title:
Grid Shader in Unity LWRP – Shader Graph Tutorial

By:
UGuruz


Youtube – Tutorial #3

Description:
Experimenting with tiling and the rectangle node in Unity Shader Graph to create a Tron-like glowing grid pattern.


My Final Grid Shader Graph (w/ Color Change Addition)


Overview

Following my exploration of Unity’s shader graph, I did this tutorial by UGuruz on creating a grid shader similar to what you see in Tron. I really liked the effect so I continued it slightly further by adding a color changing effect over time, as can be seen in my examples provided.

Learnings from Tutorial

Using a Fraction node with a Tiling & Offset node is an effective way to give you standard expected tiling and offset results. I however had some strange effects because of interactions with the UVs of the models. The base UVs of just a standard Unity cube did not tile effectively for me, so I tried using Unity’s ProBuilder to make a basic cube since that also gave me easy access to modifying UVs if necessary. This gave me much more consistent results similar to those in the tutorial, since I wanted to avoid the step of modifying UVs in Blender.

They mentioned the shader would only work well on flat surfaces, but I at least wanted to test on another surface to see what the result would be and see if I could improve it. That’s why I included a sphere in the environment. It immediately gave very strange results as expected, but I found that grouping faces together through the ProBuilder tool helped give a better result, as this allows it to treat the many faces of a sphere similar to a single large face. This concept works well with a basic tiling pattern like I used here.

I did end up using World type UVs to get a decent visual result on everything, especially the sphere. While this gave something very close to what is desired, it is still a somewhat strange appearance when viewed from some angles as this inherently treats the positioning in world space as the coordinates for applying the shader. I still need to investigate the UV types and UVs in general though to get a better understanding of how to control them.



Unity Shader Graph: Tutorial by UGuruz with Color Change Addition from Steve Lilley on Vimeo.

Video Example of the Grid Shader Result with Color Change Addition

via Blogger http://stevelilleyschool.blogspot.com/2021/06/unity-shader-graph-grid-shader-by-uguruz.html

Unity Shader Graph Examples and Tutorials

June 10, 2021

Shader Graph

Unity


Title:
FORCE FIELD in Unity – SHADER GRAPH

By:
Brackeys


Youtube – Tutorial #1

Description:
A quick introduction to shader graph in Unity making a transparent force field with glowing edges.


Title:
ART 200: Creating an energy Shader in Shader Graph in Unity

By:
Casey Farina


Youtube – Tutorial #2

Description:
An introduction to using noise effects in Unity Shader Graph to create a glowing generic energy effect.


Title:
Grid Shader in Unity LWRP – Shader Graph Tutorial

By:
UGuruz


Youtube – Tutorial #3

Description:
Experimenting with tiling and the rectangle node in Unity Shader Graph to create a Tron-like glowing grid pattern.


Title:
Unity Shader Graph Tutorials – Youtube Playlist

By:
Gabriel Aguiar Prod.


Youtube – Playlist #1

Description:
This user creates tons of VFX tutorials for games, and has delved into Unity’s Shader Graph, giving great examples of quick but well done effects.


Title:
Unity Shader Graph – Ice Tutorial

By:
Gabriel Aguiar Prod.


Youtube – Tutorial #4

Description:
Creates a stylized glowing, transparent ice shader to use for crystaline ice formations.


Title:
Unity Shader Graph – Shield Effect Tutorial

By:
Gabriel Aguiar Prod.


Youtube – Tutorial #5

Description:
Similar to Brackeys force field tutorial, but covers extra steps to push the effect over the edge.


Title:
Shader Graph fundamentals in Unity

By:
PabloMakes


Youtube – Tutorial #6

Description:
General coverage of a lot of commonly used nodes and tools within Unity’s Shader Graph.


Source: Unity.com

Overview

I wanted a quick way to apply some interesting effects and looks to different models I work with in my sample projects, and making cool materials and shaders seemed like a perfect tool for that. You can get some neat effects without too much effort, and as you make these tools they are easily applicable over multiple projects and give me a tool to use over and over again.

Coding shaders in HLSL for Unity can be a bit tricky, so meeting them in the middle and working with Unity’s Shader Graph was a good compromise for me. This could give me results even quicker without sacrificing too much for what I will be doing. As such, I gathered this large source of resources for learning and exploring Unity’s Shader Graph system.

Quick Notes

URP vs HDRP

HDRP is for more high end games and devices (PC, XBOX, PS) but is more demanding. URP is better for 2D projects in general, and is made to be more accessible and less demanding.

URP vs Deprecated LWRP

Many resources, including some of these tutorials, used Unity’s Light Weight Render Pipeline (LWRP). This has already been phased out and replaced by the Universal Render Pipeline (URP). So it is generally safe to use the URP system if a tutorial or example uses the LWRP.

PBR Graphs Replaced with Lit Shader Graphs

Some of these old tutorials also use PBR graphs, which have also been phased out already. They can be replaced with Lit Shader Graphs. The PBR master node within the graph has also been broken up and replaced in newer Unity projects by two nodes, a Fragment node and a Vertex node (makes it more similar to shader coding).

via Blogger http://stevelilleyschool.blogspot.com/2021/06/unity-shader-graph-examples-and.html

Game Project: Flying Game – Part 5 – Projectile and Environment Interaction (Part 2)

June 8, 2021

Flying Game

Projectile


Overview

I wanted to have the player projectile add force to objects that it came in contact with. This originally was just to prevent strange occurrences where originally if the player hit obstacles sitting on top of others, nothing would happen since the only force moving them at all was gravity. This additional force adds some extra displacement to make sure that whenever any objects are hit, there is some dramatic impact.

Voxelized Environment Obstacles Update

IDestructible Interface Update for Voxel Obstacle Element Class

This interface is implemented by the individual voxel obstacles. It originally just had a Destroyed() method, but with this update I wanted to add a secondary method to deal with simply being hit at all, so I added a Damaged() method. I then also renamed the Destroyed() method to EndLife() since it may not necessarily be destroyed when its job is done.

Internal Hit Cooldown Timer

Because the objects were receiving forces from various angles and running into other elements, sometimes objects could quickly be pushed slightly out of the projectile and then be hit again by the same projectile and receive another boost in force applied. To prevent this, I added an internal hit cooldown timer to the individual elements so that they would not react again until a certain time had passed. This will most likely be set to a relatively low time (i.e. <1s), but as can be seen in the test video a timer of about 10s is used just to check its validity.


Video: Sonic Boom Projectile and Obstacle Internal Timer

via Blogger http://stevelilleyschool.blogspot.com/2021/06/game-project-flying-game-part-5.html

Exploring Vector Math with Unity – Dot Product

April 23, 2021

Dot Product Unity Project

Vector Math


References

Dot Product Wiki


Wikipedia – Link


Falstad Dotproduct Online Visualizer


Falstad Visualizer – Link


Fig. 1: My Updated Visualizer at Work

Overview

I wanted to explore vector math as a refresher for myself while also creating ways to visualize it through Unity. The dot product seemed like a good focal point to start with since it is such a useful tool in game development but can be a bit strange to fully understand the full reach it has. I took a lot of inspiration from the Falstad visualizer on how to visually represent this.

While similar to the Falstad visualizer, I wanted to create a 3D representation instead of a 2D one. I wanted to have a tool that creates two manueverable vectors that would show all the values of those vectors, as well as their dot product and the projected vector from one onto the other. While most of the math and systems behind this are practically identical in the 3D case, interacting with the vectors becomes a much trickier problem.

Dragging Objects Around 3D Space

I ended up following a tutorial on a really simple 3D dragging setup found here:

Unity Object Dragging || Tutorial: by Kjip

Youtube – Link

This provides a very quick and simple setup that at least allows the user to move objects around in 3D space using the screen to world point methods of Unity. Their exact solution however did not work for me, as the object would always gravitate to the exact position of the camera, eventually leaving it too close to interact with.

The Vector3 they were feeding into the ScreenToWorldPoint method was determined as such:



Vector3 mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.transform.position.z + transform.position.z);

I eventually just removed the additional transform.position.z of the object added into this vector, which provided a fixed distance from the camera plane to the object at all times. This at least constantly kept it in frame, and allowed decent manueverability. The range of motion is a little weird, but it works well enough for now. I eventually just changed the entirety of the z portion of the vector to a variable float controlled from the inpspector since tying it to the camera position didn’t make any sense at this point.

Visualizing the Vectors

Line Renderers

This is the most straight forward way since I can just put in the two end points of a vector as waypoints of the line renderer to directly render that vector in 3D space. However, overlapping line renderer visuals leads to poor rendering in many cases, which is not ideal for showing the overlap of the projected dot product vector with the vector being projected on to.

Rotating/Scaling a 3D Object (Cylinder)

After trying line renderers for a while, I swapped over to using primitive cylinders as a basis for the vectors. By setting the cylinders as children of an empty container gameobject, I was able to falsely move the anchor point of the cylinder for scaling to the base of the cylinders. This allowed me to scale this container to match the exact size of the vector, and this would exactly match up the size of the cylinder while also making sure it specifically scaled up/outward from the origin of the visualization.

As for rotating the cylinder to match the individual vectors, this could easily be done by setting the up vector of the cylinders. This looks like:



cylinderA.transform.up = vectorOfInterest;

Video Samples of My Project

The following links show my first prototype of this project with the line renderer visuals, and the first update using cylinders and some cleaner camera controls.

Vector Projection Simulation – Dot Product – Prototype from Steve Lilley on Vimeo.





Vector Projection Simulation – Dot Product – Update 1 from Steve Lilley on Vimeo.

via Blogger http://stevelilleyschool.blogspot.com/2021/04/exploring-vector-math-with-unity-dot.html

Unreal Tutorial – Unreal Engine 4.26 Beginner’s Tutorial: Make a Platformer Game – by DevAddict

April 15, 2021

Tutorial

Unreal


Title:
Unreal Engine 4.26 Beginner’s Tutorial: Make a Platformer Game

By:
DevAddict


Youtube – Tutorial

Description:
A large tutorial focusing on fleshing out the functionality of a given project and assets in Unreal.

Summary

This was one of the tutorials from my “Intro to Unreal: Basics Tutorial Compilation” post. This ended up being a great introductory tutorial where the first half provides a lot of information on just the basics of moving around the Unreal editor and basic level building, and the second half delves into blueprints and how to read them, modify them, and creat your own. The focus is on building a 3D platformer with an Unreal learning project that is provided, and most of the basics for that type of game creation are all covered here.

Notes and Lessons Learned from the Tutorial

Keyboard Shortcuts

End (while moving an actor): drops that actor directly to the ground plane below it


Ctrl + W (In Blue Print editor): duplicates currently selected nodes/node system

Editing a Static Mesh

Opening Mesh in Mesh Editor:

With a static mesh selected in your level, you can double click the Static Mesh component in the Details tab to open that mesh in the Mesh Editor.

Collision:

The Collision dropdown (Show Collision button) near the top of the Mesh Editor allows for visualizing the collider(s). If nothing appears, your mesh is probably missing colliders.

Auto-Collider Generator and K-DOP

The Collision tab further up can be used to create and apply simple colliders quickly. The K-DOP collider creater is a “type of bounding volume that basically takes K axis-aligned planes and pushes them as close to the mesh as it can, where K is the number of planes.” So 6DOP presses 6 planes against the mesh, and 18DOP pushes 18 planes against the mesh for example.

The Auto Convex Collision option opens the Convex Decomposition tab, which is used to create more complex meshes that more accurately represent the surface of the Static Mesh. The Collision properties of the mesh area found in the Details tab within the Mesh Editor. Here are many of the important collision options.

Collision Presets:

This is similar to the concept of using layers for collision in Unity, where you can determine what this collider actually interacts with. A common choice is “BlockAll” for environmental obstacles as this will cause it to collide with everything.

Editor Settings

Change Editor Camera Position Exiting Play Mode:

I really did not like that when exiting play mode for quick testing that the editor camera stayed in the exact same position as the player camera when I ended play mode (so basically the camera appears to not change at all when leaving play mode). I preferred if the editor camera returned to where I had it positioned before entering play mode to test, and found that there is a setting in Editor Preferences for this case.

Editor Preferences -> Level Editor: Viewports -> Look and Feel -> Uncheck “Use Camera Location from Play-In-Viewport”

Pain Causing Volumes

Pain Causing Volumes can be used to create a death plane in your game if the player falls into a pit or on some other dangerous floor. This is can be found in the “Place Actors” tab.

Setting Up a Physics Object

There is a Physics section in the Details tab of many actors and meshes. Turn on “Simulate Physics” here. Then under the Collision section, the Collision Preset “PhysicsActor” can be used, along with the Object Type “PhysicsBody”.

Game Mode

This is a section found in the World Settings. Most projects will have a GameMode Override used (the default for a new project is usually none however).

Level Sequencer

The Level Sequencer is its own window to help control the timeline of events and animations of objects throughout the level. In this tutorial, it was used to help control the infinite periodic movement of moving platforms.

Adding Actors to Level Sequencer:

Within the Sequencer window, go to “+ Track” and hover “Actor to Sequencer”. From here, a list of all possible actors comes up which can be added. You can also select an actor before this, and it will appear at the top of the list to make it easy to quickly add the currently selected actor to the Sequencer.

Widgets

Widgets are elements which make up the HUD or UI of the screen of the game.

Editing Text:

By default, text objects are not variables and are expected to be relatively static. If you want to have text that updates, like a collection counter of some kind, you need to make sure in the Widget Designer to check that a specific Text “Is Variable”, which can be found in the Details window. This appears to be similar to making a public text variable that is accessible in your blueprints.

Input Settings

You can get to the Input Settings through:

Edit -> Project Settings -> Engine-Input

Again, this is similar to the Input Settings in Unity where specific names or labels can be given to different actions which can then be tied to specific key bindings or joystick inputs. These names/labels can then be used in blueprints with nodes such as the InputAction node.

This approach is good to keep your inputs more organized. Your blueprints will be clearer since the name of the action will be there instead of arbitrary inputs like key “K”, and this makes it easier to modify inputs later if you want to change keybindings.

Blueprints Notes from Tutorial

This section covers many of the blueprints related notes that are given throughout the tutorial.

Within a Blue Print, in the Event Graph, some events can be added directly to components by selecting options presented in the Details tab for the currently selected component. For example, this tutorial starts with the checkpoint blue print and its sphere collider uses one of these events named “On Component Begin Overlap”. Selecting this immediately creates an event node in your event graph of that type referencing the currently selected component.

A lot of important information for your blue print can be found in the “My Blueprint” tab. This displays information such as the various functions and variables throughout the current blueprint.

Components can be dragged into the Event Graph from the Component tab to quickly use them as references for your blueprint.

Ctrl + W (In Blue Print editor): duplicates currently selected nodes/node system

Finding Variable References:

Select a variable under “My Blueprint” and right click and select “Find References”. This generates a list of references at the bottom of the editor which shows everywhere that variable is used. These can then be double-clikced to directly take the user to that specific reference.

Splitting Pins:

Some pins can be split into their more basic components in blueprints when necessary. This is done by right-clicking DIRECTLY on a pin, and selecting “Split Strcut Pin”. The example seen in this tutorial split a Transform pin so it then became 3 separate pins: position, rotation, and scale. These can then separately be connected into other pins.

IsValid Node:

Determines if input is valid or not, and performs functions based on the result. This can be used as a way to perform null reference checks to make sure to only do something as long as an input even exists or not.

PrintString Node:

Similar to the Debug.Log method in Unity, can be used to determine notes to be output as string data to check and debug blueprint maps.

DestroyActor Node:

Similar to the DestroyGameObject method within Unity, this is a quick and dirty way to remove something from existence in Unreal.

Auto Finding Proper Data from Variables Between Pins:

Sometimes you can drag a pin of one variable/class type to a pin of another variable type and it will add inbetween nodes to get a variable of the appropriate type for you that is contained within that class. For example, when connecting the actor pin of the OnComponentBeginOverlap node to a PrintString node’s string pin, it will add a GetDisplayName node in between to make sure it is passing the string data of the name of the object of interest into the PrintString node.

Casting Actors for More Detailed Variable Modification:

Many nodes work with Actors in blueprints, but often you need to adjust variables within deeper classes. When you need to start with a general node, but access a class inheriting from Actor, you can use a “Cast To …” node to get access to the proper tools. After casting to your designated class, it is then possible to modify the variables and values within that class.

The example from the tutorial is that the BP_jumpBoost wants access to the player character to modify their jump value. Since this is done when they collect the powerup, it starts with an OnComponentBeginOverlap node. This can return the other actor that collided with it, but they then need more detailed information to modify the jump value of the player character that collided with it than that it is just an Actor. This is done by a CastToEpicCharacter node that receives the OtherActor pin data from the OnComponentBeginOverlap node. This converts it to a more specific class, where the jump velocity can then be set as wanted.

This tutorial then suggests that using interfaces is another way to achieve a similar goal in these situations. They even prefer interfaces, but both appear to be valid approaches.

Adding Variables:

1) They can be added under the My Blueprint window within the blueprint

2) Select a variable pin, right-click, and select “Promote to Variable” (similarly to Houdini)

Variables in Details Window:

Displaying:

This can quickly be done by making the variable public. This can be done by clicking the eye icon next to the variable in your blueprint, making sure it displays an open eye (indicating the variable is now public).

Organizing:

Similar to having headers in Unity to group variables, Unreal does this with Categories. Just select the variable in your blueprint, and the Details window has a section named Category where a dropdown shows all the previously made Categories this variable can be placed in. If you want to make a new category to place the variable into, just type a new name there.

Controlling Variables:

Similar to Unity, public variables within the blueprints can also be given limits and controls for better usability in the Details window. For example, you can add a slider range to a variable which creates a slider in the Details window which can be dragged within the given minimum and maximum values.

Branch Node:

Foundational conditional statement for blueprints to do various events if true and/or false



Shortcut: Hold B + Left-Click (in Event Graph)

OnComponentBeginOverlap and OnComponentEndOverlap nodes:

These are similar to the OnCollision… Enter and Exit methods within Unity. They help determine what actions to take when something enters a collider, and what actions to take when leaving a collider.
Solely entering a collider is common when collecting objects, whereas entering and exiting a collider is common when certain actions by the player can only be performed when they are with a certain proximity to an object (such as being able to open a door), since you need to allow the object to receive input from the player while they are close, but then again stop receiving input once the player gets too far away.

Sequence Node:

Used to sequentially perform a number of methods in a designated order.

Making Your Own Blueprint; Common Components:

Static Mesh & Collider (of some type)

Creating Events and Functions:

Similar to the events and functions already present in Unreal, you can also create your own custom versions of these. These can then be called from other locations as long as they have a reference to the overall class, similar to calling methods of other classes in Unity or programming.

Fig. 1: Image from my Platform Setup with Sequencer in Tutorial

Summary

I think this was a very solid tutorial overall that made me feel much more confident in working with Unreal, especially when it comes to interacting with the blueprint system. I am starting to be able to draw parallels between Unreal’s blueprints and the code used to perform similar actions in Unity which is helping me start to understand adding functionality to objects in Unreal. One major difference is just that Unreal already offers so much to the designer immediately upon creating a new project that will just require experience to learn what is already there. For example, blueprints like those for the background game mode do a lot of work you might create for a game manager class or something similar in a Unity project.

Blueprints are also just so numerous that finding what you want as a beginner to the system can be too overwhelming to be practical. Simply having more experience helps understand the more commonly used ones however, like collider overlaps and branches, so I think just a few more tutorials will allow me to start building my own small projects.

via Blogger http://stevelilleyschool.blogspot.com/2021/04/unreal-tutorial-unreal-engine-426.html

TRANSLATING PHYSICAL PHENOMENA INTO GAMES (CONT.)

Presentation Sources, Jan 5, 2018

Engineering Mechanisms as Game Elements

Mechanisms (Engineering) – Wikipedia

“A mechanism, in engineering, is a device that transforms input forces and movement into a desired set of output forces and movement.”

Examples of Mechanisms:

  • Gears and Gear Trains
  • Belt and Chain Drives
  • Cam and Followers
  • Linkages
  • Friction Devices

Example Games Dealing with Engineering Mechanisms

Gears – FantasticChoice – Flash Game

This game has one intitial gear powered by a robot, and the player must place gears to fit between that initial gear and the goal gear to get it to rotate the correct direction. Main focus of the game is spacially fitting different sized gears, and understanding resulting direction of rotation on other gears.

The Incredible Machine 2 – Gameplay Video

Game where the player places goofy components in order to create a Rube Goldberg device to obtain some goal or objective.

TRANSLATING PHYSICAL PHENOMENA INTO GAMES (CONT.)

Presentation Sources, Jan 4, 2018

Example Games Dealing with General Relativity

Velocity Raptor – Online Flash Game

This is a game by TestTubeGames that covers some general consequences of general relativity, such as length contraction, time dilation, and the light doppler effect.

A Slower Speed of Light – Video Trailer

This is a game developed by the MIT Game Lab where the collectibles lower the speed of light, which allows the player’s normal speed to come close to the “universal speed limit”, creating more observable consequences of general relativity. This is open source, and works with Unity, so they allow anyone to access the coding behind it to use it as a sort of engine for a game.

Example games Dealing with Conservation of Energy and Temperature

PhET States of Matter Simulator – Online Simulation

This is an online simulation of different substances in different states of matter, and how altering the temperature and pressure changes how the particles of the substance move.

Total Energy Jump – Legends of Learning – Online Game

This is another Legends of Learning game. The player is a frog that has to jump from platform to platform, but each jump results in kinetic energy which heats the frog. When the frog overheats, the player must answer questions pertaining to energy to cool down and continue.

TRANSLATING PHYSICAL PHENOMENA INTO GAMES

Presentation Sources, Jan 3, 2019

Example Games Dealing with Light

Lazors – Mobile Game
Refraction – Mobile Game
Tilted – Mobile Game
Legends of Learning – Games on Transmission and Refraction of Light

Legends of Learning is a site that has many educational based games that are small and simple, normally covering one or two main subjects at a time.

PhET Lens Simulation

PhET is a non-profit open education resource project centralized in University of Colorado Boulder, and founded by Nobel Laureate Carl Wieman.