Currently I’m in the middle of stitching together demon content for the game. While this is all fun and games, it still requires some special work that I would not think of at this stage of development.
One of those special things is preparing boss for the demo. After player will finish first simple series of quests (which serve more like a tutorial, then actual character development), will be introduced to first bigger threat- The Barroness, a enemy so powerful, even the „The” in front of her title is capitalized!
Under the game visuals, Baroness is a simple boss AI, with few basic attacks, interpolated with pause time. Attacks are selected randomly, with some random variables here and there, just to make the fight less predictable by advanced player.
On the other hand, Baroness fits just right in in the whole NES-boss archetype. Her pattern looks like this:
- Wandering around until triggered
- Selecting and executing a attack from attacks list.
- Preparing for next attack, while she is vulnerable.
- Repeat from step 2.
This makes her predictable, but not necessary easy enemy for new player.
And here is the main problem that many people will have with her. Her AI is not a true AI. It’s just a series of IFs, triggers and values, sequenced in specific order that animates her sprites. And to be honest- I’m cool with that, and so should be you.
Why? Isn’t an inferior AI a flaw? How come a randomized script is better then a proper AI?
– That’s how I initially thought as well, when I was developing Mumbis (which was one of the reason why Mumbis is on hold right now). In order to understand what exactly I’m trying to achieve with a boss character, I had to understand why I should never do that.
Firstly you need to know what exactly you are trying to do with a particular NPC. A good example is enemy NPC movement- You want the NPC to follow your character moves in order to get closer to the player. Of course you can „ghost move” player movement, you can write simple code for NPC to move towards you, or put a designed A* (a-star) algorithm, that will calculate every single object near NPC and based upon that, will create a dedicated path which NPC should use to got from it’s current position to position where player was when calculation started. Which one you should choose? „The bigger the better?” – nope, rather „Don’t order, more then you can eat.„. You should choose the one that fits your NPC needs. If you are working on a real time strategy, with top-down view, where hundreds of troops will fight on both sides against each other, then of course you should create a A* pathfinding system. However not only A* will eat a lot of resources to calculate that, it will also require more time to develop for your needs. Even more- A* is considered as kinda basic pathfinding system nowadays, so you should definitely do some research and find something that will be able to calculate changes mid-movement.
On the other hand if you are developing a platformer-sidescroller, then you should definitely avoid A*. You don’t need such complicated system, and you can spend time developing it for your game on something else. Most likely you would like your NPC to move, shoot or fight player if player is in certain distance to NPC, as well as do some special attacks regardless of player position. All of this you can achieve in very simple form, a script containing few triggers and value changes. and in case of movement simple X position change through time, on top of that add spritesheet of walking cycle and when NPC encounter a solid object, add another code in which Y position change is included.
Of course that is just a basic example, and your NPC could have more advanced move, but the base rule is the same. Creating/selecting basic script for your NPC AI and expanding it to your needs. Writing a very complicated AI template and then using it on NPC will result of longer calculation time, development time, and most likely will still result in modifying AI script to your needs.
That’s almost all for today. Let me just post two pics:
And now that’s all.
See you later!