Another big one this week! Even though AI is still not finished, it feels as if things are moving quite a bit smoother now. It’s less like I’m adding in new code, and more like I’m just tweaking the code to make sure that each class of NPC in each situation (particularly more unusual ones like monasteries and castles) behave correctly. This is still going to take some time, but the major mind-numbing difficulty of the actual coding process is pretty much finished; now it’s just a mopping-up task to make sure tellers can use the code written for monks, soldiers use the code for guards, and so on and so forth, and that everything is suitably applicable to every scenario rather than the small subset of scenarios I originally used to get the system up and running (i.e. guards). As such, this week a lot of new NPCs have started working correctly in their schedules, and various amusing or peculiar bugs found along the way have been fixed. My rather bold goal last week of finishing AI entirely hasn’t been met (ha! I was so naive, and will never make such an absurd prediction again), but we’re still getting closer and closer, and it certainly emotionally feels like the home stretch… at long last. Sorry again for the late-evening update; there’s just so much to do that I find myself coding all day and then suddenly quickly typing the update post before I go to sleep…
Tellers now go about their day correctly. The bank remains open all day for people to come in and sit down and wander around, and guards naturally keep guard all day but the teller is only there in the day time. I’ll probably change it at some point so that once the teller exits, ordinarily people won’t path into the bank, but for now that’s going to be how it works, since there are only so many tiny additions and minor things that 1/6000 players will notice, that I can implement in any given release. Here’s a teller packing up and deciding it’s time for a relaxing snooze:
And the same from outside:
And entering their home, with a rather jumpy gif due to the volume of de-bugging stuff happening in the background, but you can still see that the teller enters, realizes they need to find the stairs, finds them, goes up them, finds bed, goes to bed.
In the process of handling bank tellers I also discovered a weird bug where either priests could spawn in a middle-class map grid, or bank guards, but not both. This was a result of a silly “elif” where I should have written “if”, and this promptly got fixed!
Priests seem to be doing their thing correctly! Priests (and worshipers) doing their normal routine in the day time:
And then I left, came back at midnight, and sure enough found the priests sleeping in their cells:
And then, at the appropriate time, the priest awakes and starts doing her thing!
Look at this merchant going into their shop first thing in the morning!
Walking Through Walls
Found a funky glitch involving pathfinding through cities that wasn’t correctly taking account of where doors inside and outside the city actually went. Basically, in this city, an AI was trying to take this path:
Once I was in the grid below the one in the top-left, it couldn’t spawn properly since it was trying to spawn at a gate that didn’t exist. The path had been allowed because, sure enough, none of those map grids were blocked – i.e. were oceans or mountains or deserts – and a pathfinding map of the area basically looked all green, and didn’t take account of where gates are and are not! I tried to find an elegant solution to this problem, but failed, so I just changed the city pathfinding algorithm to consider any tile outside the city to be blocked (and I’ll think of a more elegant solution later, for when I want NPCs to move from city to city). So before, the pathfinding grid for these map grids looked like the one on the left, and it now looks like the one on the right, so city NPCs have to move always within a city, even if going out-and-in would be more efficient, because taking account of gates is too damned confusing.
I noticed a tiny weird bug where sometimes, upon entering a map grid in which the NPC needed to “catch up” to where they should be and would have been if the grid had previously existed, they would reach a tile away from their destination (e.g. a door to a building or gate to another district) and then just dance around the tile for a while. It took quite a while to figure out the issue, but the problem was that the game was spawning the random crowd NPCs *before* getting the important NPCs to catch up to their positions, and so there was a truly tiny chance (I probably encountered this in 2/200 game loads before I figured out the issue) that a random crowd NPC would be spawned on an important NPC’s target square, and prevent them from reaching it. Therefore, when you enter a grid, the game now ensures that a) there are no random NPCs standing in the exact tiles in front of gates to other districts, and b) that there are no random NPCs seated on the exact “endpoint” tiles of any important NPC. As such, from what I can tell, this weird little bug (which admittedly wasn’t a game-crashing bug, but still merited dealing with) has been resolved.
Also ffound one bug where certain important NPCs, upon leaving a building, wouldn’t change their internal x/y coordinates to an appropriate external set because they were looking for the wrong kind of door, which resulted in them leaving buildings and being magically transported on top of buildings, into lakes, into trees, etc. This no longer happens.
Well, more AI stuff, of course. What else?!
LAST BUT NOT LEAST
Since AI stuff is proving so complex, I’ve decided not to move forward the release – I still think the conversation system is absolutely vital – but I’m going to put out a secret, intermediate release, to a small team of playtesters, to make sure that the pathfinding system all works correctly. Despite my best efforts, there’s no way I can really test every single possibility exhaustively. If you’re interested, leave me a comment! This won’t be until probably next month, and would require you to basically wander around the world, entering buildings, looking for NPCs, leaving buildings, entering other map grids, and just basically doing anything you can to upset their scheduling.
Excellent!!! Your project is totally fascinating. I get excited every time I see an update. Keep up the good work!
Thanks! I really appreciate all your comments, they're very generous :). My goodness, I can't wait to have this release finished...
What drthompson said! I loved Adom back in the day and am really excited to see this game completed!
Why thank you! We're getting there, and honestly, even only a year from now it should be pretty bloody epic. Hell, the next release will be huge! It'll be so good to get some gameplay out there.
where i sign for the playtest? XD
Check back in next week's update for more info!