Unity 3D – Smooth Turning with NavMeshAgent AI

Many of us feel a bit weary after going (what feels like) 12 rounds with an engine’s API. Fortunately for me, Unity was a bit more “forgiving” than most, but the task I had involved a lot of digging and witchcraft.

My goal was this: I have vehicles in my game that I want to control via Unity’s NavMesh AI. I also want these vehicles to have varying degrees of turn radii – some will turn more sharply, some will turn faster, etc.

The Problem: Unity’s NavMeshAgent is very basic. Yes, it’ll generate paths, and obstacle avoidance and all that lovely jazz, but, when it comes to controlling how the agent actually moves, you’re almost s*** out of luck.

Almost.

For those of you out there, digging though old forum posts and 5.X documentation with one-sentence function descriptions, look no further. I think I have a pretty solid solution that opens the hood on the NavMeshAgent to allow us to customize it how we want.

Continue reading “Unity 3D – Smooth Turning with NavMeshAgent AI”

Links: Voronoi – Symphony Of Destruction (And More)

So, lets get to the point here: Blowing stuff up is cool.

That statement probably will put me on a list somewhere — I mean virtually blowing stuff up is cool. In games, you hit something, and pieces of it fly apart, fragments go everywhere, cool particle effects, awesome sounds, all that feedback feels very satisfying. But sometimes, in a lot of games, that feedback is just par for the game. Like, a quick flash, some little sound byte, you reticle lights up, and it’s like, “OK, I did the thing.” but it’s not very gripping. To get that level of immersion, players need to not just see something break, but really feel it. Particles can only do so much – people want to see the result of their actions. They want to see stuff break.

Continue reading “Links: Voronoi – Symphony Of Destruction (And More)”

Links: Unity Sprites: Hues & Color Swapping

Old games, am I right? Back in those days, they didn’t have any of these fancy 256 color pallets! In those days, you had only a handful to chose from, so devs had to swap out color pallets like a Bob Ross Marathon! Nowadays, if you want something to be a particular color, you just…. do it. There’s actually a lot of good videos that talk about how colors and images were achieved back in the days of limited color ranges.

Now, most of us know that, back in the days of limited colors and memory, games would fake sprite variety by swapping pallets. It worked pretty well, and resulted in some pretty awesome effects. But, unfortunately, the old ways must die, and now, with retro visuals all-the-rage these days, getting back those effects can be challenging.

Never fear, because our good friend Google is here!

HSV & HSL Shader by greggman

Just like in your favorite image editing application, this shader allows you to modify the Hue, Saturation, Value/Luminosity, and Alpha of your sprite. But that’s not all! You can also set the Affect range, so it will only modify certain colors within your image! It’s pretty nifty, and a good base-line cover-all for whatever your needs are.

Daniel Branicki: How to Use a Shader to Dynamically Swap a Sprite’s Colors

Here, we get a little more advanced. What this tutorial shows us, is how to use a shader to change the individual colors of a sprite. With this, we can get pretty powerful, because we can have control of just about every aspect of our sprite. He even goes over a little “Damage” effect, just to show what you can do with this ability.

So here are a few tools to add to your toolbox. Keep these around, and you’ll have that old school game dev feeling back in no time.

Minus the awful assembly code. Yikes.

BattleRust – An experiment.

In the long-forgotten past of 2017, a challenged was proposed to me. Several of my friends and I would create our own version of the game BattleShip in different languages, each with their own AI, and we would make them play each other. My one friend was to do his in OCaml, the other was to do his in Tcl, and I would do mine in Rust.

I was the only one to put any work into the task. F*** me, right?

So, 2 years later, this project is just collecting dust. So why not throw it out onto the internet for the whole world to see?

If anyone wants to see what I’ve done, critique it, or maybe try to go further with it, here it is. Check out BattleRust on my GitHub.

Maybe, some day, I’ll update this post with more information. For now, enjoy.

Update, 4/5/2019: Well, butter my bread and call me Sally, turns out one of my coworkers did actually work on his a bit! If anyone wants (or cares) to see what his implementation looks like in OCaml, click here to go to his GitHub (and criticize him heavily).

Link: Unity UI: Easy Tabs (no scripting) by Mateodon

Link -> Unity UI: Easy Tabs (no scripting) by Mateodon


The Unity UI framework comes with quite a number of tools for your disposal: Text, Buttons, Lists, Toggles, and so on. But sometimes you need a little more – something to spice up the interface you’re providing. Unity, surprisingly, has come up with a number of hooks in its UI framework, and all it takes is some simple trickery to turn these Buttons and Toggles into something completely different.

Enter Matt Graves (or “Mateodon,” his name which, I assume, dates back to his prehistoric ancestry). Matt used his dinosauric wizardry to combine multiple UI elements to create Tabs (much like the tabs in your browser (I mean, I assume they’re in your browser (What browser are you using, Internet Explorer 4?))) without a single line of code.

