Beta: Tile Map
As some of you might be aware, I've been busy for quite a while now - Which is mainly because of two things:
First of all, I'm in the middle of my final school exams - I should be studying right now but meh, and secondly, I've been really caught up with my current extension projects, all of which were requested, so I barely have time to work on anything else. My three biggest projects right now are Box2D (the flash port), OpenAL (sound extension with surround and effects and stuff), and the one I'm going to tell you about right now - Sorry for the long explanation of my situation :D
This extension is will be available in Flash - it will also support the standard runtime and it works in HWA (although, of course, not optimized) - What it does is basically render maps that are made up of tiles. There are two core entities: Tilesets, which each contain an image and some minor parameters such as tile spacing within the image, and layers, which contain a rectangular map area made up of tiles.
Layers each can have different scrolling speeds for parallax effects and the extension interacts with the MMF scrolling system quite well. You basically have a couple of layers, as many as you need - you could divide rooms into layers and give them different offsets, for example, or just use one huge layer for the foreground, and some for the background etc.
The point of this extension is efficiency. You can have a huge map, say, 1000x1000 tiles, with a tilesize of 32x32, and the app will still run at 500 fps at 640x480 in the standard runtime - my goal is to reach the very same performance in Flash, and there is a huge trick that allows me to do so: The map is stored as a huge grid, there is no "list of tiles", as there would be with levels made up of single Backdrop objects. And this is crucial. So basically, you will be able to create huge, detailed maps in Flash without having to worry that adding one more tile here and there will cause a slowdown, because only what is visible on the screen is even processed at all. I'm pretty confident that a game with a magnitude of Knytt would be possible in Flash with this extension. There will of course be support for collision detection, which we haven't exactly decided on yet - I will probably offer the standard "is overlapping" routines, and let you set a collision flag for each layer or so. Who knows! I just wanted to let you know that this extension is coming, and anybody who has planned to make a big game in Flash might want to consider it - but of course, small games are possible as well - For example, you can use the extension for wrapping layers (which are directly supported) or parallax effects, and there will be and already are some handy editing functions to fill the map with complex structures without a lot of hassle.
Woah, long post. Well, that's all I have to say for now - a screenshot will not reveal much, not even a program would, I suppose - So until the Flash runtime is working somewhat, I do not plan to release a preview of the extension because I can't use the feedback right now, there is so much in my head to change and add that half of the things you'd suggest would already be planned out anyway. I just felt like writing this post for you now, so if you're interested, keep coming back here to see if I made any progress. There's not really a need for you to comment, unless you have specific questions which I will be glad to answer - Thanks!
Ah what the hell: Here's a stupid screenshot that shows a 30,000 x 30,000 frame completely filled with tiles while I am moving around at 500 fps. http://i44.tinypic.com/34skrdc.png Just try to imagine that this will be amazing once it's ported to Flash :D
What can be said, Looki, besides YOU ARE AWESOME! You are a treasure to the Click community.
I hope that some day soon Spriter animations could be used along with your tile map extension to make drastically more powerful games and bigger game levels.
Been working on the Flash port and it's coming along nicely. Done some comparisons:
I set up a 30,000x30,000 frame again, with a tilesize of 24x24 that corresponds to 1250x1250 ~ 1.5 million tiles.
In Flash, even with 3 layers of this size, which is kind of ridiculous to have anyway, it runs at solid 60 fps on my machine.
Well.. and then I tried to replicate this scenario with Backdrop objects, like you kind of have to in the current Flash runtime, unless you use a super complex tile rendering system with various tricks, which no one does, I guess - after all, this is why the extension is in the works! So anyway, I kept duplicating a 'Tile' backdrop object, but MMF became so slow with 40,000 tiles (Mind you, that is 1/40 of what I rendered with Tile Map at no cost...). So I thought: Well, let's see how Flash performs. The result: 30 FPs when scrolling.
I hope this shows you the power of the extension: While MMF backdrops slow down your game piece by piece, Tile Map won't. Simple as that. I was able to have 40 times more tiles than with Backdrops, which MMF couldn't even handle anymore, but the extension could. I really don't want to waste time by making a nice demonstration SWF that shows the huge frame and that you can move around freely, just believe me :D
EDIT: Oh right, I used 3 layers with my extension, so of course thrice as many tiles, i.e. 120 times more tiles than the backdrop test. Woo.
This sounds like a really great extension, i am looking forward to testing it :)
This sounds like something I could use with my leveleditor to create really huge levels! I guess I would just read the levelcontent into the map extension instead of making everything actives which adds to backdrops.
Will the the condition IsBackdrop work with these backdrops produced by the extension, or maybe you could add a similar condition to the plugin?
Each of my tiles also create two extra non-obstacle backdrop objects, one at top of it and one at the right to make a 3D look for each tile, so it looks like any nintendo platform game. Would the extension be able to handle these objects also? I guess / hope that's what the layer system does, but I didn't totally grasp what you said about layers.
I don't plan to implement support for "is backdrop"; instead, the extension will have custom conditions for things like that. You can use layers to put multiple tiles above each other, not a problem!
Wow this is incredible news!!!! :D My biggest concern when I make something is always that it will run crappy in Flash, if this is as good as it sound it will be amazing!!! Is there any estimate when this will be finished? :) I dont want to stress you though! Just the thought of this coming is making me super happy right now! :D
And your continued work on the Box2D port for Flash is also great! It will be so nice when Flash in MMF have more support for the extensions and these performance boosts so you can actually develop for standard runtime with these extensions and not have to keep so much back because of uncompatible extensions or performance! :D
Btw, Popcorn, do you have an example of this IsBackdrop 3D tile effect? It sounds interesting :)
"Finished" - no idea. "Public beta that already works quite well" - soon ;) In a few days I would say.
Oh my oh my. This is an extension and a half. Nice one Looki, I can't wait!
This is amazing! I need to ask a few questions before I get too excited:
1) Does this tile extension allow for separate collision layers? Something like this, where the players interact on a different collision layer than the visible background image:
2) Can the tiles be placed above a moving active object? Either using an MMF layer or otherwise. Like this:
The tiles Wario walks on are in front of him and the Blocks.
3) Can I delete and re-add tiles at runtime? For example, in a game where tiles are destroyable, and the player can build Structures with various tiles. This is the main reason I use "Add Backdrop" for my current project - its easy to add/destroy tiles.
4) Does it support rectangular tiles? My current project uses tiles that aren't the same height and width.
All of these are necessary for my current project, and very important for most serious game projects. Regardless, this extension is extremely useful as is. I can't wait to play around with it.