Gridzzly Printable Graph Paper

October 21, 2020

Graph Paper

Design Resources


Title:
Gridzzly Graph Paper Layout


Gridzzly – Main Page

Description:
Site that gives several graph paper-like options that can be accurately printed.


Overview

This site provides a quick and accurate way to make several different graph paper-like designs that can be printed onto paper to sketch ideas and concepts. Along with the general graph paper square pattern, it has a few dot patterns, several other shape patterns such as triangles and hexes, and even a music bar option. These various options can be good for quickly working on some ideas or building out paper prototypes for testing phases.

via Blogger http://stevelilleyschool.blogspot.com/2020/10/gridzzly-printable-graph-paper.html

Open Closed Principle

October 20, 2020

Open Closed Principle

Programming


Title: SOLID Principles in C# – Open Closed Principle
By: Marinko Spasojevic
CodeMaze – Information
Description: Quick coverage of the open closed principle for programming with C# examples.


Overview

“The Open Closed Principle (OCP) is the SOLID principle which states that the software entities (classes or methods) should be open for extension but closed for modification.” This basically means it is preferable to write code in such a way that when a change or extension is suggested for that original class that it can be done through addition instead of modifying the existing class itself. Many of the examples shown do this by adding new classes to handle the additional functionality required instead of modifying the original classes created.

Example #1 – Salary Calculator

The first example they cover somewhat resemebles the factory pattern tutorial I was checking out recently that introduced me to the open closed principle. In this example, they initially create a single class to handle everything. It has a constructor to take in all the members having their salaries taken into accoutn, and then it has a single method handling all the logic of summing all their salaries. As soon as a request for a modification comes in, that single large method within the only class must be edited to accomodate for the new special cases, which clearly violates the Open Closed Principle.

Their suggested revision of the project is what resembles the factory pattern example I was checking out. Instead of just creating the singular SalaryCalculator class, they create an abstract BaseSalaryCalculator class. Next each salary case is broken down into its own class which inherits from this BaseSalaryCalculator class, and these classes internalize all the logic for calculating their salaries so they can individually deal with the differences. Using this approach, if any new options or exceptions need to be accounted for, a new small class inheriting from that BaseSalaryCalculator class can be made without editing any of the existing classes.

Example #2 – Filtering Lists of Computer Monitors

This example provided a list of computer monitors that each had a name, a monitor type, and a screen type. They then needed to be able to filter the list of computer monitors based on the type of monitor. To do so they made a single MonitorFilter class which used a method to filter out the monitors of that specific type and return a list of them. Later they need to add functionality to filter by screen type as well. They accomplish this by adding another method to the existing MonitorFilter class, which again violated the OCP.

Their OCP solution follows a similar idea to the first example, except instead of breaking it down to an abstract class that is then used for several smaller classes with their own logic they use interfaces instead. They create two interfaces, ISpecification and IFilter. The original MonitorFilter class is modified so that it can implement the IFilter interface and is made to be more generic. ISpecification is the interface implemented for the various classes to fit the various filter requests.

MonitorTypeSpecification implements the ISpecification interface and has a constructor that just sets an internal monitor type so that its internal isSatisfied bool method returns true if it matches the monitor type passed in. This is then used in conjunction with the new flexible filter class that creates a list of objects of only those that satisfy the isSatisfied bool within the ISpecification implementing class. Later for the screen type filtering case they create a separate ScreenSpecification class which again implements the ISpecification interface. The only difference in this class is that the Scree enumerator is used and set with the constructor as opposed to the MonitorType enumerator.

Noted Benefits

When working with an already proven and tested system, extending it reduces the likelihood of impacting the full system as opposed to modifying it. Avoiding modifying the original class significantly reduces the chance of changing something that other parts of the system rely on. Extending this way also makes testing easier as it is more likely the new feature can be isolated in testing with this approach, where as modifying the original class likely means that testing of originally tested features may need to be done again since it was more directly modified.

Summary

OCP is a nice philosophy to follow when possible and is extremely applicable to game development projects. Features are modified and added constantly in the game development process, so using an approach like this could prove very beneficial for cleanly and efficiently dealing with the everchaning project. As someone interested in procedural content generation as well, this concept seems very applicable dealing with all the varied but similar features one would encounter with that type of content.

Factory Pattern Basics for Creating Objects

October 20, 2020

Factory Pattern

Unity


Title: Creating Objects in Unity3D using the Factory Pattern
By: Jason Weimann
Youtube – Tutorial
Description: Introductory tutorial to the concept of fatories and the factory pattern in OOP using Unity.


Overview

This tutorial quickly covers the basic idea behind using factories and the factory pattern in OOP through an example in Unity. The overall concept is pretty simple in that it focuses on using an object to create other objects, but they explore putting this idea to use as well as some of the pros and cons of its use.

Notes

Factory: in OOP, an object for creating other objects; a function or method that returns objects of a varying prototype or class (from Wikipedia)
Some of the benefits noted are that this allows you to put all of your object creation into a single place and that you can extend it quite a bit without modifying the underlying logic (following the Open Closed Principle). You do not even need to know the exact type you are expecting to return with the factory since you can return interfaces or abstract classes as well to cover large groups of object types.

