Cross-Platform Game Engine

Featured

In the first semester of my MSc Computer Science degree as part of the Games Development Architectures module we were tasked to design and implement a cross-platform game engine. A game would also be made using the engine.

The chosen platforms were a Windows PC and Windows Phone 8 device. I decided that considering Microsoft had developed a Universal Application framework for targeting both of these, I would utilise it. This was good from the point of view that it simplified the cross-platform compatibility, but introduced a few limitations (namely having to work with the Windows RT platform and resultant consequences for dealing with inputs via ‘ref classes’ etc.. Coming from experience with Win32 desktop programs, Windows RT feels very different to program for and much less flexible, but then again Win32 really does need some modernisation.

4

Project Details:

  • Engine coded in C++ (Visual Studio).
  • DirectX11 rendering engine component coded from scratch.
  • HLSL shaders.
  • The Universal App framework used to contain the code solution and deploy to both platforms.

We were given a design specification for a simple game called ‘Tunnel Terror’. It involved the player having to control a vehicle/object through a tunnel, avoiding various obstacles. The speed would gradually increase the longer the player survived and any collisions with obstacles would result in death. Score was determined by length of survival. I decided to add various extras including power ups such as coins and a randomised speed-up/slow-down. The game would need to play on both a PC and Windows Phone 8 device, allowing for the differing input controls to play. I decided the PC would utilise keyboard whereas the phone would rely on the accelerometer (tilt) sensor to manoeuvre the player through the tunnel. The PC also required a 2 player mode. Main menu, high score table and game over screens would be needed as well as Multiple camera modes such as first-person, third-person and death fly-by cameras.

3

Although marks were given for the game implementation and extra features, much of the module was graded based on the engine design, implementation and accompanying report. My report justified the design based on four principles of games architecture, namely ‘Simplicity’, ‘Reusability’, ‘Abstractness’ and ‘Modularity’. Below is an example of the UML design used for my engines platform independent rendering component, with examples given to how behaviour could be derived for both DirectX and OpenGL.

Renderer

In the report we also had to research how we would have implemented the game on next-generation architecture such as the PlayStation 4 and how the engine would deal with the addition of different kinds of input devices.

There were some marks awarded for graphics quality and since the target platforms were both Microsoft, DirectX11 was used for the graphics. I implemented normal bump mapping to give it a nice look when flying down the tunnel. I also randomly changed the textures of each tunnel section and reset them to the end of the sequence once passing behind the frustum to give the impression of an endless tunnel with non-repeating sections.2

Annoyingly because the game is a Windows Store application there is no runnable executable so without actually publishing it to the Store and getting past all the certification requirements I cannot put it up anywhere to play! What is worse though is that currently I know of no screen capture software that can even record footage of the game running (at a decent FPS), both Fraps and Bandicam do not capture it since it’s not a desktop application. Bandicam does have desktop capture support but this also didn’t seem able to see the game and is not suitable for high frame-rate applications. So, as it stands I can’t make a video of the game running without hardware recording. Hopefully, this is something that won’t always be the case.

I was very pleased with the final engine and received a 92% grade for the module. I have since improved upon it and reused design elements for subsequent modules such as Real-time Graphics. I think a lot of what I coded for this project will be extremely useful going forward.

 

 

 

Hypermorph Wins Three Thing Game Competition

So it’s been a frantic couple of weeks, plenty of course-work to do and last weekend was the much anticipated Three Thing Game competition. For anyone not in the know this is held each semester at Hull University and challenges teams to come up with a game based around three auctioned words per team. Judges then score based on the games relevance to the words and the quality/fun of the game. The competition involves a marathon 24 hour programming session to get your game finished on the day. This one was the biggest yet with 39 teams competing. We really couldn’t have asked for better “Things” because a combination of good bidding and luck meant we came out with “Flying”, “Tank” and “Bombs”. Considering another team got “Teddy bear”,  “Deodorant”  and “Pop Tart” I think we did ok!

Last year we came second with Shear Carnage and and I can say that honestly this year, we really really wanted to win it. This was evident to myself just by the focus we had this year and when the day of the competition came, I think I probably left my seat half a dozen times in the whole 24 hours! In hindsight we probably took it far too seriously and as a result I think it sacrificed a lot of the enjoyment of the competition and resulted in some contention regarding ideas that seemed inevitable considering vested interests and no one leader within the team. I think on a personal note, much was learnt regarding team work and there are aspects of the planning and design process I would do differently next time. Luckily it all turned out worth it in the end and so it’s very hard to regret any decisions, but this was by no means a painless endeavour!

Me on the right, Russ in the middle, John on the left. Lee Stott at the back.

So to the game, Hypermorph is a retro-style side scrolling shooter that takes me back to my childhood days, playing classics such as Xenon 2, R-Type and Menace on the Amiga. Back then the shoot’em’up was a staple video game genre and was hugely popular, now only since the mobile platforms have taken off is the genre again feasible because it’s the perfect style of game to have a quick blast on when wanting to pass a little bit of time. The  thing that’s pretty novel in Hypermorph is the ability for the player to switch between two different forms, a spaceship and a hover tank by simply tapping the screen. We made the game using XNA (C#) for the Windows Phone 7 and coded everything ourselves (no third party libraries).

I produced the art for the game and managing both the art and doing a lot of the programming was a challenge in itself on the day, resulting in most of the art being done in the last few hours. I had a good idea in my head what the game would look like when we were bouncing the initial idea around, however my regret was that I didn’t produce any concept art for it sooner to put the rest of the team at ease; for a long time I think we were left with our own ideas for how the game would look but once I came up with the first concept drawing for the ship, the team were all in favour to my relief!

We had decided to make the game quite dark and moody but with bright weapon and explosion effects to make them really stand out. Additionally, we wanted to make the controls as hands off as possible. We learned from Shear Carnage that using touch too frequently can result in obscuring a lot of the screen so we instead went for a tilt based movement for the player and a single touch to morph between Tank and Spaceship. Importantly we set it to auto-fire constantly since you soon realise that in this genre there’s never a time you don’t want to be firing.

One feature I’m really pleased we put in was the voice effects for powerups and various other things. It adds a lot to the immersion and again, really goes back to the genres roots.

Of course we have plans to get Hypermorph out on both the WP7 and Windows 8 market ASAP but uni coursework is currently being prioritised. At the competition was Lee Stott from Microsoft and guys from the Monogame team. Lee’s encouragement was inspiring and I’d also like to thank him and Microsoft for providing the cool prizes. The Monogame guys were brilliant and we spent a fair time chatting with them regarding getting our games ported to the various platforms, they even ported Shear Carnage and my Robocleaner game for us to show us how easy it is! (albeit there’s some coding required to get them ready for the marketplace).

Ultimately we are going to want to put in a few more levels, enemy types, weapons and powerups before getting it on the marketplace, but the good news is it will most certainly be free!

All in all it was overwhelming and the encouragement we have received from Lee Stott, Rob Miles and the MonoGame guys was great. Ultimately this is why I gave up a career in IT to get into the games industry, because there’s so much satisfaction in putting your heart and soul into producing a game and then seeing others get a lot enjoyment from it. Winning the Peoples Choice award as well as the judges award was the icing on the cake and I’d like to thank everyone who voted for us and gave us great feedback.

Stay tuned for more Hypermorph news soon…

Robocleaner Update..

So, I’ve been progressing with getting my Robocleaner game on the marketplace (I’ve renamed the game from Sweepy Cleaner for originalities sake). It’s been taking a lot longer then initially I thought it would mainly because I wanted to completely redo the graphics and as anyone will find, graphics can be quite time consuming. On the plus side my knowledge of making graphics and using Photoshop and Illustrator has increased ten-fold.

Things I’ve added so far:

A menu system with options for muting sound and changing the control type from tilt to touch. Touch being useful if your not upright when playing. I also improved slightly my background image and removed the eyes from my hoover. Less is clearly more when it comes to hoover eyes since I think my Cyclopean hoover looks more bad ass then when it had two and actually it’s eye is now what used to be it’s nose :)

So far I’ve only made 4 levels out of 8. I’ve got the living room, bathroom, dining room and kitchen finished. I’m trying my best to make each room quite unique to the last and also slightly increase the difficulty as you progress, mainly by introducing more clutter and extra  stuff that harms you.

Bathroom

I’ve added Hazards which are like regular furniture except you can pass straight through them while taking damage e.g water, spilt coffee, broken glass etc..

Additionally a new little chap I’ve added which I’m quite pleased with is a Dust Goblin, he roams around the maps he’s on and if he comes into contact with any dust, he turns it into a Dust Bomb that he hurls at you, if it hits you, you take damage and you also die outright if you touch the goblin. He adds a significant challenge to the game and in later levels there will be multiple goblins, potentially of different types!

I’ve added decorative particle effects into some of the levels to add a bit of realism. In the bathroom for example, the bath tap is running and there’s steam and water droplets splashing onto the floor and on the kitchen map there’s a kettle with steam particles being puffed out.

Sometimes adding cool little things like the particle effects that don’t take much effort can make a nice difference to the polish of a game so I like to add them. You just have to limit yourself on some things otherwise the game would never get finished. Luckily the programming is pretty minimal at the moment since most was done for my course work (except the new stuff) and adding levels is just a few lines of code or less depending on what objects are present in it.

So there it is so far, hopefully I’ll get the other 4 levels done soon and can get it on the  marketplace asap with maybe an on-line scoreboard and time related scores for each level. It’s certainly a nice feeling seeing the game come together and hopefully not just be a uni coursework submission but an standalone fun little game.

Sweepy Cleaner – Windows Phone

I thought I’d finally get around to making a post on my blog and specifically concerning the thing that has taken up the majority of my time over the past week or so. Sweepy Cleaner!

This is a coursework project we had been assigned as part of the the Hull University Computer Science degree. We were given a spec and tasked with making a game plus extras via C# and XNA 4.0.

I decided I wanted to make as polished a game as I could that stuck pretty tightly to the design specification, but still add a decent amount of extras here and there. In the end I’m pleased with the finished product and really enjoyed making the game.

The toughest aspect of the project was the AI path-finding that I wanted to put in the game so that  in “attract mode” it guided itself around the furniture and collected dust of it’s own accord. This sounds simple but in reality it was the trickiest bit of programming I’ve probably done and let’s just say I won’t be bitching about dodgy path-finding in AAA games any time soon. I may actually make a separate post on this and include a dissection of the code I came up with.  I decided to initially look into an A* algorithm but I wasn’t sure how best to apply that to a game where things don’t move along a grid. So I decided to use static waypoint nodes that I manually placed around the level and then added them to a list, sorting them based on distance from each waypoint to the nearest dust to the hoover. I spent a long time trying to perfect it and although still not perfect, (I had to use at least one workaround) it performs convincingly enough with no furniture collisions and I’m very happy with it. I could later adapt it to make a “vs” mode where you have to race the AI hoover to collect the dust.

There’s only 3 levels in the game, I’ll hopefully add more before I get it on the Windows Marketplace.

Fingers crossed that my demo goes ok next Wednesday!

Here’s the artwork I did for the title screen, it does makes me think a 3D version of Sweepy Cleaner could be pretty fun!