Gaming Your Way

May contain nuts.

Much ado about nothing

I think it's time for a little recap, if for no other reason than to show we're still alive.

Work has started on our first RPG / Facebook game, "Knight's Quest". It's a whopper of a project.

So far most of my time has been spent on the boring techy part.

Firstly I figured out a way to do terrain splatting which should work nicely. Basically that's how most 3D engines, including Unity create their terrains ( Speaking of which, have a google for the previews they've been releasing for v3. I know 3D proper is meant to be coming to Flash in the next couple of months, or at least the announcement of it, but Unity is looking more and more stunning every day. If only there was a good web based business model for it I'd ditch Flash in a heartbeat ).
Basically you have up to 3 textures ( Any more and Flash was giving me artifacts for some reason ), in our case movie clips made up of 1 iso tile repeated over and over. By using gradient "Brushes" and the erase blendmode you can remove as little or as much from each texture as you like.

terrainSplat.png

So in the mock-up above the base texture is the grass, on top of that the soil which we erase so only that part you see there is showing, then the road is the 3rd texture, where we do the same again. Basically we're erasing pixels at different alpha transparencies.
The game takes these different movie clips and bakes them all into one big bitmap, which is a bit costly in terms of memory as it's a big ol' bitmap, but in terms of filesize it's nothing, as we've only used 3 tiles and a handful of brush movie clips, it shouldn't be anything more than 20k at most and in-game moving 1 bitmap around is nice and quick, so it's all good.



That's just a test, the final ground will use bigger tiles for the textures, and then we'll overlay a normal mc on top containing flowers / grass / rocks and pebbles etc. and bake that into the same bitmap. We should end up with a really nice art based look at min. cost, much much cheaper in every way than just tiling the whole floor.

As usual I've written more than I planned, so I'll save stories of path finding and z-sorting for another time.

Squize.

Comments (2) -

  • tonypa

    8/11/2010 7:21:08 AM |

    I doubt you are going to randomly generate each map every time its loaded so how are you saving the maps? Save position and size of each brush used?

  • Squize

    8/11/2010 7:57:44 PM |

    It's just movieclips within movieclips mate, so I just draw() them into one bitmap.

    The movieclips themselves are a slight overhead [ In terms of filesize ], but nothing really as it's a lot of multiple instances.

    That's the terrain, for the map itself that's just mc's dropped into a container, and then I loop through all the children getting their x/y coords, and if they've been flipped or not, and then create objects for them.
    It means we get to design the whole map in the IDE, which is much better than any map editor.

Comments are closed