Many battles fought again by tongue

Strange day today. Not just because it would have been Mike’s birthday, but because for some reason I found myself fixing a bug in Doomdark’s Revenge. Back in January I had a bug reported to me by Simon Foston, I managed to get some save games from him and just needed to find some time to look at it. Now, it’s taken a little while for me to find that time, but for some reason I looked at it today. It wasn’t a conscious decision, I was just looking through some emails that needed dealing with and noticed Simon’s bug report.
A quick look through the code and with a tip off from Simon’s report, it became apparent that the ghosts of dead lords were continuing to take part in battles. I checked the original code and it looked as if the bug was there too, however, I then found that the isDead check was happening later in the process. Strangely what it means is that battles at a dead lords location are processed as part of a dead characters turn, and not as part of other characters in the location. In my case, I’d missed the later isDead check and therefore the dead lord actually took part in the battle.

 

So, it seemed strange to be working on a bug in Doomdark’s Revenge that included the dearly departed, today of all days. I’m sure Mike had a wry smile..

This time you’ve got me to help you…

A few months back I received an email from Marmalade Studios. Marmalade is the system I used to give me cross platform support. I pay for a licence yearly which is still covered by the ongoing sales on the long tale of the game. Anyway, the email informed me that Marmalade were pulling out of the Tools business to focus on their own development. They laid out a timetable and final release plan for the current tools but ultimately from March 2017 they will no longer be supporting their toolset. There was an offer to purchase rights to the source code, but as a small indie, that’s not really an option.

This doesn’t affect the current releases, but what it does mean is that any chances of me producing updates in the future have almost certainly been removed. And with every new OS release, the chance of the game not working are increased.

I know I have not been prolific with updates since the release of Doomdark’s Revenge settled. There was so many things I wanted to do, but just haven’t gotten around to. The reality is two fold, as amazing as the sales of the games have been, they are obviously not enough to support me full time, and secondly, the games were written quite frantically in the end and I never regained that sense of purpose after their release; this is not just for these games but for everything that I have been doing creatively.

I’ve been trying recently to tie up another release. The main reason for this is to produce a build with the latest version of Marmalade and get it out there to properly support the latest devices. In theory a new release should keep its visibility in the App Stores for a few more years. As part of this I’ve been slowing adding a couple of features: Discovery Mode, Difficulty Modes, Rationalise the code base between DDR and LOM. etc..

So with all this in mind I have been toying with the following: Uploading the source code to GitHub and making it open-source with the objective of transferring it to another cross platform solution, Cocos2d-x for example. Or, allowing people to port the engine to any other coding languages they like, so it could be used however they like.

The current codebase is written in c++, and thus moving to Cocos2d-x makes sense, but I quite like the idea of porting to c# or swift.

Moving to open source could also allow for the tool chain to be fully developed which would allow for more work to be put into ongoing development of the games.

Anyway, I shall think on this more, but if anyone is interested in getting involved, then drop me a note…

 

 

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…