Shading the night sky…

One thing that got carried over from the original Midnight Engine was the shading of the landscape depending on the time of day. The original Lords of Midnight, has a different colour for night which is basically that all the white becomes black, but the blue remains the same.

In TME and therefore the remake, I have a tint colour for each time of the day, and the images are tinted toward that colour. That colour is generally a shade of grey and it is used to darken the dawn, brighten up to normal colours around midday, and then dark off fully to night. In reality, this is one area of the remake that I left in that I don’t like. Only because, it doesn’t really look like the original. The night view has a very distinctive look, and as you can see though, the remake doesn’t look the same. It’s fine as things goes, but I would have much rather made it look more like the original.

Doomdark’s Revenge however has a completely different approach. There is a dawn visual, and day visual, and a night visual.

I knew therefore that when I got around to releasing Doomdark’s Revenge, I was going to have to deal with this issue. The tinting method just didn’t cut it. Because I could tint to red, or tint to yellow, but not combine them.

To give you a little background. The colour changing was relatively easy on the ZX Spectrum. Partly because the images were very simple and were constructed, but also because of the way that the spectrum only had two colours in a 8×8 grid – known as the paper and ink. So all the effects were done by just changing the paper and the ink. These colours were not stored with the bitmap either, it was a different memory area. So in fact, what Lords of Midnight does is, clear the screen with paper and ink both white, draw all the pixels to the screen, which you can’t see, and then fills in the paper and ink colours which makes the screen appear.

Now, the choice I made when porting the game was to use full 24bit alpha’d bitmap images. I can discuss the merits, and the whys, and possibly the mistakes, of this decision. But, it’s not been one I can change easily.

The upshot is: changing colours on the fly isn’t easy. It’s much easier with 8bit palletised images. But believe it or not, despite the fact that the terrain images only use two colours, they actually use at least 255 colours in order to get smooth edges, as well as being alpha’d. Changing to palletised images just made it look awful.

Once solution that I knew could work would be to write a custom shader. Shaders are dark voodoo magic that happen on the graphics card. And I’ve never written one in my life. Had Mike been around, he would have knocked one out very quickly. But obviously he wasn’t, and as I was heading toward the original release of The Lords of Midnight, I didn’t have time to look into them.

Now however, I couldn’t ignore it any longer. With the latest update of The Lords of Midnight sat awaiting approval from the platform holders, I turned my attention back to Doomdark’s Revenge, and the next thing to address, was making the dawn landscape look proper. I was going to have to learn to write shaders. And that’s what I spent yesterday doing.

The end result is that I now create all my terrain images as being black and white. These two colours will be replaced by the shader as the image is being drawn to screen. However, I can’t just replace the two colours, I need to make sure that I where the two colours meet they get blended.

mountain_fragmentIf you click on the Mountain fragment you will see a blow up of the image, and see how this would work. Affectively the image can be considered thus; all black, all white, mixed. The mixed part always being where the two meet. So if we consider that we will replace all black (0,0,0) with new colour_a and replace all white (255,255,255) with new colour_b, the other colours will be a shade of grey from (1,1,1) to (254,254,254). What we actually do is  use the value of one of the colour components to work out the mix of our two new colours. so 0 is 100% colour_a and 255 is 100% colour_b. A value of 153 for example would be 40% colour_a and 60% colour_b.

Now, it’s not rocket surgery, there’s nothing particularly clever going on here, but for me I had to turn this into a shader, and that was new territory.  However, working within the Marmalade SDK and using the OpenGL ES shader reference manual, and a little bit of google… the process turned out a little easier than I expected.

Here is the landscape without the shader active.

Screen Shot 2013-10-27 at 02.07.47

 

But with the shader active, and the two colours adjusted depending on the time of day, we  get the following.

And, if we now revisit The Lords of Midnight, we get the resulting night landscape that I always wanted.

Screen Shot 2013-10-27 at 01.10.33

 

Not sure when this will make it back into the current release, probably after Doomdark’s Revenge is released and I’ve been able to fully test the shader across multiple platforms. But it will make it back.

Related Posts:

Tunnel Vision

tunnel_statusI’ve been working away for the last few weeks, which has meant that my development has had to take into account that it is being done primarily in bars an restaurants. I know many of you are waiting for the latest version of The Lords of Midnight, but although I have spent some time fixing bugs and adding a few new features, I am not in a position to Build a release version. I have to have access to my desktop to do that, and the few days I’ve spent at home with my family, I hope you can understand that spending time in my study on my computer is not the highest order of the day.

