This isometric game plan has been nagging at me for almost two years. I've got bits and pieces of code scatted throughout half a dozen notebooks in my desk, but I always knew I couldn't polish the game because I don't have the graphic hand to make the game look nice.When I started this project last weekend, I started it in AS2. Within hours I haid laid out a basic system for map generation, and I could grind out a nice map (not including player interaction or interactable objects; just tiles) in a few hours.
I started doing the math and wondered how far I could push the limits of AS2 knowing it had it's limitations. I found out that with an AS2 isometric engine, I could -barely- push between 1200-1500 tiles on a single map. Damnit, another wall: performance. Against all the will I could muster, I started looking into AS3...
My first test with AS3 was the language. It's completely different than AS2. Adding a movie clip to the stage used to take me ten seconds in AS2; in AS3 the first sprite to display on the stage took me thirty-five minutes. Flash forward to now though, and I can't BELIEVE I didn't migrate sooner. I can now pushing 1800 tiles to the screen and still maintain between 40-50FPS (down from 61 stage framerate). That kind of power was overwhelming! Not only did I find myself giggling like a little girl, but I vowed to never, EVER write another application in AS2.
So, after I got the new engine laid out, I took to writing a tile system. Nothing fancy, but I wanted something dynamic and simple to generate a tile from a single number. In AS2 we used to a gotoAndStop() engine, but that wasn't going to cut it for me because I wanted to be able to have a different look to each room from a spritesheet. Furthermore, that meant that I was going to have to break a tile down into each "piece" or "face". So now what do I do? You guessed it: Base 2. Base 2 allowed me to set each face to a specific number, rangine from 1-512:
- 1 - Bottom
- 2 - North West Wall
- 4 - North East Wall
- 8 - South East Wall
- 16 - South West Wall
- 32 - North West Ramp
- 64 - North East Ramp
- 128 - South West Ramp
- 256 - South East Ramp
- 512 - Top
From there it was only a matter of piecing it all together into a simple map editor that you can see here. All the controls are found using the Help button at the top. To erase a tile, uncheck all the face check boxes in the right panel. Also, don't press Render Map twice... kind of a last minute bug I forgot to remove. If you press it twice without closing the first render window, you will be unable to close the bottom window and will be forced to refresh your browser.
I had the same experience when I switched to AS3. Pretty nifty idea with the numbering system. Reminds me of configuring the adress on old intelligent lighting fixtures.
ReplyDeleteOne suggestion, if I may: could you add a additive and a subtractive option? By that I mean that when I select a wall only the wall gets added/removed instead of the whole tile bieng replaced by a wall. Don't know if that was already in your designdoc.
As I never intended it to be a widely used public tool, I'm not sure how useful the option would be. One thing I'm still debating is whether or not I need to add walls on the inside of a bounding room. What I mean is, if you place a full "block", would it be necessary to add a northwest wall in the tile to the southeast of the block?
ReplyDeleteThanks for the feedback on the numbering system. I originally started using power of two back when Trogdor released Minotaur. "Bit-counting" as it has come to be known, was at the core of how he produced random mazes.
Unfortunately, the side project has taken me entirely too long. My university homework has seriously slowed my progress on both projects with C++ garbage, but I hope to be back on RC by the end of October.
I like your editor! How's the projects progress? :)
ReplyDelete