Chaining maps together

Quick question to all: is it possible to chain Lime maps together so when the end of data for one map is reached it automatically (and seamlessly!) starts plotting the tiles from the next map?

It's just that I want to create what's effectively a never-ending vertical scrolling background that's the width of the phone screen. I want my designer to be able to construct the maps using Tiled so he can give some thought and aesthetic to the backgrounds.

If it doesn't exist, I wonder if it's a worthy new feature? Maybe you could specify to Lime I want the maps sequenced in this order { 1, 2, 4, 8, 5, 6 ... yada yada ... } then it loops back to the first one. Or even play them in random sequence forever.

It could be that Lime is more geared towards level based games?

Maybe it wasn't such a quick question. Please let me know if I'm missing an obvious thing that Corona already does, or maybe there's a better way to approach this - I have 2 ill kids and not much sleep behind me :)

Thanks,
Gary.

Hi Gary,

Currently there is nothing in Lime that could offer that natively however you could load up more than one map at a time and offset the position yourself i.e. load up 5 maps and place each one next to each other however at present the camera clamping stuff would probably get in your way.

I think it would be cool to add something like this into Lime itself however I would need to think about that after I have solved the speed issues. Basically I could put something like that in now but it would probably have to be redone after the speed issues are solved, the main reason for the speed is that everything is always being drawn regardless of it being on screen or not so we are looking into ways to automatically hide/show items dynamically which would no doubt affect multiple chained maps.

Thanks Graham. Good luck with the speed issues, I'm sure with Ansca's help you'll nail it soon.

"It's just that I want to create what's effectively a never-ending vertical scrolling background that's the width of the phone screen."

You can do this with the Parallax feature as far as I understand it. Hopefully Graham will re-enable it real soon.

The parallax is back in 2.7 which will be released sometime later today. My wizard is seeing if he can add any speed test stuff into it first.

I'm also trying to add a basic form of a new feature I have called Atlas into 2.7 but it may slip to 2.8.

An Atlas will allow for map chaining.

Early features of Atlas will now be in 2.7 as I have just finished them. An email will be sent out soon with the new version.

I may have spoke too soon. The new screen culling stuff (experimental) is interfering with the Atlas stuff. What I will probably do is release as is but simply not detail the Atlas features yet as they won't work yet and then for anyone that is really eager to try them out I will tell you how to temporarily disable screen culling to give it a go.

The reason for this is that I really want to see if the culling makes a difference to things so that is my priority.

So the screen culling stuff is you guys trying to get the hardware performance issues sorted, right?

Wow, it sounds like Atlas is just what I need then. So I could get that never ending vertical scrolling I wanted? If so, that's very exciting.

Now, how long do I have to wait for 2.8?? :)

Thanks for the hard work.

Actually, while I'm here I wondered how I'd handle the iPhone res differences, i.e. automatically loading the correct map and tiles if we're running on say a 3GS or on a 4 Retina. Dunno if Corona can detect that already. Maybe I need to produce one map say 10 tiles wide with each tile 32px wide, and another map 10 tiles wide but with 64px width tiles???

Thanks again.

Yea the screen culling is our attempt at speed improvements however nothing we do would be as good as what Ansca could do directly in OpenGL. We're just trying for a temporary measure until they can solve things.

Currently with Atlas you can chain as many pre-loaded maps together that you want however you would have to manage the endless scrolling yourself for now. What you could do is when you detect that your player is reaching the end you could then instantly jump the player back to the beginning (just make sure that the first and last map is identical so they don't notice the change).

Another use of Atlas maybe to have multiple internal rooms of an RPG map for example loaded up at the same time in different locations so that you could then use the "atlas:jumpToMap" function to swap between them etc.

Currently the chaining and movement are all code based however when I bring Berries back in I would like to have a berry that is activated when the player walks into it and would then automatically take you to a certain map (for instance, there are many other combinations you could use berries and Atlases for)

This will all be in 2.7 which I was going to release yesterday however it took a little longer than I hoped so the plan is now tonight.

You can get info about the device via - http://developer.anscamobile.com/reference/index/systemgetinfo - however what we really need is dynamic content support for spritesheets.

Graham, being too lazy to try it myself, can I also ask here whether Lime is ok with tall tiles, e.g. 32x128 with transparency that overlap tiles behind even though the map cells are 32x32. Would Lime correctly reproduce as this image illustrates (please ignore my rubbish testing gfx!!):

http://www.pragmateq.biz/dl/layered-tiles.png

Thanks.

I'm 95% certain that would be fine. Would need to be tested though :-)

OK, I spoke too soon. Just tested and it doesn't work however I have a feeling I know what it is. Will report back.

And 5 seconds later, it is fixed :-)

Oh, should probably tell you how to fix it so you don't have to wait for 2.8 :-)

Simply go into lime-tile.lua and change lines 430-434 to these:

1
2
3
4
5
        -- Place this tile in the right X position
        self.sprite.x = (self.column * self.map.tilewidth) - self.sprite.width * 0.5
                                        
        -- Place this tile in the right Y position
        self.sprite.y = (self.row * self.map.tileheight) - self.sprite.height * 0.5

Marvellous. Just waiting for the docs on Atlas and I think I'm good to go.

You wrote above the other day...
"Currently with Atlas you can chain as many pre-loaded maps together that you want however you would have to manage the endless scrolling yourself for now."

Is the endless scrolling done with a camera position or maybe incrementing the map Y offset?

I really hope Ansca get fully behind you on the culling thing. Would be quick to get the fix to us too once daily builds are out (ahem, Carlos et al if you are listening) :)

With the Atlas stuff there are all the usual move, drag, slideTo, fadeTo functions like there is with a map only naturally they would move all maps in the Atlas then there are three new functions that allow you to move to specific maps:

atlas:jumpToMap{row = 2, column = 2}

atlas:fadeToMap( { row = 2, column = 2 }, fadeTime, moveDelay )

atlas:slideToMap( { row = 2, column = 2 }, slideTime )

So in your vertical scrolling example you should be able to detect when the player hits the end of the highest map and instantly jump back to the first one.

nice ;-)

Another thing you could also probably do, and I fear you will be the guinea pig of this, is dynamically re add your maps at runtime to the top.

views:1850 update:2011/10/13 16:39:51
corona forums © 2003-2011