We must find friends as well as enemies…

A new bug came to light in Doomdark’s Revenge. I had a report of a crash bug that occurs after 138 days, that’s one hundred, one score, and eighteen days since the Moonprince rode forth into the Icemark.

The problem appeared to be that an AI character’s liege was getting set to himself. This causes a problem in the AI logic for a character choosing to follow their liege. The AI goes something like this…

I want to follow my liege, but my liege is dead, so I need to follow my liege’s liege and this character will become my new liege. The code ripples up the liege tree until it finds someone to follow, or bails and decides to hunt down Luxor instead. When the bug occurs it follows the tree and finds a liege who is dead but they are also their own liege, and thus we get stuck in an infinite loop.

Once I found this as the source of the crash, I needed to work out WHY it occurs.

There are only two places where the liege can change, the aforementioned follow liege routine, and being recruited.

I stuck some debug info on both cases and set the game to run on automatic to see if the issue triggered, and it did.

Here is the scenario…

Anvarorn starts with Fangrorn being his liege. Fangrorn’s liege is Shareth. Fangrorn gets recruited by Anvortheon the Barbarian, and thus his loyalty changes to the barbarians, and his new liege becomes Anvortheon. Anvarorn decides to follow his Liege, who is still Fangrorn. When he gets to the same location as him he notices that they are not the same loyalty and thus tries to recruit him. He succeeds. Thus Fangrorn’s liege becomes Anvarorn. So we now have a circular liege issue. This becomes a problem if Fangrorn dies, because in this instance Anvarorn decides to follow his liege, finds that his liege is dead so takes his liege’s liege as his new liege and therefore becomes his own liege!

I went back and checked the original code, and this issue can happen. The only place you would notice it would be on one of the description screens where it would say, Anvarorn’s liege is Anvarorn – or words to that affect. At worst the character would end up following themselves and end up not moving. This is something that has been mentioned as possibly happening in the current version.

When I implemented the liege tree walk, I did just that, I implemented it as a walk up the tree, and because of the circular issue, a dead lord who is their own liege will create a circular loop if they are someone else’s liege. The original code doesn’t do that, it only takes the next liege up the stack and therefore slowly makes its way up the liege tree over a number of nights. Thus no infinite loop.

This would possibly occur with characters following their foe. If their foe is dead it walks the liege tree of the foe to find the next foe.

Fix to follow soon…

Related Posts:

Doomdark’s Revenge

Tarithel the FeyI know that I am a little way off this. But as I’ve seen the question raised so many times recently, I thought it better to officially post something.

Lords of Midnight is currently moving through its project life cycle. The Android version should be live tomorrow and I will be focusing on the Desktop versions for Windows and Mac, and any other possible mobile variants like Kindle Fire, and Windows Phone. As well as this I will be adding new features and rolling them out over the coming months. This I see as being an ongoing project. I don’t see any real reason to put an end date on it.

This brings us to Doomdark’s Revenge. Let me say this very clearly, and to be beyond a question of doubt. I WILL be releasing Doomdark’s Revenge. That was always the intention. It is important for me on two levels. Firstly, it’s only right that the tribute to Mike be both games. Secondly, it is important for me to finish this thing I started so long ago; I never did manage to get a Windows release of the The Midnight Engine that included Revenge. So, aside from everything mentioned above, it will be the very next thing I do. I have spoken with Jure and he is completely on board to produce the graphics in the same faithful retro style. See Tarithel sitting pretty in the corner!

The intention is to get Doomdark’s Revenge out before the end of the year. The hope is that it will be much earlier.

The current status is…

Art: We know all the graphics required, and Jure can just work his way through them. All things considered, we know it should take less than 6 weeks for that to happen. That would then free Jure up to get back to his other commitments. Worse case, we can have the game running with original graphics again until his work is finished. But I think I will be bottleneck, not him.

Code: The Midnight Engine, which powers Lords of Midnight now, covers most of Revenge, and the database is all in place. I have once already, to show Mike, run the engine and walked around the Icemark, with all the lords in place etc… The tunnels work. The Mist works. You can recruit characters. What is missing is the Revenge specific enemy AI. The data to drive the AI is in place. So I just need to do a full evaluation of the missing features, and work my way through it.

That is my total commitment for this year. I would like at some stage in the future to address The Citadel, and I need to give consideration for Eye of the Moon. Also, Jure and I have talked about the potential for an updated version of LoM with none-retro graphics etc… And then of course, there is 2014. However, all that will have to wait and be thought about with clear hearts and minds.

But, my commitment to myself, and therefore to you, is to release Doomdark’s Revenge. In the meantime, I hope you are enjoying Lords of Midnight.

Related Posts: