Posts

Showing posts from March, 2020

UnityLearn - AI For Beginners - Navigation Meshes - Pt.02 - Navigation Meshes

March 30, 2020 AI For Beginners Navigation Meshes Navigation Meshes Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Navigation Mesh Introduction Nav Mesh: Unity function for making a navigable area for agents to traverse over. There are 4 main tabs in the Navigation window: Agents Area Bake Object Agents Core Parameters: Radius, Height, Step Height, Max Slope These dimensions determine where the agent can fit when navigating around obstacles, as well as how it can traverse elevation differences. Radius and height help limit where a character can go (cannot go between very small gaps or under objects very close to the ground) where step height is the elevation difference it can traverse in a single jump and max slope is how inclined the surface can be for the agent to travel on. The name allows you to save several types of agents, with various values for these 4 core parameters. Area How you define different costs for diffe...

A* Architecture Project - Spawning Agents and Area of Influence Objects

Image
March 25, 2020 Updating A* Spawn and Area of Influence Objects Spawning Agents Goal: Ability to spawn agents in that would be able to use the A* grid for pathing. Should have options to spawn in different locations and all use grid properly. This was rather straight forward to implement, but I did run into a completely unrelated issue. I created an AgentSpawnManager class which simply holds a prefab reference for the agents to spawn, a transform for the target to pass on to the agents, and an array of possibl spawn points (for incorporating the option of several spawn locations). This class creates new gameObjects based on the prefab reference, and then sets their target to that determined by the spawner. This was something worth tracking since sometimes there can be issues with Awake and Start methods when setting values after instantiation. This was all simple enough, but the agents were spawning without moving at all. It turns out the issue was that the spawn location was a...

UnityLearn - AI For Beginners - Waypoints and Graphs - Pt.01 - Graph Theory

March 24, 2020 AI For Beginners Graph Theory Graph Theory Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Graph Theory Intro The AI for Beginners course starts very basic so I have not covered a lot up until now. It handles the basics of moving an object with simple scripting, as well as guiding and aiming that movement a bit. This section starts to get into some more interesting theory and background for AI. Graphs are simply collections of nodes and edges. Nodes are locations or points of data, and edges are the paths connecting them (which also contain significant data themselves). There are two directional types for edges within these graphs: directed and undirected. Directed paths only allow for movement between two nodes in a single direction, while undirected paths allow for movement either direction between nodes. Graphs are used in any case to move between states. These states can be real states or conceptual states, so the...

Updating A* to Move Units in 3D for Elevations (Cont.)

Image
March 12, 2020 Updating A* Adding 3D Movement (Elevations) A* Current System and Notes Now the A* system can deal with moving units along the y-axis according to the terrain, but it is still off with the advanced path smoothing functionality since this only cares about points where the unit is turning according to the xz-plane. To keep the system more simplified for now, I am looking to roll back some of the more advanced functionality from the Sebastian Lague tutorial I followed to incorporate the y-axis movement into a more simplified pathing system. I want to ignore the SimplifyPath method for now (which narrows down the full list of nodes for a path down to only those which turn the agent, and only uses these as waypoints), which also causes problems if I have path smoothing as well. This is another reason to remove path smoothing temporarily. A* Update I wanted to keep the advanced path smoothing options available in the project, while looking to use the simplified ver...

HFFWS Thesis: Clearly Determining Space for Scenarios and Creating Barriers Between Them

March 11, 2020 Spacing Scenarios and Dividing with Obstacles Thesis Project Space Buffering In the process of creating a simplified version of this generation system, I narrowed down the variability for now with a core focus on better defining the space a scenario has to work with. To keep it easier to work with, it is focused on a single axis for the most part, the x-axis, in spacing. This ties in to making the general space easier to define as well. The overall spacing is mostly determined by spacing on the x-axis. The entire sequence of scenarios is constrained to a single overall platform with a fixed width, so every scenario is working with that same fixed width as well. The height does not particularly need to be constrained at this time, so determining a general x and z dimension for the space with an arbitrarily given y dimension works to define our space well for now. Finally, to help visualize this space in the editor, I looked to DrawGizmos methods within Unity. I a...

Updating A* to Move Units in 3D for Elevations