After declaring an end to any changes to Lords of Midnight, I spent some time merging the codebases of the different versions that have been branched out over the the year. Namely, Mobile version, Desktop Version, and Doomdark’s Revenge. I now have a unified code base which means that when I release a update for LoM soon, it can be across all formats.

Once the merge was complete I decided to spend some time working on Doomdark’s Revenge. I am hoping to release a test version soon. The night AI will not be activated but you will be able to wander around the map, above and below ground. And generally check out the UI differences between the games etc. This will then give me a good base to slowly turn on AI features and test them thoroughly up to release later this year. For the record that would be in about 12 weeks!

Once area that I have been working on this week, is tunnels. Tunnels are one of the new features that Doomdark’s Revenge implemented. So I have been slowly working my way through the code base, adding in all the little things that need to be there in order for them to work.

It’s a little different with The Midnight Engine, ( which by the way is the underlying code that powers both The Lords of Midnight and Doomdark’s Revenge ), over the original games, in that there is one code base. Doomdark’s Revenge was released as completely new game, and therefore much of what didn’t remain of The Lords of Midnight was just removed and the new code was added. This is a big issue with my codebase, as my original brief for creating The Midnight Engine was to be able to play both games and in theory create a game that mixes the features from both LoM and DDR. So, if we take tunnels as an example, I could just turn tunnels on in LoM, and everything would just work.

Now, let me try and give you an example of why that thought process gives me a nightmare when implementing something like tunnels.

In LoM a map location is split up into [ Terrain, Area, Object, Flags ], in DDR it is just [ Terrain, Flags ] – both area and object are generated. TME uses an expanded format [ Terrain, Variant, Area, Climate, Flags, Object ]. So the generated areas in DDR are stored, as are the objects. ( For the record, objects change every night ). For both, objects are classed as things you find or things you see. So Guidance, Cup of Dreams, Dragons, etc…

Now tunnels are a flag. A location has a tunnel beneath it or it doesn’t. If the terrain is GATE, PIT, PALACE, CITY, then the tunnel is an entrance/exit. If the terrain is PLAINS, FOREST, HILLS, MOUNTAINS, then it is considered a passageway. Now, this is where things start to get messy.

A tunnel location can only have a critter ( dragon, wolf, skulkrin, trolls ), when it is a passageway. And the location directly above ground can only have a critter when there isn’t a passageway below. So affectively you have two locations sharing the same space but only one critter at the location who could be in either of the two locations.

It seems a pretty straight forward thing to think about, but when your code base works on the concept of a single location, suddenly everything changes.

When drawing the landscape, the frontend asks the backend for the information about a given location. It draws the terrain graphics and any critter imagery that is required. The backend has just told the front end that there is a critter at this location. However, now it has to consider if we are above or below ground, and the type of below ground we are on. Based on that information the frontend can decide if that critter is visible or not.

When at a given location the frontend asks the backend for all the lords that are at a given location. But now it has to consider if that lord is above or below ground. The list of these types of checks goes on and I’ve found myself having to work through the engine making sure that I am always using the correct context. More importantly I am trying to make sure that any logic is in the backend and not in the frontend. Therefore the backend now returns the information in the form of, here is the information at the location requested, this critter is above ground and this critter is below ground. It doesn’t matter that there can’t be a critter in both, that is a backend problem not a frontend one.

A similar thing happens with the discovery map. There are flags on a location to say that it has been seen, looked at, or visited. Seen is a distance thing. Two locations away may have been seen, and you know what terrain is there because you can see it on the landscaping view in front of you, but you might not know what it is called. Looked at is for locations directly in front. You know the terrain and the name. Finally, visited is exactly that, you have stood on that piece of ground. But, you might not have stood under that piece of ground. So now we have to introduce the concept of tunnel visited and tunnel looked at. How about, we have walked down a tunnel and got to the end, and we know the tunnel finishes, as opposed to not quite making it to the end, so we have looked at the tunnel location in front, but because we didn’t visit it, we don’t know if the location after that continues as a tunnel, or this is indeed the end of the tunnel.

That one bit flag in DDR ‘tunnel’ suddenly becomes so much more when you are trying to keep a flexible engine. That one bit flag also creates limitations. Two tunnels adjacent to each other must be connected. You can’t run a tunnel under a palace because a palace is always an exit/entrance. This is used to create a one way tunnel in the game.

