Super Simple State Machine!

Hey all! How’ve you been?

I’ve been very busy lately. I know I don’t post often enough, but I’m working on changing that up. And, for starters, I’ve posted a brand new tutorial! Been a few years since I’ve done that, right?

Well, for you AI newbies, I’ve posted a tutorial for a Finite State Machine I made a few years ago, affectionately called the Super Simple State Machine. I even posted the code and a Unity package demo project up on my GitHub for you. Isn’t that nice?

Give the tutorial a look-see, let me know if you like what you see and you want more.

That sounded really dirty… Sorry about that. Later!

Advertisements

Link: Higher-Order Fun

Higher-Order Fun

Higher-Order Fun

So, my blog’s concept is nothing new: Games, programming, tutorials, the works. But everyone’s a little different and post up different content, and recently I found this blog, by Rodrigo Monteiro, where he not only posts up tutorials, game design, and even 3D game math, but he also gives his 2 cents on games and game design ideas. It’s a real great blog, and definitely one to bookmark. Here, I have a few pages of interest for you:

 

C++ Link: A-star Shortest Path Algorithm (C++ recipe)

Pathfinding A Star
Image via Wikipedia

Thank you, StumbleUpon! I just so happen to have come across a handy code snippet for the A* pathfinding algorithm.  This is pretty much a staple in any AI programmer’s arsenal.

So here’s the code! Enjoy, peoples!

A-star Shortest Path Algorithm (C++ recipe)

Update! Oct. 13, 2017

Seeing how this is one of the more popular posts on my blog, I wanted to update the link for the algorithm. The above link works, but the creator has moved all his “recipes” to his GitHub. Here’s a link for his C++ A* Algorithm Recipe. Good luck!

Code Snippet Quick Reference

I have created a quick way to find the code snippets you’re looking for! The Code Snippet Quick Reference under the Code tab at the top. Now you can find all the snippets for C/C++, Unity, and even the Math Algorithms all in one easy place (OK, technically 3, but shut up; I’m trying to do you a favor, here!).

Enter C++11

Picture of "hello world" in C by Use...
Image via Wikipedia

 

C++ Programmers (AKA, REAL Programmers) rejoice! The new standard for C++ has been published! A lot of exciting and powerful features have been added not only to the STL, but to the language itself. Some features include automatic type deduction, new algorithms, nullptr, lambda expressions, and (my favorite) a standard Threading Library. And to make it even better, it’s even faster than the current standard. I just const’d myself.

Continue reading Enter C++11

Unity 3D Code Snippet – Flight Script

Roll, yaw and pitch axis definition for an air...

Flying is a simple concept in games. An object that can move in 3 dimensions? I am all over that! But how about rotating to the forward vector? How about a constant velocity? Here is a quick way to get your game object up in the air (that joke hurt to type).

Continue reading Unity 3D Code Snippet – Flight Script

C++ Code Snippet – File Locking

I program applications that run on IBM AIX servers at work. Multiple people will be running different instances of my programs, and if any of my programs are writing to a file at any time, it could become problematic. For example:

  1. Person 1 runs MyProg, which opens MyFile.txt, which contains the text “Hello, World.”
  2. Person 2 runs MyProg, and also opens MyFile.txt, which contains the text “Hello, World.”
  3. Person 1 now makes edits to MyFile.txt and saves it, so now it reads “Hello, World. Beautiful day today!” He exits the program.
  4. Person 2 then makes his edits to MyFile.txt, which reads “Hello, World. Person 1 is a jerk!” and saves.
  5. Person 1 gets fired.

Because there’s no locking, data can get overwritten without anyone noticing.

 

6. Person 1 goes outside and finds (what's left of) his bike

Continue reading C++ Code Snippet – File Locking