The Icemark was indeed a changed place

An interesting thing came from fixing the battle code in Doomdark’s Revenge, it highlighted a bug that is in the original code, that I can’t tell if ever caused an outward problem.

It is all to do with loyalty.

Loyalty in DDR is about race. Which race are you loyal to: Giants, Dwarves, Hearstealer, Moonprince… etc. When a lord recruits another lord, they become their liege and the new vassal becomes loyal to the same loyalty race.

When a AI lord moves in to a location, they check the loyalty of any lords present and if there is a difference in loyalty, they may attempt to recruit.

The problem is – if a lord who has vassals is recruited the loyalty of the vassals does not change, but the loyalty of the lord does. The liege of the vassals does not change either. So these lords have a liege of a lord who is not loyal to the same race as them. And they will potentially attempt to follow them or follow the same instructions. Even though they are technically the enemy.

Should the vassals ever find themselves in the same location as their liege, they are no longer the same loyalty so they will attempt to recruit them. In this instance the, the vassals becomes the liege of their liege, but their own liege does not change. Confused yet?

What we have here, is circular lieges.

Example:

Glormeon the Giant’s liege is Imagrorn the Giant, and Imagrorn’s liege is Varagrim. But let’s say Imagrorn is recruited by Carormand the Barbarian, then Imagorn’s liege is now Carormand, and his loyalty is to the Barbarians. But Glormeon’s liege is still Imagrorn, however his loyalty is still to the Giants.

The first problem here is that these two lords now see themselves as enemies or potential recruits. So they could fight or recruit. But also Glormeon will follow orders of Imagrorn even though they are enemies. Which may be tracking him down or following his enemies, or liege… and should Glormeon enter a location with Imagrorn he may attempt to recruit them. If this is successful then Glormeon’s liege would be Imagrorn and Imagrorn’s liege would be Glormeon.

In the original this situation would occur. Which I think really just messes with the AI. But in the remake, I traverse the liege tree to work out who is the overall lord in charge, and if we have a circular liege then the game crashes!

So the question is – how to fix.

So I remove the liege traversal and allow the original messy AI or do I break the liege link as soon as recruitment happens… ie: When Imagrorn is recruited and his liege changes to Carormand, then Glormeon’s new liege becomes Varagrim. Or should Glormeon remain loyal to Imagrorn and change his race loyalty to the Barbarians?

As a bug fix the first seems the quickest and keeps the gameplay the same. The other two options the potentially becomes gameplay rules.

This also doesn’t take in to account that the human player, ultimately The Moonprince, may be the loyalty race of some of these lords.

I am tracking the bug here on the GitHub repos for anyone interested.

The Wise are not the only guardians of knowledge

The Solstice release has now been submitted to Apple and Google, windows versions to follow over the next few days. From this point forward I intend to produce four released a year with either new features or just maintenance. They will all coincide with the Solstices or Equinoxes.

Version 2.0.5 (44)

  1. ADDED: panel_map_detailed – tool tip for location – press
  2. ADDED: panel_options – gameplay rules
  3. ADDED: Rule: Impassable Mountains
  4. ADDED: Rule: AI Impassable Mountains
  5. ADDED: Rule: Sole Mountaineer
  6. ADDED: Rule: Add mountain passes
  7. ADDED: Rule: LoM – Unrecruitable Fey
  8. ADDED: DDR – Fast tunnels
  9. FIXED: Character Time Shader
  10. FIXED: DDR – Battle Algorithm
  11. FIXED: DDR – Race preferred terrain for movement
  12. FIXED: DDR – Cowardly lords attacking
  13. FIXED: Android Rotation

The fixes or all rather straight forward and self explanatory. The main additions are the inclusion of the new gameplay rules, so here is a quick note on what they do.

Impassable Mountains

This is for both LoM and DDR. This stop player controlled players from entering mountain locations. In DDR it will also stop you from approaching and lord who is in a mountain location or entering battle in one. Also Giants and Dwarves can still traverse mountain ranges.

AI Impassable Mountains

As above but for AI characters.

Sole Mountaineer

With impassable mountains enabled, this can be enabled to allow a lord with no army to still pass through mountains.

Add mountain passes

Currently LoM only – punches some holes in the mountain ranges to allow access to areas that would become unreachable with impassable mountains.

Unrecruitable Fey

In LoM this affectively takes the fey out of the game. For that added level of difficulty.

Fast Tunnels

In DDR characters will move faster through tunnels than previously, making them more of an advantage. Dwarves will get an extra boost.

** Known Issues **

With combinations of impassable mountains, it is possible that a sole lord or a dwarf could recruit another lord within within either a mountain range or an inaccessible area. This would then mean that the recruited lord would not be able to move. This will be resolved in the next update. The work around is to not recruit lords in such a location.

The Lords of Midnight Downloads

Doomdark’s Revenge Downloads

Should we prepare to do battle against the wind and snow?

I was looking at a battle issue reported recently that battle reports were not always being displayed. I’ve had reports before that the AI Lords don’t appear to engage in battle the same as the original, but I have tested this many times and not been able to find an issue other than the AI being unpredictable and a little shaky.

I had recently done some testing while adding the new game rules in place and had my lords attacked, and indeed failed an approach of lord and been attacked, and attacked a lord and battle had commenced, so on the whole it seemed to be working.

I poured over the code again to check the AI conditions of battle and noticed something interesting. The rule is that if the lord can’t walk forward and it is dawn and they are not blocked, then there is a 50% chance of them staying in the current location and ending their turn.

Analysing that a little; blocked means exactly that, they cannot move in the direction they want to under any circumstances. This is usually because of Icy Wastes or there are too many people in the location. Can’t walk forward is usually a transitory check, something in the location they are in or entering could potentially stop them entering, but nothing that would break the game. The Dawn check is just helping to differentiate moving into a location during the turn from moving out of a location at the start of the turn.

The code that makes those decisions is separate from the code that is handling the AI Turns logic. So I went to look at that to check under what condition the lord could not walk forward, and the thing that caught my eyes was – if there is an enemy in the current location. Combine that with the checks in the AI Turns logic and what you have is, there is a 50% chance that a lord will leave a battle at the start of his turn, but if they enter a location with an enemy they will always stop to fight.

The problem was that this flag was being reset by another piece of logic which was actually more to do with the player and not the AI, and also some shared LoM logic. The net effect was, if you attack an enemy lord, or have a failed approach, then the enemy will pretty much always move on and not engage. Now, this seems counter to what my testing has shown, so I can only posit that there was something else happening in these situations that was keeping the enemy at the same location.

Once I realised this it was a quick fix to isolate the piece of code that was overwriting the can’t walk forward flag. However, this then highlighted another bigger issue, and that was that the lord was not considering the enemy as their enemy, and thus the trigger was not occuring.

Again, I checked out the area of the code that handles this, and clearly it was based on LoM, in that Luxor is the friend, and Doomdark/Shareth is the foe. But this does not take in to account the multi-race nature of DDR. So what in effect was happening is that the AI was not really considering the players lords as enemy, or indeed not always correctly considering the enemy AI lords as enemy, which means they would often over look them. Obviously there were fighting, but again I think other issues were causing them to stay in the location of another lord. And as long as multiple lords are in the same location, the battle algorithm would get the friend/enemy check correct and they would fight.

Now, this looks like it has always been wrong, ie: nearly 10 years since I released the games. But I suspect the problem is actually due to the merging of the code bases and likely crept in in the later stages of v1 and then rolled over in to v2.