Another week on programming this entity’s behavior. A few days in and I was getting close to having it all working when I ran into the dread disease programmitis, bane of programmers everywhere. No I’m not talking about carpal tunnel syndrome. No, I’m not talking about getting a sore butt from sitting in a computer chair all day! I’m talking about the general use case.
Well, to make a long story short, it was pretty easy to create a generalized state machine AI behavior, but it was a lot more difficult to break all of the state code out into individual files, requiring me to separate all the variables used out into each of those classes rather than keeping them all in one central place in a cluttered but easily comprehensible way. It was also a lot of work taking the most general functionality, such as tests to see whether one entity can see or hear another and the code to navigate a path, and extracting that into an EntityTools utility class that I can use for all future entity behaviors.
In other words, all the traditional ways that programmers get sidetracked and waste a ton of time.
Is this time going to be a waste? Dunno! Pretty sure I could have at least done this in a better order, such as finishing getting the entity working, then extracting the general-use code out into an EntityTools class, then generalizing the state machine AI into a reusable behavior. That would have been the smart way to do it, probably. Oh well!
As things stand, if I can focus it should still come together pretty fast and be working within a matter of a day or two. That’s a big ‘if’, though, with the temperatures this week dancing up around the high 90’s and 100’s of degrees and me stuck in a tiny room with no air conditioning. Well, I’ll try to make steady progress, and maybe if I get lucky I’ll even eventually start making fast progress too.