Lode Runner 2 Update #2

Welcome to the second development update for Lode Runner 2: Definitive Edition!
The past few weeks of work has mostly been all about scaling with a couple of other areas poked at.

The Last update was focused on the Main Menu. You might think this wasn't the most important part to start with, but it was a nice morale boost to get it done early on. MMR's main UI was added after about a year into the development.

I know it has been several weeks since that post but most of the below UI work has only taken a few days here and there.
Between work and life, I haven't had much time lately but I do intend to squeeze in more development time.

What's done so far?

Main Menu
Main Menu with shiny new editor button!

Basically, I've taken MMR's code and:

  • modified the resource tool to read & write LR2's archives and image formats
  • stripped the game code down to the absolute minimum to get it to run
  • modified the UI tool for use with LR2 resources
  • altered the screen scaling (more on that below) to support widescreens

Scaling

Mad Monk's Revenge runs inside of a window surround by the thatching pattern which allows it to easily adapt to any screen resolution and ratio.

LR2 was designed to fill the screen edge to edge which results in pillar boxing when played in any resolution other than 4:3.
Without any thatching pattern to pad the window out, I've split the editor UI into 4 separate chunks with some that can seam which allows it to scale to fill any screen size.

To do this, I calculate the screen scale:
Scale = ((float)gDevice.PreferredBackBufferHeight / NativeGameRes.Height);

And then calculate what size the game can now use:
ScaledSize = new Size((int)(gDevice.PreferredBackBufferWidth / Scale), (int)(gDevice.PreferredBackBufferHeight / Scale));

I tried drawing using the scale option in the SpriteBatch but it unfortunately creates artefacts. I've taken the approach we use in MMR which is to draw it to a RenderTarget (texture in memory) and then draw this to the screen.

Using my resolution for example:
Scale = ((float)1440 / 600);

ScaledSize = new Size((int)(2560 / Scale), (int)(1440 / Scale));

This means Lode Runner 2 can now be rendered in its native windowed size of 800x600 and adapt to my widescreen and be 1066x600 in size.

UI

For the time being, I'm just using Mad Monks' UI creating tool as it's really easy to use with drag and drag, add and remove controls, tweak settings, and simply click Export. I do plan on revisiting decoding LR2's XUI files at some point in the near future. I think I understand most of what they do but there seems to be a few inconsistences between some windows.

What you see below was made in the UI tool in about 15 minutes.
You'll also notice tooltips. LR2 doesn't appear to use them at all so that's something I'll be adding.
Like everything else so far, they've been ripped straight from the handy Mad Monks' Revenge project.

![Window](/content/images/2017/05/editor_win.png)

Click the image to see how the UI scales wider.

What I'll do next

  • Add the Active Window & Navigable Icon
  • Convert the LR2 font from the current format into a BMP font
  • Start work on loading levels