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 :slight_smile:

Thanks,
Gary. [import]uid: 8496 topic_id: 5684 reply_id: 305684[/import]

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.

[import]uid: 5833 topic_id: 5684 reply_id: 19725[/import]

Thanks Graham. Good luck with the speed issues, I’m sure with Ansca’s help you’ll nail it soon. [import]uid: 8496 topic_id: 5684 reply_id: 19846[/import]

“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. [import]uid: 11904 topic_id: 5684 reply_id: 19857[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20413[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20506[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20507[/import]

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?? :slight_smile:

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. [import]uid: 8496 topic_id: 5684 reply_id: 20577[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20579[/import]

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. [import]uid: 8496 topic_id: 5684 reply_id: 20638[/import]

I’m 95% certain that would be fine. Would need to be tested though :slight_smile: [import]uid: 5833 topic_id: 5684 reply_id: 20639[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20640[/import]

And 5 seconds later, it is fixed :slight_smile: [import]uid: 5833 topic_id: 5684 reply_id: 20641[/import]

Oh, should probably tell you how to fix it so you don’t have to wait for 2.8 :slight_smile:

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

  
 -- 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  
  

The only difference is that it now uses the actual tile dimensions set up for the map rather than the dimensions of the tileset/tile.

Hope it helps :slight_smile: [import]uid: 5833 topic_id: 5684 reply_id: 20645[/import]

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) :slight_smile: [import]uid: 8496 topic_id: 5684 reply_id: 20656[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20658[/import]

nice :wink: [import]uid: 8496 topic_id: 5684 reply_id: 20660[/import]

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. [import]uid: 5833 topic_id: 5684 reply_id: 20662[/import]