One week in and 23 days to go.
Most of my work has been on the engine, unsurprisingly, though I have taken the time to work on some art for the game.
My next challenge began this morning. It involves this:

These enemies are all static placeholders in the game; I have yet to add their AI. And on that topic…
Designing an AI systemWith the original game, I was rushed. I'm rushed now too, but I just happen to have taken a hint from the last time that the copy-paste enemy code reuse in Exile was
bad. It got to the point that, while I was working on the old improvements before I lost them, I just deleted all Enemy related code. That also happened to trim 5000 lines of code from the game.
In the original 'system', every type of enemy inherited some virtual methods from the Enemy class. And that's where the natural C++ code reuse ended.
One of the things I copy-pasted frequently was the billboard drawing code. For each enemy I had copied the same 100 line segment and pasted it in. Collision code? Same thing. Movement code? Same thing.
This time, I've been taking bits of code that I know I'm going to be reusing and adding them to the base class. The update method for my Fallen Knight enemy contains a single line:
drawBillboard(spr_walk, position);
Of course, it will contain quite a few
more lines by the end of this, but already this is far better than the nightmare that was my 2012 Enemy class.
Anyway. AI. I'm using a simple state system, using an enum to store a few basic states:
AI_IDLE
AI_FIND
AI_ATTACK
AI_SHOOT
AI_FLEE
For each of these I'll create a method in each derived class to handle these states (Or ignore them and change state to something that class
can handle).
Then, using the methods in the base class, I detect and change between states.
I'm envisioning something like this:
void EnemyFallenKnight::ai_idle() // Starting state
{
if(Map::GetMap().isPlayerNear(this->pos) &&
Map::GetMap().checkLOS(this->pos, Player::GetPlayer().pos))
{
// Wake up, we can see the player
this->state = AI_FIND;
this->clearPath();
}
}
void EnemyFallenKnight::ai_find()
{
// Find a path to player if possible
if(path.empty())
{
path = findPath(this->pos, Player::GetPlayer()::pos);
}
else
{
// Move towards path.front(), then pop it and
// continue on to the next point, until we're one step away from the
// player.
if(nearnEnoughToPlayer)
{
this->state = AI_ATTACK;
}
}
}
Some pseudocode, though I have a few of the methods implemented already.
Should have this done by tomorrow, if I can get a few hours of solid work in tonight.
On another front, I added in some better 2D editing to my editor. Box selection, which you can fill/set the height/flatten/fill with lights. Pretty easy, though reliant on keyboard shortcuts.
One last screenshot, then I'm back to planning.

wait… so this back up plan would be an entirely different game on another engine right? lol that doesn't sound like a good back up since it would require starting from scratch :P
but the idea is solid, it could be fun but it depends on how it handles multiple enemies and transition from platforming controls into the fighting controls.Well, it's a much easier game to make in a shorter space of time. It'll be 2D, and probably done with GM. I've made a few concept sprites for the player already:
spriting shields on characters and having it clearly visible and not covering other important elements of the character is pretty tough, at least it is to me. Especially top down. i suppose it'll be easier in a side scroller.
what happens if a fight takes place on a small platform or on two platforms with each fighter being on a different one? if the arrow keys handle the sword, how will the player jump? :PIf you jump it'll 'snap' out of the fighting stance and you'll regain control. I want it to be easy to dodge.
And as an addition to that, I want to make sure that the levels are designed fairly, so there aren't any impossible to deal with situations.well you got things worked out pretty far :P seems like you've thought this out more than a mere back up plan lol.
I've had this idea on paper for at least a month, possibly more :P
I've been getting into the habit of writing my ideas down, and thinking them through whenever I have a chance.the sad truth about writing down ideas is that the majority of them will never ever be started, let alone finished :P. but its nice at least, makes us feel really creative when we peek inside that folder lol
Yeah, and it also gives me a pool of concepts or mechanics to work with if I'm ever out of ideas. :P