Basic Example

In the examples covered, their common practice is to create an abstract class for the type of objects they will want their factory to return. Then any of the objects you want that factory to be responsible for simply inherit from that abstract class. Then the factory class itself is created that uses some method to identify which specific objects to create and uses that information to return the desired objects.

Advanced Example

While not exactly advanced, this example is more in the direction of something that you would actually use. Again the abstract class is created to encompass the objects the factory will return, but this time a Name string with only a getter method is added to this class to help with identification and selection later in the process.

The factory class is much more involved for this example. They create a dictionary that uses the Name values as the keys and the various specific types of the different objects as the values. They then use an Assembly reference to get a reference to each of the different classes inheriting from the initial abstract class throughout the section of the project they are interested in. Using these together they fill the dictionary with all these type references by going through the list gotten from the Assembly reference and adding them to the dictionary.

They then have a method within the factory class to Get an object from it. This requires a string parameter (as this is what is used for the example as the keys for the dictionary created) and uses that to check if that option exists in the dictionary, and if so it creates and returns an instance of that specific type of object.

Final Example

This final example is closest to something they would actually use in a real world situation. The major difference being that they make the factory class into a static class. They use this approach because they do not want to create a new factory everytime they use it, and they did not want to use a singleton pattern because it does not need instantiated in Unity in anyway. This helps make it accessible for anything else to call into it.

While it is not a singleton in and of itself, it does use some similar redundancy approaches to make sure multiple are not created. It has an isInitialized check so that it is only created if it is used at all, and then afterwards it will not create another of itself. It is a bit over redundant, but it works for a quick coverage of the concept in this situation.

Extending the Pattern

One major benefit of this pattern over very basic ways of creating objects covered is how it follows the open closed principle. This is shown after the advanced example by adding another type of object for the factory to return after everything has been built. They create a new class of object again inheriting from that initial abstract class and show that the factory picks up on this and includes it in its options and creates the new object without ever accessing the factory class again. This was cleanly done by just adding its own new class and not modifying any of the previous classes.

Summary

While a very basic concept overall, breaking it down and covering its pros and cons did help me more clearly understand how to look at designing and developing systems to create objects in OOP. This also seems like a nice simple approach to starting to use systems for projects that are not very tiny in size at least, and could be more useful for larger projects when you have a better understanding of how to utilize it in a more complex manner. On a side note this also exposed me to the open closed principle which makes a lot of sense as something to strive for when looking to create more stable projects.

Basics of Dependencies in Unity

October 19, 2020

Dependencies

Unity


Title: Dependencies in Unity
By: Infallible Code
Youtube – Tutorial
Description: Covers the basics of dependencies in programming, with a focus on them within Unity and how they deal with expensive method calls.


Overview

This tutorial nicely breaks down dependencies in programming in general in a very basic and understandable way. This is good for defining it well at the foundational level. It also covers some of Unity’s more expensive method calls and the different ways to cache these results, as well as the different ways to organize and manage dependencies within Unity specifically.

Notes

Dependency: When one object relies on another to function.
The initial example in this tutorial nicely shows how improper code can also hide dependencies. Since they were using FindObjectOfType in the Update method (an extremely expensive and inefficient process), it could be lost that that class was dependent on the Inventory object. Creating a private variable at the class level to hold that data and caching it in the Awake method makes it more much clear, exposing the dependency on the Inventory object.

Dependency Management Techniques

Dependency management techniques are just the ways your classes are accessed by the objects they depend on. There are two major groups for this: internal resolution and external resolution.

Internal Resolution

When an object is responsible for resolving its own dependencies
Accomplished by:

  • Instantiating new instances
  • Using factories or the factory method
  • Using Unity’s built in getters (i.e. GetComponent, FindByComponent)

External Resolution

When an object receives its dependencies from another object
Accomplished by:

  • Constructor parameters
  • Public fields and setter methods
  • Serialized fields

Examples of Using (Or Not Using) Different Methods

Some examples covered:

  • Do NOT use GetObjectOfType if you will have multiple objects of that type
  • For very simple cases, the external serialized field option is common practice
  • Serialized field does not work well if object is loaded dynamically
  • Dynamically loaded objects can usually use an initialization method that acts like a constructor
  • Dynamically loaded objects can also use constructors if they are normal C# classes, but monobehaviours do NOT support constructors

Extenject

Dependency injection is just another word for external resolution. Extenject is a dependency injection framework that manages all the dependencies across your entire project. Extenject can be very useful, but can quickly overcomplicate smaller and simpler projects.

Adding Details to Enhance the Player Character

October 16, 2020

Detailing and Enhancing

Player Character


Title: 6 DETAILS TO MAKE A GREAT PLAYER CHARACTER – UNITY TUTORIAL
By: Blackthornprod
Youtube – Tutorial
Description: Tutorial on adding a few small details to enhance the feel of the player character.


