Thursday, 15 March 2012

Those iOS trailer videos that everyone hates doing.

There's always a question on the touch arcade developers forum from someone trying to grab gameplay video for a trailer but they don't want the frame rate fluctuations of the simulator being picked up by screen camera software, or to spend a ton of cash on a hardware solution to capture from the device.

I do most of my coding within a windows framework, and switch to OS X to do a phone build periodically to check my code work, and that helps in this case.

KKapture by Farbrausch is a great capture tool - everything looks silky smooth every time, but this comes at a price. Basically the capture software lies to your software, telling it that it is running at a rock-solid 60FPS and grabs every frame it produces to stitch together a video. Your code is only producing 20FPS? No worries - it'll run slowly but it'll get there in the end and you'll still end up with a full-framerate video. The downside to this is that playing the game at that speed is either impossible or at least looks very unnatural.

To get around this I added 2 commandlines to my Windows framework - Record and playback. In record mode vsync is enabled, locking the gamecode to a constant 60hz framestep, and all touch events are logged to a file, along with the number of the frame they occured in. The random number used to seed the random number generator is also stashed away.
In playback mode the events contained in the file are passed into the application through the framework instead of the real input, so the game can be run through exactly as you played it.

Capture this noninteractive version with kkapture et voila! Nice smooth gameplay videos.

Of course, it assumes that the game will run at 60fps solid when recording input, but on an average PC if the game starts dropping frames this is probably the least of your worries. If your game isn't too heavy and your PC is fast enough you can probably kkapture it at 60FPS whilst playing it. In fact, in the case of Reaxion it runs above 60FPS whilst being captured.

No comments:

Post a Comment