So today has involved a lot of work towards incorporating basic A.I into the game now that the monsters are hanging around. My first step was to build a basic top-down simulator to process the swarm-style A.I that I've been planning on using in the game. The initial tests I did came out great and it looked a little something like this:
Basically, the enemies run around a square at a time, choosing to turn left or right when they find walls, however, they also keep an eye out for entrances to their left or right and sometimes decide to go down them instead (makes for some chaos in room-environments!)
I'll make it better later, but for now I just wanted A.I in the game (even stupid A.I)
So the top down simulator worked well, so I started putting in enemy "sight". Basically, all enemies have 3 states that they can be in. State 1 is their idle state when the monster is just doing it's own thing. If they see or hear something odd, they move into state 2, or 'suspicious' state. In this state they will wander in the general direction of the thing they saw or heard and snoop around for an alotted time before moving back into their idle state. If they see or hear the player whilst they are already in the suspicious state, they will enter state 3, or 'aggro' and once aggro'd they will hunt the player relentlessly. The player can do things like close/lock doors behind them or try to lose the monster through cunning navigation, but some monsters are going to be smarter than others, and some will be able to open doors ;-) others will be so large that they will easily smash their way through obstacles! Just because I'm evil like that :-)
Once that was done I put this new engine in to the MSoA code and linked it up to the 3D models. So for now they just pop out of one square and move into the other with no tweening or animation in between, but it's just a proof of concept at the moment, so that will come next. After I was done with the basic movement though, I linked their movement up with the 3D sound engine and now as I wander the dungeons I can hear things moving around me! It's pretty cool! I now frequently see sights like this:
And I keep thinking "uh oh... That's not where I left you!". You may also notice that I've started implementing the higher resolution 3D assets into the game! Very excite!
Well anyway, I'll post another update soon!