I have considered removing the bit flag, and replacing it with the concept of layered maps. You would then have a map for all the terrain above ground and then a map for all the terrain below ground. Following that approach would me that the limitations could be removed and it would allow things like different critters above ground than below. Or types of tunnels. But for now, I’ll leave well alone!

Other things have crawled out of the subterranean landscape… For example, two characters at the same location are not actually at the same location when one is above ground and one is below ground. Thus, the newly added grouping functionality suddenly needs to take into account tunnels!

Related Posts:

Update

dragonI thought I’d post an update of where things are at, at the moment.

I’ve been having a bad run of “can’t be arsed”, this is not just on the Midnight front, but with a number of things. It happens now and then. I think part of this is due to the fact that from October I worked tirelessly on Lords of Midnight right up to release, and then followed the release with two months of updates. In the end, I think it burnt me out a little. That combined with the day job and that I work for some of my clients in the evening as well. The problem is that I have now lost a little bit of momentum and I just need to get that back…

The desktop version is almost ready. I hoped to put it into test a few weeks ago, but didn’t because I was waiting to add one more feature, which is the MAP scaling and movement gadget. I did the temporary graphics, but haven’t implemented it yet. Once that is in I will make a request of Jure for the final graphics and then upload for test and open the forum for testers.

I intend to formally request Jure start work on Doomdark’s Revenge at the start of May, so that is my new goal; I’m going to aim to have the desktop version in test and DR started by the 1st May. And then aim for DR to be ready for at least the Mac App Store  by the end of May.

 

Related Posts:

The Marshal of Ithrorn is sorely pressed

dragon_redThought I’d better post quick update about what I have been doing for the last month, or more to the point, what I have not been doing. I’m not quite sure where all the time has gone, but it has gone nonetheless.
On off I’ve been trying to get over a particular hurdle on the desktop version, and it’s just about swapping resolutions. I don’t want to just allow the player to swap through all the possible resolutions that their monitor can handle, so I have implemented a system of, Fullscreen, and then Small/Medium/Large window version. The main issue is changing the internals of the system after the initial selection. It’s not a big, nor complicated job, it’s just one of those meh pieces that I seem to be unable to keep myself interested in for more than a few moments. It kind of feels a little like the Android version. That became a toil because I wasn’t really that interested in it at first, that is, all the work required to support multiple resolutions. So the work just dragged.
I think this is also on the back of two solid months of coding on the project. It feels like I’m having a little post release wobble. Hopefully I can get my coding mojo back soon so that I can get the desktop version out of the way….

Related Posts:

His war-cry rang out across the still dawn

t_army0

This weekend should see the submission of Version 1.06 of The Lords of Midnight. It has a number of fixes and a couple of new features.It will likely be the last update, aside from a major bug fix, for the next month or so. Once reason for this is that I think I have exhausted a number of minor additions that I wanted to include. Over the month since the initial release, I have added about 20 new features, tweaked a number of features, and obviously had a number of fixes. I think somewhere in the region of 60 work items have gone into the last month.

Most of the bug fixes have not been major, but they do polish the game. Luckily, most of the changes should not had too much affect on players, unless you are particularly familiar with the workings of the original. I’m pretty happy now that the next release will bring the game as close to the original game play as I can get. I have a couple of more tests to do on a couple of possible problems with the AI over the next few days – just to ascertain if they are problems or not. But my initial gut feeling says they are not, but the proof is in the pudding.

Some of the feature changes again give the game more polish, but also help move toward Doomdark’s Revenge. So they have been worth the extra effort.

The main reason for not pushing out any more changes is that I need to move forward. I need to spend the next month getting the Desktop version complete. To be honest there isn’t much to do, but some of it is fiddly work. The identified changes are currently:-

1. Mouse Pointer – There needs to be one along with the context of what it is doing.
2. Resolution selector – The user needs to be able to choose which resolution to run in.
3. Full screen – The user needs to be able to toggle running full screen or in a window.
4. Graphics – The underlying assets need streamlining.

Of the above, option 4 is of interest, because I am hoping that this will help reduce the size of the assets required for the mobile version, and make it easier to include graphic sets in later releases.

After that, I can’t honestly see much that must be changed to make the desktop version. I play it all the time on my desktop. The above changes just tidy it up.

Once the desktop version is complete and shipped, I can then move on to Doomdark’s Revenge.

Over the months that I develop Revenge, I will trickle more features into LoM. But I will only start that once I break that back of the initial development. I would like to release a version by the middle of the year that includes some difficulty level changes and new scenarios. I would be nice for you to be able to replay the game a number of ways with different challenges.

