Total Conversion [12/16/16]

I wish I were more current with weekly dev logs. I’m not. I suck. BUT, I do have some exciting news.

Before, I was programming the game using Unity 3d’s Navigation(Nav) Mesh Agent. It was pretty simple to use, and worked out. However, I knew there was always a better option. A* (pronounced “A Star”). It’s a efficient pathfinding algorithm. (Read about A* on Wikipedia)

Before, I could use the code of:

 

agent.destination = new Vector3(X, Y, Z);

 

Seems simple enough, right? It was. It truly was. Was it efficient? Ish. It had some limitations though. Overhead was a big thing. It was fairly heavy CPU wise (when compared with A*). It scanned the area often looking for changes, which was quite CPU intensive, and it ran only on a single thread. Now, it wasn’t super heavy, where it was unusable. However, when you had a decent amount of actors (the moving agents), there was considerable slow down.

 

With A* however, instead of just simply setting the destination, I’m returned a path. Only a path. However, more on that later. The graph (walkable area) is setup using the simplest of grid types. (The Grid Graph).  It’s setup as blocks with connections. Four connections is the four sides of a square; Six connections is the four sides of a square with two additional connections that cut the corners; Eight connections is the same as six connections, except instead of going from corner to corner, it cuts from corner to center. With the four connections, you’ll have more straight edge paths that resembles an L. With six connections, you’ll get more diagonal approaches.

 

Seems boring and all, but the real exciting part is, the amount of actors on screen that is supported is.. a lot. And, it’s highly efficient. However, the biggest pro for it, is the local avoidance. With unity3d’s setup, you had to set a priority, and then the other unit on the same path will push it out of the way. Although that was cool for some scenarios, you always had 1 actor getting pushed out of the way. With A*, it works together so they just kind of avoid each other.

 

Now, enough about pathfinding. Some general coding improvements done have been multithreading. This speeds up a lot of CPU time. Not that it’s needed right NOW, it’ll be better for late game when you have thousands of things going on at the same time.

 

The current setup right now is pretty static. You have a designated build area, the roads are already in place, the shipping/loading zone is also predefined cv8jldx. This seems lame to me. The goal will be to transform it to where you have a wide open canvas that you (the player) will set up the road network, the loading zones, etc. You also are essentially building your factory outdoors. No walls, no ceiling. This will also be changed in the future.

Still left on the drawing board, is the stock system, research, development, and contracts.