Give his site a checkout. He has a few good tutorials, and even has a YouTube channel.

Link: Subsurface Scatterings – Texture-Driven Water

Link -> Texture-Driven Water by Subsurface Scatterings


I’m a simple man – I like creating big effects using a minimal amount of processing power. Sure, you can go and make something look “Industrial Light & Sound”-level good, but sometimes simple is better, depending on your situation. And one thing that’s gotten better and easier with age is Water Effects.

I came across Adeniran Moses Adeagbo Jr‘s blog while looking up some water normal maps, and his demo for Texture-Driven Water, where, not only does he utilize normal maps for creating some nice looking water (which, for most engines, is child’s play), but he pulls out a bit of refraction and Schlick’s Approximation to really get some great reflections out of it.

As a fellow Jerseyan, I gotta show some recognition for what this dude is doing. So, please, check out his site for some great tutorials.

Scope, or How I Learned To Stop Worrying And Start Planning

Honestly, how much planning do you put into a project? A lot of people just dive right in and let the code take them as far down the rabbit hole has it needs to go, like a painter on a canvas. Well, guess what, Bob Ross, this is programming. There’s no happy little tree, no titanium white, and no happy little gnarly accidents that will save you. Diving in without any idea of what you’re going to be working on, or what tools or patterns you’re going to need, is the biggest killer of any project. I don’t care what you think the front-end should look like – you’ll just be left with default assets if you can’t visualize it.

I can say, at this point, I’ve been working on video games for 10 years. I can’t tell you how many projects never made it up to this blog, let alone out in to other peoples hands. All of them started with an idea, a gimmick, and then, as the project grew and got more fleshed out, more was added to it in a fever feature creeping, and then, bam, the project would die. Why? Many reasons: bloating features slowed down the game, asset creation became absurd, code became unmanageable, people dropped off the project, and so on. But it all boils down to one centralized issue:

We fell out of scope.

Continue reading “Scope, or How I Learned To Stop Worrying And Start Planning”

A-Star Pathfinding Tutorial by Me!

16 x 16 Grid... You're welcome.

Hey, everyone! It’s been a few months since I posted on my blog like this, but that’s because I’ve been hard at work on a new tutorial for you all!

One of the more popular pages on this site has been a link I provided to ActiveState’s C++ A* Algorithm, and, while that’s good and all, it’s not really a tutorial by any means, and, well, it’s someone else’s stuff. I wanted to show you guys not only how it’s done, by the whos and whys.

So, without further TODOs…

Check out my A* Pathfinding Tutorial!

heroAnims
It’s got history, jokes, source code, images, the works!

Let me know what you guys think! Tell your friends! MAKE THE MACHINES BEND TO YOUR WILL!

That last part is a little exaggerated, but that’s basically what you’ll be doing!

Dragons

So, the time is come for me to make my commitment. I have committed myself, I have dedicated myself to the pursuit of the Dragon. And having made that commitment, having decided that once and for all, now, all of a sudden, I can see him.

We all live in a fantasy world. It’s a fantasy that we make up for ourselves, but we don’t really realize it. We all battle monsters that we conjure up for ourselves – Skeletons in our closets, Demons in our heads – and we personify our issues with images of monsters that we wage battle with. We sum up the most trying times in our lives with the idea that we were battling a horrific monster. I hear about this stuff every day: So-and-so “beat” cancer, Such-and-such “escaped” the streets. These struggles – real world struggles – are reverse-LARP’d into a fantasy quest. That’s what it feels like, doesn’t it? We were forced into a bit of hardship, and reluctantly we set out to overcome the obstacle set forth. Once our quest is finished, we tell others of our doings and our deeds as if it was an adventure. What if it was, in retrospect? It may sound like a page out of Don Quixote (and it should, since I already referenced Chris Crawford), but what if those monsters and demons and dragons we were told of long ago are real, and they exist as illness and debt and mistreatment? What if the dragon is not a scaly fire-breathing beast, but some goal that lies before you, and you have to fight in other ways to achieve it?

Continue reading “Dragons”

Math Magician – Path Smoothing with Chaikin

There are a lot of algorithms out there for making something follow a path. I should know, I’ve posted a couple. The thing is, a lot of times I find myself following a path just fine, but trying to make that path smooth is pretty frustrating. Some methods might take too long to execute, or don’t really work in realtime, or are just waaay too beefy for what I’m trying to do. So, I found a pretty simple algorithm for your Game-Dev-On-The-Go to help you find the way.

Alright, here’s the setting:

You have an enemy, he’s flying in space. He flies a basic patrol that selects a random path from a collection of waypoints. You generate your path, and it returns a List of Vector3s. Watching your enemy fly a path filled with extreme <90 degree turns looks dumb. Real dumb. You start to consider taking a job in construction, but wait; there’s a simple solution: what if you could just cut out those sharp corners?

Well, that’s when we call in Chaikin.

Continue reading “Math Magician – Path Smoothing with Chaikin”