March 11, 2020 Updating A* Adding 3D Movement (Elevations) A* Current System The current A* system I am using solely works on a 2D plane (on the x-axis and z-axis). It creates a grid on this 2D plane and then allows agents to move specifically along this 2D plane, with no regard for heights. It is currently casting rays from above these grid nodes to detect the layer of the terrain the node is on. Each node also casts a small sphere the same size as it to detect collision for obstacles to determine if a node is traversable or not. A* Update Since the system already uses raycasts to detect the terrain type, I edited this to detect the height information from the terrain as well. Using RaycastHit.point, the raycast can return information on the exact point it hits, so I can pass the y-axis information from here to the node. I just do this along with the terrain detection, and pass this to the world position data of the node. Since this update is specifically targeted at work...

UnityLearn - AI for Beginners - The Mathematics of AI - Pt. 01 - Cartesian Coordinates

March 6, 2020 AI for Beginners The Mathematics of AI Cartesian Coordinates Artificial Intelligence for Beginners Unity Learn Course - AI for Beginners Cartesian Coordinates Cartesian Plane Cartesian coordinates: used to determine locations in space for any number of dimensions generally used for 2D and 3D space in games (x, y) and (x, y, z) 2 Main Projection Types: Orthographic and Perspective Orthographic: 3D space represented by a cube or rectangular prism Perspective: 3D space that looks like a rectangular pyramid with its top cut off The Camera size in Unity when using the Orthographic perspective dictates how far the camera sees for the smaller dimension of the aspect ratio. It is the number of units in both the positive and negative direction away from the origin the camera sees, so the smaller dimension of the aspect ratio is double that of the Size value given to the camera. The larger dimension in the aspect ratio is then the ratio multiplied by tha...

UnityLearn - Beginner Programming - Creating a Character Stat System - Pt. 05 - Accessing Variables in Our System Part 2 (End of Course)

March 6, 2020 Beginner Programming Creating a Character Stat System Accessing Variables in Our System Part 2 Beginner Programming: Unity Game Dev Courses Unity Learn Course - Beginner Programming Accessing Variables in Our System Part 2 Leveling Up They created a LevelUp method within the CharacterStats_SO scriptable object. This accesses the leveling array they created earlier and sets all of the max stat values to those designated in the array for that corresponding level (each level is its own individual array element holding an entire list of all the stats and what they should be set to at that level). Configuring Your Systems They added the CharacterStats script to the main Hero character. They created empty gameobjects within the Hero character gameobject hierarchy for the character inventory and the character weapon. They then applied this to the base prefab (to make sure it wasn't only on a newly created variant of the prefab). They created a method nam...

UnityLearn - Beginner Programming - Creating a Character Stat System - Pt. 04 - Accessing Variables in Our System Part 2

March 5, 2020 Beginner Programming Creating a Character Stat System Accessing Variables in Our System Part 2 Beginner Programming: Unity Game Dev Courses Unity Learn Course - Beginner Programming Accessing Variables in Our System Part 2 Writing Your Character Stats MonoBehaviour They simply created the base CharacterStats class (non-scriptable object version). They gave it a constructor that created a reference to the CharacterInventory and had a Start method which initialized all the stat variables automatically if the "setManually" option was not checked. Using Your Scriptable Objects Methods They begin to fill the CharacterStats class they just created with many methods that simply call methods from the referenced CharacterStats_SO scriptable object. Here they also use the UnEquipWeapon method, which has a return type of bool. They use it in the ChangeWeapon method, and have it in the if statement condition. This is interesting as the method here will r...

HFFWS Thesis: Starting Ramp Puzzle Generation

Image
March 5, 2020 Ramp Puzzle Scenario Generation Thesis Project Notes I have added the basic foundation for creating ramp scenarios in my HFFWS generation system for my thesis project. This starts with simply making very standard full ramp objects with a corresponding obstacle object. The ramp objects are the most straight forward ramp shape, being a flat angular shape. They are scaled randomly given a range of parameters for all three dimensions. These are generated first, and then the obstacle is generated with data passed from the creation of the ramp. Right now it just accepts the height data from the generated ramp and uses it as the new maxHeight option for the obstacle. The idea is that this will keep the obstacle from ever being out of reach of the ramp (but this will actually require the tweaking of a few other parameters as well, such as positioning). Sample Image of 5 Generated Ramp Scenarios