Related Posts:

Blackberry Playbook

I recently registered for Blackberry development through Marmalade. The reason was because RIM were offering a free device on loan to test your application. I figured I had nothing to lose, so why not. Anyway, the process was pretty quick and within 10 days I was accepted on the program, qualified for the device, and it turned up today.

I installed the Native SDK, which in turn allows Marmalade to target the device natively. I registered all the certificates etc that I needed. Built the app. Deployed to the device. And well…

There you go. The process was pretty painless. The Marmalade SDK did it’s thing and it just worked. The previous work I did on resolution independence paid off. I just have a few tweaks to make because of the widescreen. But other than that… fully functional.

Related Posts:

“I slew score upon score of his foul creatures yet always there were more to take their place”

I can only apologise for the delays in this project, but can assure you that I more than anyone am eager to see this released.

The summer has proved much turmoil to my schedule. Not because I am too busy, but more because I am out of sorts with development in general. The house move came at a time when I was in full flow, and unfortunately, it had the dramatic affect of completely killing my momentum. And I am only very slowly getting that back.

Anyway, over the last few weeks I have pushed out 2 new versions for testing, and have already added some features read for next weeks drop. The first included changes to the Ice Crown quest. For those people who are very familiar with the original game, the quest mode is way too easy. So I wanted to spice it up a little. Ideally, I was going to move the location of the Ice Crown, or even have it randomly assigned to a location, so that you would have to do some questing to find its location, before you can perform the quest itself. However, I decided to leave that to later in game campaign updates. So all I did was add a few extra armies on the north western flank, the route that Morkin would usually take to perform the quest, and then add some additional logic for generating new armies that are interested in the Ice Crown, should it be lifted from its original location. Current testing suggests that the quest may be a little too hard! 🙂

Second update added some small features to the lord selection screen. The ability to instantly see which lords are at night, dawn, in battle, and to be able to filter on them.

Next weeks drop includes additional features for the map screen. Namely easily locating yourself on the map, scaling, and being able to select things from off the map. Hopefully, I will also add in support for iPhone5 for next week, because currently the wide-screen nature of it, is playing havoc with the game.

In other news, I have a Blackberry tablet dev kit winging its way to me, courtesy of RIM and Marmalade. Which in theory means that the game could launch on this device at the same time as iOS, something that I unfortunately cannot extend to Android.

And… still looking for artists… if you know anyone who might like to get involved, point them in my direction!

Related Posts:

Lords of Midnight – Update

MorkinI finished some work on the character select screen last night, which means that that is now good to go. I also built a version that was uploaded to my iPad, which means we are back up and running on the device. This has been sent to our potential artists for them to look at. It also means I have a test to see if we can get the app out to other testers…

I now just have the load & save screen to be implemented before we are green light on functional testing. That is, test the game for gameplay issues. You should be able to fully play the game through on the iPad. This is prior to some new features and the relevant eye candy changes, not to mention final graphics. But it should allow me to check for device and porting issues.

Once the iPad test version goes out I will spend a little time making sure I have dealt with the iPhone4(s) and prior. This is mainly an asset issue and dealing with different resolutions.

After this I will likely make a Windows and OSX version available for testing. Again this is to just increase the scope of gameplay testing, and not necessarily to focus on what a desktop version would look like.

I will spend a little time on an Android tablet version and Playbook version. I will not be looking at Android handsets during this phase.

I am now hoping to be ready to start pushing test versions out from the end of this month.

We have a collective of artists potentially prepared to work on the game, which means we can start honing in on the visual requirements of the game. I can hopefully announce more about that in the coming weeks.

Related Posts:

Lords of Midnight – Video Footage

Ok, sorry it’s taken so long… but here is a bit of video showing the app running on an actual device. Some caveats…

1. this was taken by my daughter using my iPhone, therefore the quality is poor. But then it wasn’t about showing you the graphics! 🙂 – I will try and do a proper one later. But it may just be that screencasts from the simulator will be better in the future.

2. none of this is final. Placeholder graphics, placeholder ui, placeholder placeholders…

3. this is the first time I have run in on the hardware for some time. I have been through a number of Marmalade SDK changes in that time. This was one of the reasons why it has taken so long – I couldn’t get the deploy to work!

Subsequently, there are a couple of issues. The main one that dragging the main view around doesn’t work, thus the default to click on the left and right side of the screen.

Also, the character selection screen was mid working. So all that you could see was dragging one lord around, with his grouping circle on!

Related Posts: