Latest Worklog Entries

RSS Feed

Shining Online – How we did AI

Hind Beetle - The Atari ST Version Woah, a Shining Online update! Unfortunately there’s nothing really new in this entry, but if you want to see how the old demo worked you might be interested.

I’ve tried to extract as much useful information from the original source code as possible, but it really was a mess. Blame my youth and inexperience for that :P

How the AI worked, or “Everybody hates Ken”

If you’ve played Demo 4, you probably notice everybody gangs up on Ken. It might think it’s because of his awesome blue hair, but that’s not the case.

Every time an AI in Shining Online decides to move, it has to decide whether to attack, move or defend (and heal/support if I’d got that far ;)).

Who do we attack?

The AI would first cycle through every player on the battlefield. Each player is assigned a score to work out how dangerous they are to the current enemy and how likely they are to die.

Scores were assigned based on the following:

  1. Players with less than 25% health get 15 points.
  2. Players that can be killed by this enemy (health < attack) get 25 points.
  3. If enemy attack multiplied by their bravery was greater than the player defence, there’s a 10 point bonus.
  4. Closer players are given higher scores.
  5. 10 points are added for each enemy the player has killed.
  6. Cody has a 10 point bonus for being the team leader.

All the scores are then sorted, and the enemy has its target. However, not all targets are in range, so a little extra decision making needs to be made. If the player was out of range, but the enemy had high bravery they’d rush towards them, otherwise they’d stay still.

And that’s all there is to it!

Further Improvements

The addition of healing would have made things far more interesting, but I was far too lazy to add it.

Here’s a couple of improvement ideas for the next version:

  1. Take healers and mages into account, especially ones with multiple hit spells.
  2. Look at what other enemies are doing.
  3. Have an “order” queue that can have instructions added to it by the boss enemy. For example, if the boss felt threatened by someone, they could send minions to destroy them. This could also be used to instruct units to heal others.
  4. Don’t move into dangerous squares. Each square could have a "danger" rating assigned to it, calculated by adjacent enemies and land effects. Enemies would avoid squares with high danger values.
  5. Magic and support. Perform attack spells on the heavy hitters, or boost the defence of healers and "tanks".
  6. Personalities and vendettas. The "bravery" attribute was an attempt to do something like this, but it sucked.

The biggest problem with all this is keeping things fun. An AI enemy is playing to win, but it has to do it in a fun way. Having enemies do a pincer move or set you up for defeat can be fun to play, if it’s done in an imperfect way. This is where personalities and randomness come in, as you don’t want enemies to always react the same way.

freesound

I just found out about the site freesound. It has many sound effects distributed under a creative commons license. I’ll probably be using some of these in my game, since I don’t think I’ll be able to create the sounds myself.

Hero Sprite sheet

I’ve just about finished the sprite sheet for the hero character. Here’s part of it below. I’m still working the creating the first village, then I’ll be back into coding. I’ve got to create the collision detection for the hero and all the new buildings in the town next.
Hero SPrite sheet

Young Swordsman and a village

Things seem to be going a bit slow with my project right now because I’m working on two things at once. The ‘young swordsman’ character, and the first village. Neither are quite done yet, but I’d thought I’d post some images of the works in-progress. The young swordsman character will be one of the two main characters you can choose between in the game, and the only main character available for the first demo, which I’ve decided will be a tutorial style demo. So that way I don’t have to worry about the story yet :)

Young Swordsman - In progress
Village - in progress
Village - in progress

Grid based movement

I’ve spent the last couple days working on grid-based movement. My character was animated and walking around before, but he wasn’t confined to a grid. If you think of it like chess or checkers, you can only move a piece from one square to another – not half on one and half one another. Which is what my character was originally doing. It looked fine, but I’m sure it would become a problem when I get into developing the battle system.

So now my character moves from square to square, and the animation looks just as smooth. I’ve also started working on the first town of the game and creating the main ‘hero’ character. Actually my idea for the game was to allow a choice at the start of the game, to choose between one of two characters to start as. With a different storyline for each choice. For now though, I’m just concering myself with creating a demo, and for that one main character will do.

P:7/14 1 2 5 6 7 8 9 13 14