I thought the War was lost and Midnight doomed.

battle_full_linesI’ve been working my way through the outstanding bug list. One of the areas that seems to cause contention, is battles.

It causes me some problems because the original is actually pretty haphazard where battles are concerned. So I’m going to talk about the battles in a little more depth, just so that you can get an understanding as to why certain things seem to be happening.

Firstly, night processing goes like this…

1. Reset all characters at dawn
2. Give all AI characters their turn
3. Process Battles
4. Place things on map
5. Move Mists
6. Remove things from map at location’s where characters are
7. Check if characters can recruit soldiers from strongholds
8. Re-spawn armies at strongholds
9. Check for important deaths

Secondly, the interesting point here is, characters are given a chance to move BEFORE battles take place. So, if you attack a character, there is a good chance he will move and thus a battle will not take place.

To understand that a little more, let’s look at the AI turn.

The AI character must decide what to do every night. Each character will react to a number of objectives.

1. Goto Liege
2. Goto Foe
3. Goto Object
4. Goto Home
5. Do nothing

If they have a liege, and that liege’s objectives are 1 or 2, then this characters objective also become 1 or 2.

Otherwise, we pick a new objective

When picking a new objective we pick a random number between 1 and 16. If we choose 1 to 5, then these are our objective. Otherwise we continue with our current objective.

So as you can see, there is a 68% chance that we will just continue on with what were we previously doing. Which means that unless you are at a characters stronghold, and his current objective is to go home, then the likelihood, he is moving away from you.

There is only a 6% chance that the character will stay at his current location.

Personally, I am very surprised at these stats, because it makes battles bloody difficult. Unlike The Lords of Midnight where a nearby army would drop everything to attack, or an attacked army would stay until the death, in Doomdark’s Revenge, everything apart from battle seems to be of more interest.

Baby Steps

I have been looking into a couple of issues still plaguing Doomdark’s Revenge game play.

The first one is movement. I have to admit, I dropped the ball on this one. I wrote this code so long ago, that I assumed it was working. Well it isn’t. And there are three issues at play.

The first issue is actually a bug fix.

There are two versions of movement tables, one that the Spectrum used, and one that the c64 used. What these tables do, is decide which terrain the character gets for free. The problem is, the spectrum version had a bug. It didn’t point to the required table, it pointed to random memory. Therefore movement on the Spectrum doesn’t work as intended. I had fixed this bug. Which means, movement on the new version isn’t the same as either the Spectrum version of the C64.

Secondly, The Lords of Midnight movement code is based on leaving the current location. Doomdark’s Revenge is actually based on the location you are moving into. I had this wrong.

And thirdly, if you move into a location with a critter, you take a penalty. However because of the difference in the way I implemented the critters on the map, ie: 0 = NONE, whereas 0xff is NONE in the original. My critter check was always triggering. Thus you always got a penalty.

The three items combined, make for pretty shoddy movement, when compared directly to the original.