Overview

I came across this tutorial that covers a few quick ways to add some details to a player character to make them feel much more fun and interactive to use. They used Hollow Knight as a base for the types of details they were looking to add. The key details they created were: landing animation, jumping/landing vfx, moving vfx, background interaction while moving, and jumping/landing sound effects.

While on the simpler side, these are all very nice features to add that can quickly make your character much more enjoyable to use. As an important side note they mention, this can actually be beneficial to the developer because it can make them for motivated to work with the character.

Exploring Unity’s New Input System Further

October 15, 2020

Input System

Unity


Title: How to use the new Input System in Unity3D
By: Coding With Unity
Youtube – Tutorial #1
Description: Indepth tutorial on implementing Unity’s new input system along with programming its use.


Title: New Unity INPUT SYSTEM – Getting Started
By: Dapper Dino
Youtube – Tutorial #2
Description: Quick tutorial using Unity’s new input system and using it with programming.


UPDATE

Title: Unity Input System | How to Use Input Action Assets
By: Infallible Code
Youtube – Tutorial #3
Description: Good all around tutorial for getting started using Unity’s new input system.


Title: Unity Input System Quick Start Guide
By: Unity
Unity – Input System Documentation v.1.0
Description: Unity’s documentation on the new input system.


Overview

I have already tested using the new Unity input system a bit and it seems promising so I wanted to explore it further. These tutorials show it in use on a more in depth level so I expect them to show me some more ways to utilize it properly. The documentation was also included as it is useful to find any methods I may need to keep everything together and working.

Update

I found another good tutorial by Infallible Code that I have added. I think it covers the foundational work of using the new input system better than the other tutorials and gives a better explanation of what the generated class from the input system is actually doing. This makes using it much more sensible.

Resetting Keybindings with New Unity Input System

October 14, 2020

Rebinding Keys

Unity – New Input System


Overview

I have been trying out the new Unity input system to see if it is worth using instead of the older method of building out everything yourself. In this process I wanted to make sure it had a way to rebind keys since this is a gigantic feature to have in almost all games. I was able to find that there are several different ways to change keybindings with the methods found in Unity’s documentation on the new input system found here:

Unity Editing Keybindings for New Input System Version 1.0

The two main methods I am focused on currently are ApplyBindingOverride and PerformInteractiveRebinding. PerformInteractiveRebinding allows for keybinding modification by the player at runtime, and is a quick way to implement a feature commonly found in many games where the player selects an action to change the keybinding for and the game awaits their input to set the new keybinding to that input. I do not think this change is saved inherently however, which is where the other method comes in.

ApplyBindingOverride allows the system to override the default keybinds set by the game originally. So after using PerformInteractiveRebinding methods, that data can be saved to then later be utilized by the ApplyBindingOverride method to reapply the keybind changes every time the game is started. This helps it fall in line with how the feature is utilized in most games in a very convenient and user-friendly way.

Creating an Input Buffer System for an Action Game

October 13, 2020

Input Buffer System

Game Development


Title: Character Action Game Development Tutorial 8– Input Buffer
By: Tyra Doak
Youtube – Tutorial
Description: Small segment of a tutorial list that focuses on creating an input buffer system in a 3D action game.


Overview

Having input buffering in a game can help a game feel much more responsive and smoother to a player, especially in hectic, fast paced gameplay such as fighting games or action games. This tutorial has a large emphasis on building out their input buffering system for their 3D action game so this is right in the prime territory for the type of game I am interested in building an input buffering system for as well. They also show a decent visual display of the frame data at the top of the screen during play mode that could be an ok starting point to help with starting to build frame data focused systems.

6 Design Patterns for Game Devs by Jason Weimann

October 8, 2020

Design Patterns

Game Development


Title: The 6 Design Patterns game devs need?
By: Jason Weimann
Youtube – Tutorial
Description: Quick coverage on 6 general design patterns often used for game development.


Overview

This video quickly covers a lot of design patterns or design pattern-like architecture that are often used in game development. These include: singleton pattern, observer pattern, command pattern, component pattern, flyweight pattern, and state pattern. I have experience with most of these so this seems like a good video to cover all of them quickly to give me another view on them on how they might be utilized, as well as seeing if there are any I haven’t used that could be good to keep in mind.

Workflow from Aseprite and Photoshop to Unity for Sprite Art

October 7, 2020

Aseprite & Photoshop

Unity Workflow


Title: Improve your WORKFLOW using Aseprite/PS with UNITY
By: Dev!Bird
Youtube – Tutorial
Description: Tutorial showing workflow of creating sprites in Aesprite and Photoshop and importing them to Unity.


Overview

I initially looked into this because Aesprite is a software I have been interested in but haven’t looked to far into it yet. Seeing how easy it is to work with and import your work into Unity here definitely makes me interested in looking to get it if I want to do some more focused sprite work again in the future. Aesprite’s focus on sprite work making it rather simple to use but effective for both still images as well as animation make it a very appealing tool if you do not need the sophistication of Photoshop.