720p Upgrade Special!After a much needed vacation, I'm back to work. There's a myriad of things to do to get AI working, one of which is giving the NPCs something to
do. Where I last left off, I had just gotten the physics of actor-actor collision detection and resolution working. Physics aside, though, there was no mechanism for collision response. Since I've basically written the entire physics engine from scratch, I can't use the Stencyl collision events. So I wrote everything I need to tell the NPCs (and player) when hit boxes collide. So now I have something that's starting to resemble a game!

Currently the NPCs register hits and react... but their only reaction is shouting that they're hit into the log viewer, so their screams are still unheard
[Temple of Idosra 5] VActor.hx:942: [Actor 2,Golem 1] says good bye World
Observant readers may have also noticed something else... the aspect ratio of the screenshot changed! I've converted the game to 720p. Really it's 640 x 360, but then scaled 2x to give the full 720p screen. At the moment the decision is more symbolic--a sign of shifting away from the original Flash vision. But I do have a new practical problem--dead space.
My standard 12x12x4 rooms fit neatly in the original 768 x 640 window. Or, rather, the window was chosen to neatly fit the room.
Already I have plans for the extra space in the map editor. As I've been using it for real level production, I've identified bottlenecks in my workflow. The extra space will go to good use putting the tools I use the most out in front so I don't have to dig through menus and options to get to them.
For the game, however, the use of the extra space is a bit more of a mystery. I have some ideas, but nothing solid.
I like keeping the HUD and other UI elements to a minimum. But, say for example, putting inventory cards in the margin when inventory is selected, rather than blanking out the screen to show the cards, would be an improvement. Below is the current (bland) inventory screen.
The margins in the main screen are now 256px on either side. That's plenty of room to show the cards
and the room. In fact, I can shift the room 256px to the left and have a 512px by 640px area to show options, inventory, etc--almost the size of the original full screen I was working with. Plus, having inventory cards and the room in view would make it easier for the player to perform actions on room objects with inventory objects.
Upgrading to 720p was a terrible experience and I hope I don't have to go through anything like it again (but I know I will). There was a lot of legacy code getting in the way--much of it a holdover from the original game. I've told the story a few times, but for anyone who hasn't heard it, the original game had a 10-day deadline, five of which I lost to Hurricane Matthew and the resulting power outages.
So how do you program a game with no power? Answer--text files! I had a laptop with a spare battery, but compiling drew too much power. So I typed everything in text files and later wrote code to parse them. This lead to some really weird design decisions and I knew they were bad, but changing them would mean inevitable bugs and that's time I wouldn't have to work on something else. You know that feeling when you're driving and you see something in the road but you know you don't have time to safely swerve out of the way. You have to plow into it and hope for the best because the alternative is driving into a ditch.
Things are working now, though. This leads to the next step. What is it?
Well, back to AI. The NPCs just stand there and take hits, so that needs to change. The most important upgrade is that the state manager now works again. If you're familiar with the Animation Manager from the Jump and Run Kit, you can imagine the state manager works similarly. It's original purpose was to manage animations, but it also manages what effect is mapped to each action. For the player, this means what the action1, action2, etc. keys do. For NPCs, this means how instructions they might be given (say, from the AI engine) are to be interpreted.
This is very important to the AI system, because an NPC can receive an instruction at any point. The state manager will allow me to have an NPC either react to an instruction, or make a note--stash the command in their memory--to handle it later if they're in the middle of something else.
The NPC's memory is a part of the AI system I should talk about more, because to me it's one of the more interesting parts. How do I get my NPCs to remember things? It's actually pretty simple... right now. These things usually blow up in complexity as more required features are identified, so it's probably too early to go into much detail. I've gone on way too long anyway, so that'll be an update for another time.