Monday, 23 January 2012

Physics and Texture editors

I have been pretty content with my journey into game development by using a static image and then applying transitions or even x and y movements on every frame per second.

Soon, however, when the game starts taking shape you appreciate that it all looks very lifeless and therefore animation is required. To be honest I was pretty reluctant to get involved in sprites given that I am a one man indie shop but thought it were necessary. I won't bore you with my creative processes (I'll save that for another blog) but what I will comment on are the excellent tools that I am using to help.

First, the ones that I'm not. I am using Flash for my creative so the obvious choice would have been to go down the Spriteloq route but I decided I didn't want to be beholden to Flash in the future. Equally, despite its following, zwoptexapp I found a little dated and the optimisation around stylesheets wasn't as impressive as my chosen route.

Instead, I went for PhysicsEditor and TexturePacker. With my limited, but expanding, knowledge these tools have been invaluable to my productivity.

Lets start with PhysicsEditor. When starting off with Corona SDK I was a little intimidated by the way a collision shape was defined. Multiple vertices applied by positive and negative offsets for some reason didn't sit well with me. Even the simplest of shapes seem to take a while to set up as well as tweak.
When it came to complex shapes I found myself simplifying the shape to avoid the proper collision properties which of course diminished the effect. This is where for me PhysicsEditor came into its own. All I had to do is add one or more images into the editor and for each hit the magic wand button. This would then trace around the shape and I could adjust the tolerances as well as add or remove vertices. I could then apply my density, bounce / restitution, friction etc and repeat for all. Once done I would publish and this would then create a lua file for me to reference against each shape.

-- Get our physics data
physicsdata = (require "myphysicsfile").physicsdata(1.0)
-- Then when creating body call identifier assigned in PhysicsEditor
physics.addBody(actor, physicsData:get("actor")) 

... and thats it. This makes changing physics criteria and verticies incredibly quick, a matter of minutes in fact, by going back to the PhysicsEditor GUI clicking a few things and then publishing overwriting the file.

In addition to my growing arsenal of indie tools is TexturePacker. As mentioned previously I had read on the web that Zwoptex's optimisation of images wasn't as efficient as TexturePacker's and with every KB counting this was quite a draw. The actor for my first game has 250 frames of animation so making sure this was optimised and easy to use was essential. The ability to drag and drop my images and use the saved default optimisation settings makes this a very simple process. Again, with the application set to Corona, an optimised image file (various output formats) as well as a texture mapping lua file makes using this and changing your images etc very very easy to use.

Again, the code is pretty easy to implement:
local sprite = require "sprite"
local sheetData = require "myactor"
local data = sheetData.getSpriteSheetData()
local spriteSheet = sprite.newSpriteSheetFromData("myactor.png", data)

spriteSet = sprite.newSpriteSet(spritesheet, 1, 248)

sprite.add(spriteSet, "do_a_star_jump", 1, 62, 300, 1)
.
.
.

myactor = sprite.newSprite(spriteSet)
myactor.currentFrame = 1
myactor:prepare("do_a_star_jump")
myactor:play()

When modifying my animations and images the only thing I modify is maybe the different spriteset frame counts. All very impressive.

As you can probably tell I would recommend this so why not get a trial or purchase from the store.

At time of writing the prices are TexturePackerPro + PhysicsEditor Bundle for $34.95, with PhysicsEditor only at $19.95 and / or TexturePacker for $24.95.

I think if you are an indie developer like me tools like this make getting games out the door achievable, affordable and ultimately stress free. I don't profess to be an expert using this but what I have been able to get out of both has been very impressive indeed.

0 comments:

Post a Comment

 
;