Posts

Behavior Trees - Decision Making in Games!

Image
Behavior Trees!     After doing a few of these game AI projects I find that it's not terribly hard to slap together an AI that has and performs a single behavior. The trouble seems to come in when you want the same AI to own and perform multiple behaviors, one after another. There are multiple structures/ways to do this but the one I want to talk about in this post involves Behavior Tress! It's a pretty common way of creating elaborate AIs in games and allows you to create separate behaviors that link together to create the illusion of an AI that's making decisions. I plan to split this post into three parts What is a behavior tree? How would I make a behavior tree? My implementation     I don't plan for this to be a step-by-step tutorial but rather a summary of what a behavior tree is and let that inspire you in terms of how to make one and what you could do with it. Ill also talk about some of the benefits of using behavior trees and what it could allow you to do when

Game AI - Influence Maps!

Image
 Influence Maps!     An influence map is a method/tool used to modify (influence) the behaviors of AI in games (usually). There is no one way to use or create an influence map so the goal of this blog post is to not necessarily give you the "ULTIMATE GUIDE TO INFLUENCE MAPS!!!" but a good summary/jumping-off point that you could potentially use in whatever game you are making.  I am going to break this post into a few parts so feel free to jump around if you want Part 1 - What is an influence map? Part 2 - What's it good for/Where might you use it? Part 3 - My implementation Part 4 - FIN (the end) Part 1 - What is an Influence Map?     As the name implies an influence map is the mapping of various influences that will affect some sort of actor in a game. An example that I was given was a heatmap that showed enemy locations in a game.  (Feel free to skip this next part if you know what a heat map is) For those that don't know a heatmap is the visual representation of v

Game AI - Flow Fields and how to implement them? (Path Finding method for game AI)

Image
Flow Fields!      Flow fields are a method/data structure for pathfinding with AI that takes what would usually be the job of many independent actors and turns it into a one-time gig that everyone can take advantage of (depending on how you implement it). I am going to talk about this subject under the assumption that you have a basic understanding of pathfinding (so if you have no clue then I suggest you google things like Dijkstra's algorithm and A* to get an idea of the methods/terms used).     I want to start off by talking about what a flow field is, its advantages and its shortcomings. This won't be an in-depth dive into flow fields, just a surface-level analysis based on what I can see/understand. I do want to mention though that all of this can change based on how you implement your flow field. This is the flow field example that I made for this blog post. It shows the "units" pathing to a target in a basic 2D environment that I generated using Unity's bui

Game AI - Obstacle Avoidance + Flocking (In 3D!)

Image
Obstacle Avoidance! (again) but now in 3D with flocking behaviors "They say everything in life comes full circle eventually" -they      I didn't intend to revisit obstacle avoidance again so soon, but this time, it's different. The primary focus of my latest assignment was to implement flocking and obstacle avoidance (a completely different beast). Luckily for me, I had done flocking before (in 2D), and I have also done obstacle avoidance before (also in 2D, check out my blog post on it 😉). I thought the primary problem I was going to have was combining both of these into one behavior. After some thinking however, The solution I went with was pretty simple (I'll talk about that later). In order to spice things up some more, I decided to use this project as an opportunity to implement both of these behaviors in 3D and sink my toes into some of the nifty tools that Unity had to offer (there are so many tools out there that I still don't even know about).    

Game AI - Obstacle Avoidance

Image
  Obstacle Avoidance!      So you have an NPC (Non-Player Character) in a game that you want to maneuver around a scene but there are obstacles in the way, don't worry there are ways around this. Jokes aside what you are looking for is a means to have your NPC avoid obstacles. In this blog post, I hope to talk about my approach to obstacle avoidance (It might be a little Unity-centric since that is what I used) and how you can do it too! (amazing) The example of obstacle avoidance that I implemented     As you can see (in the video above) it's not perfect but it does a good job of visualizing the main points I want to make.      To start off I needed to create an NPC to maneuver the scene, I used a basic triangle sprite since it's a shape with some nice visual direction. Next, I needed some obstacles to avoid, depending on the tools you have, circles can be used as obstacles since they are easy to use for hit detection, but thanks to unity I was able to put whatever I wante

Procedural Generation in Games

Image
Procedural Generation in games Specifically Terrain Generation (sort of)      I want to start this off by saying that I am not a professional in the industry (I'm a college student that is loosely studying this for my minor so I'm not even an amateur yet) so take all of this with a few fists full of salt (and maybe a teaspoon of sugar). Hopefully though, after all of this is said and done you will have learned something new. I will have sources for some of the topics I mention but a lot of it might be me speculating on the topic or waxing poetic. Anyway, let's get back to the main topic...      As environments in games get larger and more diverse, Developers have had to start pulling more and more tricks out of their magical little bags in order to make a gaming experience that is fresh and enticing. One of these "tricks" that could allow for potentially infinite worlds/replayability is procedural generation. The reason I say "potentially infinite worlds/repl