Monday, January 4, 2016

ODTUG APEX Gaming Competition - How'd They Do It? (Part 10)

At Kscope 15 this year we launched the first ever ODTUG APEX game competition. The APEX community responded with 15 entries! Each and every one of them left me thinking "How'd they do that?" So, let's find out more about the games and those who wrote them.

Our third place entry comes from Matt Mulvaney.

First off, tell me a little about yourself.
I’m Matt Mulvaney, a Senior Consultant who works at Explorer UK. 
You can follow me on Twitter @matt_mulvaney
How many years of APEX experience do you have?
Since version 4.1
What motivated you to participate in the APEX Gaming Competition?
It's a funny story. I had this computer game when I was a kid, I thought it was called Rescue42 or Rescue, something similar – I even forgot what it was called. 
Well I was reunited with it again earlier this year after about 267 google searches over many years. I discovered it was available for the Spectrum (even though I’ve never owned a Spectrum – yes I have no clue how I even managed to play it) and it emulated well. 
When I started to play it, I immediately remembered how you had to read and hold a load of information in your head before you even started the game and how some of the levels where really annoying and uncontrollable. I actually found some magazine scans of this game from the 80’s and after reading through those it appears as though this game is mediocre at best and it was a largely forgettable title. 
Does this even matter to me? Hell no! This was my childhood game and I loved it.

Fast forward a few months and I read about the ODTUG gaming competition and this game was just ripe for a make-over APEX style.
What is the name of your game?

The game is called Rescue42 which is what I thought the original game was called. 
I thought it might have been rescue42.exe or rescue42.bas (yup, Basic) but I wasn’t sure. The original game was actually just called Rescue (or sometimes Resqué - due to a misprint). 
Since there are 41 locations with the Castle as the 42nd location the new name kind of makes sense.

Briefly describe your game.
The game's plot is a pretty old school video gaming one – you have to rescue the princess from the castle and then return her to the safety of your base. 
The game is spread over two levels. The first level you have to dodge the guards and find items which leads to the discovery of the castle. Once you find the castle, in level two, you have to play a series of mini-games before you find the princess and then return her to your base. Simple. 
The original game had about 12 pages of text to read – my version has a minimized Guided Tour.
How long did it take you to develop your games?
Because a couple of decades had passed since I last played it, I had to re-learn the entire game again through an emulator (I'm so grateful for save states) so a few hours were spent scribbling down notes on the game. 
I started this game on my lunch hour and when the deadline approached I also worked on it during the evening in front of TV shows like The Apprentice and Better Call Saul. 
I didn’t track my time but I do remember a painful hour spent typing in coordinate data.
What was the most challenging element of your game design and how did you overcome it?
I realized early on that the game had to work with dynamic actions rather than page submissions as it had to run quick and feel like a game. However due to the large amount of dynamic actions required, a problem I found was that the game's performance ran like light speed on my laptop but ran like potatoes on 
This ran especially slow on the Reversi mini-game. I included a single player Reversi mini-game because I really like the game but oh-my-days was the mathematics & AI difficult to implement. 
The whole AI is written as a single SQL statement (isn’t that neat?) and is based on my style of play. The AI kept beating me so it was really difficult to write the ‘hey you’ve won’ screen – because, you know, that didn’t happen very often... how dare my creation beat me at my own game! 

Back to the main game, the nail-biting stuff was when I got a large component to work, for example the Guard Movements, I had to deconstruct it and remodel it so that it also worked when the player moved, looked, picked, etc. I also kept to my rule that I didn’t want to include any server side tables, objects, etc. – I wanted this to be totally APEX based. Without server-side code I therefore had a lot of dynamic actions which I needed to run over and over again - like a module, which isn't available in APEX. I achieved this by representing these as hidden items which included a select dynamic action and ran them on demand using apex.event.trigger. 
Monty, you wanted me to get technical; so you can read more on this approach here. 
Another grueling issue I had was transferring the player score when you are returning the princess back to your base when you beat the game – it would not work and it occurred just before the deadline too. I tried everything, the score would not set in session. In the end I used some of the techniques in this blog to force the score to session.

The artwork is inspired from the original cassette inlay and I used a silhouette theme throughout to keep it consistent. 
By the way, I really like some of the images in Level 2... if you make it that far.
Alright, how can I play?
Adrian Png is hosting the game for me. You can play it at 
Anything else you'd like to add?
Hope you enjoyed reading and you enjoy playing the game – to read more about this game click the link above and then click 'About this Game'. I won 3rd place in this competition so thank you to ODTUG for my membership and the Chromecast.

If anyone is reading this and hasn't used APEX yet, I encourage you to get started. Its a fantastic tool with a superb community which organises great competitions such as this one.

Thanks, Matt. There's no school like old school!! Great work!

...our journey continues


Scott Wesley said...

Regarding the PL/SQL limit, I 100% agree with option 2 mentioned in the linked blog post. You should put most code in PL/SQL packages, not embed them in APEX. Not only for re-use, but performance. I need to make a blog post from part of one of my presentations, I have a great graph that shows the performance difference between a plugin with/without it's PL/SQL put in a package.

Monty Latiolais said...

Looking fwd to seeing that, Scott.