If you’ve been paying any attention to the progress of this game I’m sure you’ve noticed that updates have been sporadic. I’m bad at making updates, and with the move and the fact that all that’s left to code is difficult AI code, my motivation was down. For the most part I seem to be past that, and I have been working on the code consistently but still doing poorly at updates. I made it a point to get better at that, so this should be the first return of the weekly Sunday posts. I know I promised a beta a few weeks back and never delivered, but I assure you that I am working on it, it is still on the way, but the timeline has been shaky and I’m bad at estimating time even in the best of circumstances. Enough of that though, on to the good stuff.
The final stretch of gameplay coding is the alien AI, and that has progressed quite nicely so far. The aliens follow the player as long as they can see him, and do a pretty good version of looking around confused when they lose him. Due to their small sight range it’s pretty easy to lose them right now, but as long as one of them can see you, they do a really good job. They also do a good job following blood trails that the player leaves behind, so in that regard they are where I want them to be.
The aliens are great at following really obvious signs that the player is around.
There are three things that I still need to change before I will consider the AI done.
- The aliens make no effort to search for the player. Once they lose sight of the player, they stand and look around briefly before heading back to their starting spot.
- The aliens are motionless when idle. I want there to be some indication to the player that they are living beings before the player engages them, but their behavior needs to be deterministic.
- The aliens all behave the same. Ideally each type of alien will have at least a slightly different way of acting around the player.
You might remember from my last post that I said there were only two things left to do for the aliens to be done. I’ve since broken those two somewhat broad tasks into much smaller ones, which has helped the motivation significantly, so these three tasks are much more manageable.
The first of the three remaining items on my to-do list is to make the aliens search for the player when they lose track of him. This is a bit of a challenge, but I have an idea of how to handle it. Right now the plan is to generate a collection of nodes, generated based on the map data, of rooms the player might be in. Basically this involves creating a series of square regions on the map by flooding out from arbitrary points, and then checking for holes in the map that aren’t covered and adding more points. After that’s all done, the edges of each square are scanned for passages to other nodes and then links are created from that data. This will give me a nice set of links and nodes that the AI can use to determine the major areas the player could have gone to from the last place he was seen. After that they just pick the point the region was created from and path to it. This may be over complicating it, but I think it will work and I’m confident I can implement it, so that’s the plan for this coming week.
“We could search the area for him, but standing around looking confused seems like a better use of our time.”
Once the aliens are able to actually search for the player in an intelligent and deterministic fashion, the next step is to make each type of alien act a little bit different. The current AI I’ve been working on is the guard AI, and each other type will basically be just some subset of that. The guards pursue the player, follow blood trails, and if they lose any sign of the player will use the algorithm I described above to try and find him again. This seems like reasonable behavior for a guard, but not so much for a scientist. My goal is to have the scientists behave like the guards for the most part, but instead of stopping to aim and shoot once they see the player, they will try and keep a safe distance and just observe. The admin staff will be largely uninterested in the player, and simply watch, though they will do a bit of avoidance if the player gets too close, and might put themselves in position to watch the player within their immediate area. The last type of alien are the general ship crew, who will act as recon, making predictions about the player before they lose sight of him and trying to keep him in sight so the guards can keep track. If this all sounds familiar, there are some very heavy inspirations drawn from the Pac-Man ghosts, so you aren’t crazy.
The last bit left before the gameplay code is all done is to make the aliens look and feel alive when they aren’t chasing after the player. In order to keep them predictable and manageable during the short time that the player will be around them, walking and wandering are pretty much out of the question. If I had more time to work on graphics, or could hire an artist, I would want custom animations for each type of aliens that I could cycle through to give them motion while remaining stationary. I don’t have either of those things, so the plan is to use the one animation I do have for them, and have them rotate in place. I spent a bit of time today working on code to rate each direction around each alien in how interesting it is, which gives me a good baseline for how to rotate the aliens in a predictable way. I also used this to fix the fact that be default when they are placed on the map they all face down, so this one should be pretty simple to do.
Aliens facing things that are interesting to them. Now the guy in the bathroom looks like he’s washing his hands instead of being a creepy bathroom attendant.
That pretty much sums up the current state of the game. Once these last few parts of the AI are done, all that’s left is content. I’ll try and keep more frequent twitter updates, and I should have something meaningful to report next Sunday.