In the mouth of a broad tunnel, they paused to look one more time upon the fair land of Midnight.

Here is something that I have been working on in the background – Tunnels in The Lords of Midnight. It’s not something that is going to be used in the main game, but I am hoping to have a new scenario released later this year, early next at the latest.

For those of you who have read Drew’s novelisation, then the need for tunnels will make sense. For those of you who haven’t, well something for your list…

Normal Tunnels

Now, you’d think that adding tunnels to LoM would be pretty straight forward. It is as you may know from following my posts, the same codebase as Doomdark’s Revenge, having been unified a few years back. However, there are some issues.

Firstly, even though they are the same engine, and use the same data structures etc, the games are built conditionally as separate projects. This means certain part of the engine is not compiled depending on the games. For example, tunnels, mist, AI lords, special objects, are not part of LoM. Regiments, Ice Fear, and Waypoints, are not part of DDR. There are other little things like critters and battles working differently, and small UI changes.

The engine is written in c++ and most of these features are turned on or off using preprocessor macros like this..

            if ( !IsDead() ) {
#if defined(_DDR_)
                flags.Reset ( cf_inbattle|cf_wonbattle|cf_preparesbattle);
#endif
#if defined(_LOM_)
                flags.Reset ( cf_inbattle|cf_wonbattle );
#endif

Some of it is handled with c++ object inheritance.

Some of it is not handled very well. The code base, like many projects has morphed and evolved over the years. I as a 30+ year veteran software developer, understand the vast gulf of academic based code structure, and real world getting it done with deadlines. And it’s no surprise that the engine has many of these pitfalls.

The following piece of code makes sure that two characters tunnel status is the same. ie: These two characters can only see each other if they are both either in, or both out of the tunnel.

#if defined(_DDR_)
            // they both need to be in or out of a tunnel
            if ( c->IsInTunnel() != IsInTunnel() )
                return false;
#endif

The thing you will notice is that the preprocessor check that will include this code is _DDR_ which means, it only gets compiled when I build Doomdark’s Revenge. Ideally this code should either be governed with a _TUNNELS_ feature preprocessor macro or better still, a feature check based on the capabilities of the scenario. So, that was the first thing I had to do and it took a few iterations to get it right.

The landscaping view for DDR is different as it has a header, therefore the tunnel view needed to be modified.

New graphics were used to distinguish the two.

Text had to change. The DDR strings database has ways of describing that a character is in a tunnel, or can see and entrance. LoM did not.

I found a bug on the think page that is in DDR in that it will show you information about a character in a location that does not have the same tunnel status. There were a couple of other UI issues specific to LoM for showing characters or armies in a tunnel. These just come out of different code paths.

Narrow tunnels

You will notice in the above image, a slightly different tunnel view. This is for narrow tunnels. The novel explicitly has Farflame not entering the tunnels when Morkin does even though they are together, and this is because he is too large. This is a story specific plot device, but that makes no sense when we consider the tunnels in DDR. So the change I made to accommodate this was to have normal and narrow tunnels. In this instance Farflame can enter the tunnels, but there are some important areas that he cannot go because they are too narrow, and the game indicates this with the slightly different layout. Narrow tunnels will also be extended to armies, and too many characters in one location.

Something else I have done with the tunnels is to tweak the concept of entrance and exit. In DDR these are always one of four terrain types – Palace, Pit, Gate, and Temple. However using the mapping software you can now override this and mark any location as an exit, an entrance, or both.

Tunnel view in mapping tools

And finally, while I was make changes for the mapping I extended two other features. Firstly impassable mountains. This was added as a rule recently to help make games optionally harder or just different and it was locked to just mountains. However, I have now added a feature to allow any location on the map to be marked as impassable. In this instance it will be used for all the mountains around Ushgarak. This means that the only way to enter the plains of despair is to take Kor and Grarg. The slight pass at Vorgath as been closed off but I am having to think this through a little more because of the consequences to a western attack.

And finally, respawning of things. In DDR critters and things (claws, thorns, springs, etc) regenerate randomly. I am planning on adding this to LoM as a rule, but for the next scenario I am also adding it as a mapping feature so that certain locations can respawn. In this instance I am using it for critters in the tunnels.

Tunnel Exit

There will be more information about the Novel Campaign later as I work my way through it.

Luxor nodded his reluctant acceptance of the truth and their talk turned to Midnight

With the re-release of Doomdark’s Revenge and The Lords of Midnight that concludes the last few fraught years of bringing Midnight back from the mobile graveyard caused by Marmalade getting out of the SDK game.

I won’t deny that it’s been a painful process and not one I really want to go through again… and yet… The release is not without it’s problems. I’m not convinced that there isn’t memory crash bug still there caused by the current Cocos2dx SDK. Thanks to all the testers that have helped out over the last few months, I think I have reduced the frequency but can’t be sure. It might just be down to the length of time you play and the size of device that you have.

But, I think the only way to solve the issue is to change the SDK – and I just don’t have that in me.

So, what next.

First, I need to upload new versions of the Lords of Midnight to bring its engine up to date with Doomdark’s Revenge. There are a few small changes that were added during that release that could do with being released into LoM – just having a few Apple issues at the moment with the upload.

Here’s what will be in that release…

Version 2.0.2 (42)

  1. [desktop] Added cursor sizes (small/medium/large)

Version 2.0.2 (41)

  1. fix crash caused by too many armies at a location
  2. panel_think – adjust page indicator size dependent on number of pages

Version 2.0.2 (39)

  1. Return graffiti easter egg
  2. Add confirm night option
  3. panel_look – Add drag down gesture to moves
  4. panel_look – Add drag up gesture for map
  5. [desktop] Add mouse cursor images
  6. [desktop] Consolidate ESC key across all screens
  7. [desktop] Tidy shortcut keys across all screens
  8. [Android] panel_mainmenu Hardware back button now performs Exit
  9. [mobile] Tweak scale of buttons

Version 2.0.2 (38)

  1. Fixed: panel_think – adjust UI on phone
  2. Fixed: potential memory leaks that could be causing crashes

After that I will take a break from this code base. There are a couple of small things that I would like to put back that are missing but that I didn’t feel were critical for the release. I may well add them over time here and there when I find myself in the mood, but I won’t guaranty anything.

  1. [mobile] Pinch and Zoom on the map
  2. Compass Gadget
  3. [desktop] scrolling indicators on popup pages
  4. [desktop] arrow indicators for scrolling on think pages
  5. [desktop] Next/Previous buttons on scrolling pages
  6. [mobile] Vibrate
  7. Review the guide

There are three things that I will be focusing on from hereon in.

  1. Rewrite the engine under c# – this is a long term project in order to make the engine more robust for the future and to make more options available to me. The first is to just straight take the engine to Unity but the other is to also take it online for multi-player. More details to follow in future posts.
  2. Use the current engine to research and develop the new Landscaping needed for The Citadel. The Citadel needs water. I was playing with this technique a few years back but it wasn’t quite gelling. It works fine in a flip screen environment but not so good when the panorama is moving. However, I think with the changes made in order to release using Cocos2dx I’m keen to get back to it.
  3. The Citadel Novel/Game research. Drew’s roadmap currently has The Citadel slated as a 2023 release so we are going to need to get together to work on the details a little more than we did on LoM and DDR. There is going to need to be far more game research which is needed for the book but also for any release that I intend. For one thing the map needs a lot of filling out with details that were sadly missing in the original release.
The Bloodmarch - Northwest corner
The Bloodmarch – Northwest corner

How many times had he pictured in her mind its winding paths and gentle glades?

When Drew and I were thinking about the cover for the novel, we already had a picture in mind. However, as with most novels, the responsibility of the cover sits with the publisher. Very few authors have much say on what the final cover will look like, it is after all, generally a marketing decision.

In this case, things changed. Due to events outside the scope of this post, and generally not of real importance, Drew and I found ourselves having to think about the cover. What it would look like, and who would create it. The who was a no brainer – Jure my long time collaborator on all things Midnight was the perfect fit, and we had an image of his that both Drew and I loved and had used already in promoting the book. 

Original Inspiration – Jurij Rogelj

There were just two issues with the picture though. One, we had used it already, and two its focus is the wrong way around. If you fold the above image in half the Lord would be on the back and the Citadel on the front. It’s not a huge problem, but it doesn’t feel right.

I also had an image that I used in the game for the main menu. The image shows a group of Lords marching out from the Citadel, albeit this one juxtaposes new and old art work. And that was the idea I liked.

Main Menu

So I created a mockup by flipping the image and sticking on a cutout of the citadel and the lords. This I sent to Jure and asked for something like that.

Cover Mockup

Within a day or so, Jure sent me his draft sketch. Which Drew and I discussed. Needless to say we loved it. There was only one thing that we wanted to change and that was to incorporate ‘dawn’ a little more. We both liked the way that the sun pops up from behind the mountains and sprays across the lake on the original image.  So I asked Jure if he could adapt the sketch to take that into account.

First sketch without text
First sketch with text

Jure sent a new image, but he felt that the switch of the sun made the right side of the image, and therefore the front cover, too dark. We agreed with him and so asked him to create the final artwork based on his sketch. To be honest, I could have just gone with the sketch! 🙂

Second sketch with text

A couple of days later, I received the final artwork from Jure, and I think it’s safe to say that everyone involved with the production of the book were overwhelmed with how great it looked. It’s another one of Jure’s perfect Midnight inspired images.

Final Image
Final Image with text but no publisher logo or barcode

I now look forward to what Doomdark’s Revenge cover might look like. This time however, we might give Jure more time!