Posts

Showing posts from May, 2020

Architecture AI Varied Agent Affinities with Varied Pathing

May 28, 2020 Architecture AI Project Varied Agent Affinities with Varied Pathing Demonstration of Varied Agent Affinities with Varied Pathing Vimeo Link - My Demo of Agents Pathing with Varied Affinities Explaining Simple but Unclear Heatmap Coloring System Just to help explain since I don't have great UI in to explain everything currently, the first thing was that I was testing a really rough "heat map" visual for the architectural values for now. When you turn on the option to show the node gizmos now, instead of uniform black cubes showing all the nodes, the cubes are colored according to the architectural value of the node (for this test case, the window value) Unfortunately this color system isn't great, especially without a legend, but you can at least see it's working (I just need to pick a better color gradient). Red is unfortunately both values at/near 0 (min) as well as at/near 100 (max) (but the value range here is only from 0 - 80, so all r...

Architecture AI Heatmap of Architectural Costs

Image
May 27, 2020 Architecture AI Project Visualizing Heatmap of Architectural Costs Architectural Cost Heatmap I was just using basic black cubes to visualize the grid of nodes in the AGrid A* system originally. Now I finally decided to update that system with a bit more information by adding a colored heatmap to map out the architectural values of the nodes. This will help me understand the pathing of my agents better as they start to use these values in more complex and interesting ways. Basic Heatmap Color System It turns out making a heatmap color scale that decently ranges between values of 0.0 and 1.0 is pretty easy. Using HSV color values, you can just vary the H (hue) value while keeping the other two values constant at 1.0 to cover a heatmap spectrum (where H of 0.0 is the lowest value in the range, 1.0 is the highest value in the range, and all other colors are bound within that range). By simply using the min and max architectural values possible in the system as the...

UnityLearn - AI For Beginners - Crowd Simulations - Flocking

May 22, 2020 AI For Beginners Crowd Simulations Part 3 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Intro This was by far the most interesting crowd simulation tutorial covered in the basic AI tutorials. This one really got into an actual rule based logic system for pathing of agents within a large group to move them in an interesting way with emergent behavior that is still controlled and possible to direct. Flocking Part 1 Flocking: simple rules to generate movement for groups of individuals to move towards common goals (i.e. birds or fish) They create a FlockManager because flock movement requires the individual agents to know about and understand they movement and positioning of all the other agents around them. This will be at a higher level providing data for an entire flock as a whole. This starts with logic to instantiate the flock by creating many fish prefabs in a randomized starting position bound around the FlockMa...

UnityLearn - AI For Beginners - Crowd Simulations - Fleeing

May 22, 2020 AI For Beginners Crowd Simulations Part 2 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Intro I was going to combine both of the end parts of the Crowd Simulation tutorial into one blog, but the Flocking tutorial was rather large and interesting so I decided to break it off into its own post. Because of that, this is a smaller one just focused on the basic fleeing crowd logic. Fleeing This is similar to the concept covered with single AI agents, it is just being applied to many agents here. An object is introduced to the environment and the fleeing agents determine the vector towards that object, and set a new course for the exact opposite of that vector. Key Parameters covered for their flee inducing object: Radius of Influence - how close agents must be to be affected by the object Cooldown - how long an agent flees before returning to standard behavior They decided to induce fleeing by adding a cylinder obje...

UnityLearn - AI For Beginners - Crowd Simulations - Moving As One & Creating A City Crowd

May 20, 2020 AI For Beginners Crowd Simulations Part 1 Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Intro This is the first part of the Crowd Simulations section of the AI course that I covered. This was the first two major tutorials of four, Moving As One & Creating a City Crowd. These introduce the basic concepts of crowd simulations, and at least cover ways to start moving groups of agents with Nav Mesh Agents in Unity to help visualize these concepts (more so than particularly creating agent crowd AI behaviors yourself). 1: Moving As One Crowd Behavior: agents move enmasse, as opposed to solely as individual units; their movements are usually also dependent on each other's movements Reynold's Flocking Algorithm: Common flocking logic based on 3 simple rules: Turn towards average heading of group Turn towards average center of the group Avoid those around you They start with a really basic Nav Mesh setup...

UnityLearn - AI For Beginners - Autonomously Moving Agents

May 13, 2020 AI For Beginners Autonomously Moving Agents *Full Course* Beginner Programming: Unity Game Dev Courses Unity Learn Course - AI For Beginners Intro I completed the full course for Autonomously Moving Agents within the AI Unity Learn course and am just covering it all in this blog post. I broke each individual tutorial into its own section. 1: Seek and Flee They start a new project and scene with this project where there is a robber (NPC) and a cop (player controlled), and the robber will be given logic to satisfy seeking and fleeing in relation to the player and the terrain obstacles. Seek: Follow something else around Flee: Move away from a specific object Seek follows logic they have already used for following an object. Using the difference in positions between two objects, you can generate a vector which gives the direction between them and use that to guide an object towards the other one. Similar logic is actually used for Flee, except they ju...

AGrid Inspector Breakdown for A* Pathfinding

Image
May 5, 2020 A* Pathfinding AGrid Inspector Breakdown Display Grid Gizmos: determines whether or not to run gizmo methods (methods used for debugging and visualization in the editor, like the node locations) Unwalkable Mask: this is the Unity layer that is deemed unwalkable to the system (the layer which are picked up by the nodes during raycasting) Grid World Size: a Vector2 which determines the real world size area to attempt to place nodes on (rectangular shaped with alterable width and height) Node Radius: half the real world size of each individual node, which correlates to half the distance between each node's center (in both the x and z direction) Walkable Regions: this section can be opened and various terrain types can be added to this as well as their associated movement cost penalties to make certain terrains more or less navigable (also picked up in the raycast of the nodes) Obstacle Proximity Penalty: adds a bit of ext...

AGrid System Breakdown for A* Pathfinding

May 5, 2020 A* Pathfinding AGrid System Breakdown AGrid class: - this class sets up the initial node grid 1) Determining grid size and resolution - Input: nodeRadius - parameter to create a nodeDiameter (which is the "real world" size of the nodes) - Input: GridWorldSize - determines an x and y distance for the grid to cover (in real world units) - broken into GridWorldSizeX and GridWorldSizeY - Output: number of nodes (node resolution) - System uses these GridWorldSize values and the nodeDiameter to determine how many nodes it needs to create to fill this area - i.e. Inputs: GridWorldSize x = 10; GridWorldSize y = 10; nodeRadius = 1 - Output: Creates grid that is 5 nodes (2 diameter size) by 5 nodes (2 diameter size) - Note: diameter size is a bit misleading since they aren't circle shaped by any means; most dimensions are used in a more rectangular fashion (so diameter is more like edge length) 2) Positioning Nodes in Real World Space - The transfo...