HuskyGames Dev Diary 004

This week we’ve been playing game-development tennis in an effort to further refine our soon-to-be-ground-breaking-and-record-breaking-and-all-round-awesome iPhone game. This particular game featured many interesting rallies, which I shall recreate for you below. With words. There will be no dodgy headbands here.

  • Me: Dude! The new build is ready. The stuff moves around properly now.
  • Nofi: Just played it. The new stuff moves around all wrong. Make it move half as often, but twice as fast. With more graphics.
  • Me: Dude! The new build is ready. It’s all bob-on now.
  • Nofi: You forgot the “more graphics” bit. And it moves too fast. Make it half the speed, but it should move more often.
  • Me: Dude!
  • Nofi: Is it ready?
  • Me: No. I have no idea what the heck you are on about.

These sorts of rallies continued for much of the week until Nofi came up with the best idea he has ever had: Animated GIFs. This astounding idea brought about a new implementation of the prototype which met all Nofi’s exacting design specifications. My use of the word “all” could better be described as “some, certainly more than ealier in the week, but not all of”. Still, progress is now being made in a more organised fashion.

Aside from playing tennis, I’ve been spending much of my time getting to grips with some of the timer functionality in the Corona SDK. Timing is a significant part of the game we’re building, and handily for us Corona comes with a number of things to help with the process.

The most significant of these is the command that allows a certain piece of code to be called at specific time intervals. This can either go on indefinitely or for a specified number of executions. So, for example, if we wanted to call a certain piece of code every second we can do something like:

local timedCode = timer.performWithDelay(1000, myCode, 10)

Corona will then ensure that the function called myCode is called every 1000 milliseconds – every second – and it will be called 10 times, i.e. once a second for 10 seconds. This is prefect for what we need, but Corona has another trick up its sleeve, something called transitions.

A transition is basically Corona’s way of transitioning a display object (see last week’s blog if you don’t know what a Corona display object is) from one state to another. This provides an easy mechanism for making objects move from point to point, or grow in size, change their colour and so on. A transition can be set to run over a certain period of time, and a piece of code can also be set to run upon the completion of the transition. For example:

local myBox = new.Rect(100, 100, 100, 100)

transition.to (mybox, {time = 1000, delay = 1000, x = 150, y = 150, onComplete = onMoveFinished} )

The code above creates a box on screen, and the transition then moves the box to a new set of coordinates. It does this after a delay of 1 second, and the resultant transition then takes 1 second to complete. When it has finished the function onMoveFinished is called and executed.

With these pieces of the puzzle in place, our game has animation running like clockwork, and other bits of code running on time like the British rail system.

You see, that’s the main problem this week: making everything run on time. I’ve got all the pieces of the puzzle in place. They are all running at the time I tell them to. But still it’s not quite right. And that’s why we’ve been playing game-development tennis, and why animated GIFs have been the best step towards getting all our trains running on time, every time.

Next week we hope to lay down the tennis racquets and get on with implementing the gorgeous UI that Nofi has designed. Coupled with a few more tweaks to the main game engine, and I think we’ll be close to having a game. We’ll need a few layers of polish then, but we’re closer now than we’ve ever been.

A big thank you again to the people at Ansca Mobile for their support in our gaming endeavour. Corona is an excellent product and we’re on track to add another Corona-powered game to the App Store.

22 Comments

  1. @heywoodstock We’re using the Corona SDK from Ansca Mobile. It’s based on the Lua language, and provides a really nifty route into iPhone/Android dev.

  2. @Michael Nice, I know I’ve been reading all about it, sounds like it does pack some nifty features. I’m excited to find out more on the game as and when it arrives, going to be one awesome title I feel. Keep up the strong work, before we know it we’ll have it in our hands! Sounds like it packs some really interesting iphone/Android features this Corona, as they so publicly state code once, play more. Which is great considering Androids huge fragmentation issues and then the instant preview features, sounds like a great engine.

  3. @heywoodstock Following comments on iPhone is tricky; don’t think you were asking me what we use where you! Anyway: w00t!

  4. @Michael No, no I wasn’t. But it’s nice to have you recap it. Keep up the good work.

  5. An enjoyable and interesting read. It’s actually brought out the trouble shooter in me, wondering if you could sync all the tasks to the system clock or prioritise them with Corona, but i think i understand where the animated GIFs come in…. i think. :)
    Anyway, looking forward to hearing and seeing more soon.

  6. Aaaahhh…

    Jigsaw falling into place.

    :)

  7. being new to programming myself i can sorta see how your code works….but thats just me trying to relate this to C :)

  8. Sounds like all is going well, good luck for the next step in development. Nice to hear how it’s going!

  9. @TSBonyman The animated GIFs are to help me understand Nofi’s designs. They aren’t part of the game itself. It’s just, you know, pictures and thousands of words and all that.

  10. I was just wondering… does Corona work with Windows or do you need a Mac?
    Great blog, love the geeky code bits :D

Comments are now closed for this post.