Site Overlay

Wanderers game – part 3

The game now has a camera, HUD, and a tile system where users can generate their own land tiles. For this next part, I think I'll start on the citizens of this world. The AI!

Low-poly people

For now the people don't even need to look like people, we just need something to display. I'll use simple shapes to make something that hopefully at least resembles a person.

well… good enough, i guess

There we go. It doesn't look like much, but at least we can use it to identify people in the game.

Next, we need to spawn some of these when the game starts. Since we're already starting the game with a single grass tile placed, we can add two of these at the start of the game as well. Though, for now we can simply add them to the Scene in the usual way.

two people standing next to each other

Not bad, it's already starting to look interesting. Now we need to get them moving around. For this I'll create a new Component, called AIController, and attach it to the prefab.

randomly moving around

There, now we have two people randomly moving around the map. I'm using the iTween library for the movement. It's a great library which can handle all sorts of tweening automatically.

Next, we'll have to do actual AI. I read an article a while back (can't find the link unfortunately) about designing game AI based on desires, where an actor will have certain desires that get more and more urgent over time. I'd like to implement something like this, so I'm thinking of having AIDesire classes that are attached to the AIController, and AIAction classes which can fulfill those desires. The AIController will then be able to pick a possible action, cancelling the current action if necessary, and run that action.

< Part 2            First            Part 4 >