2013 January 2 - 13:30 Monster Trucks 360 Development

I had used Away3D earlier, on Tharsis, so it seemed like an good choice for 3D engine. And even though the visuals would be in 3D the gameplay itself would be mostly 2D so I decided to use Box2D for the physics, Box2D is very easy to use, very reliable and well tested.

File size/formats
I wanted to get the core of the game including textures under 5 MB. With my own framework plus Away3D 4.x and Box2D just the code added up to to almost 700 KB. Adding textures, 3D models, and sound effects on top of that and I was worried that it would grow to large.
Music could be streamed and the individual levels loaded on demand, but it would be nice to have all else embedded into the main .swf.

Textures was as expected the biggest assets, however texture resolution is fairly low in the game, mostly 512x512s and 256x256s. It’s a bit funny since the first 3D game I worked on (in 2001) used about the same texture budgets.
I used JPG-XR for some larger textures which required transparency, Flash 11 has native support for JPG-XR. I really like JPG-XR and would have used it for more if the Photoshop support for the format was better.
I ended up using XnConvert to compress the JPG-XR files.

3D models was exported from my 3D modeling application as .obj-files, which are then compressed when they are embedded in the .swf. I could probably have gained some on using a more efficient 3D format, but .obj was the easiest to use.

Levels are .zip-files with .obj-files for the geometry and an .xml-file for the interactive game objects. There’s a separate .obj with the 2D collision geometry (It just ignores the z-axis). The zipped level ends up weighing in at about 200KB-400KB.
I wrote some scripts to automate the process of getting the level exported and packaged for the game, the resulting workflow was perfectly ok, making a dedicated level editor would certainly been better but there wasn’t enough time for that.

I got some question on how I get the polygons from the .obj-file to Box2D.
I make sure they are all convex shapes and then I load the .obj into this code.

At the end the game .swf weigh about 3.5 MB.

Performance was never much of a problem, as long as you have a decent graphics card. The CPU usage is very low, less than 1 ms per frame on my system.
I added the option to toggle anti-alias and shadows in the game, but I’m not sure it makes much difference, it seems more like either the graphics card is way too slow to even remotely work well or performance is not a problem.
A lot of thing could be better optimized in the game, but I don’t think the impact would be enough to justify the time.

Overall there wasn’t any major bugs or problems with the development.


Play the game at Miniclip