Tiled Map Engine

ok I see, wasn’t really sure and just was guessing from the example it might have been a rectangle, but understand now - so the pixcel figures are relative to the center of the tile?

Also learned about using objects (like the platform example) to set a physics line, so this may be even better depending what you’re trying to do in the map…

Did you see my two question a few items up at: http://forums.coronalabs.com/topic/29681-tiled-map-engine/?p=193637  by the way?  Would be interested in your take…

HI Caleb - fyi - just put in an issue here:  https://github.com/superqix/CoronaTiled/issues/8  “vertical column of tiles missing in iPad view of simulator”.

Hi Caleb - just stuck at the moment pondering how to use Ceramic with approach I’m looking for.  What would you recommend?  (not I put a doco request in the issue tracker re how to use the production with dynamic scaling)

What I’m looking for is how to setup Ceramic so it takes into account:

a) Dynamic Content Scaling - http://www.coronalabs.com/blog/2010/11/20/content-scaling-made-easy/

b) Different size number tiles for each level - i.e. levels may have different overall lengths both in horizontal and vertical direction - so the Tiler map file itself will effectively specify this

c) Want to set the number of pixcels (or Tiles) to align with a devices screen height and scale to this for each device, then the game level runs off to the right as it’s a horizontal scroller.  This way I can build a level that is one screen’s worth high by building with the same number of Tiles high.  Or if I want it to have a height of twice the screen height, then build that level with twice the number of tiles deep.

Do I need to do this scaling myself outside Ceramic, or is this something you could build into Ceramic?  (ability to tell Ceramic how many tiles should fit into one vertical screen’s worth)

@greg886:

 Yes.

As for using objects for physics, it’s fine to do that on small maps, but objects aren’t culled, so it can get “dangerous”; i.e. many objects = much memory. Object culling should come sometime in the future, but in the meantime, keep your object count relatively low.

Apologies - I didn’t see your other two questions. Here goes:

a. I find somewhere between 32 and 64 px tiles to be best. I’d actually advice either 32 or 64, because 32 and 64 are nice round numbers and can be compatible with most maps.

b. Hm… You could still use tiles in the same map, but beware of culling speed possibly slowing down.

@txarly:

The parallax issue should be fixed now - you can download the fix (it’s just a patch, so I’m waiting for more updates before adding to the superqix repo) at my CoronaTiled page (GymbylCoding/CoronaTIled) on GitHub.

  • C

thanks caleb P, works great now.

Just another question,

I use for mi application third party tools as textcandy for corona.Is it posible to use with ceramic?what is the best way to do that?(let´s think that i want to create an effect with candy text every time a coin is picked)

thanks

TextCandy (I don’t have it, but it would appear this should work) should be able to be added simply by adding any text objects you create into a layer in Ceramic, just as you do with other extra objects.

  • C

@txarly did you figure out how to do the enemies? i got a map and a player, it works great, but the enemies move with the camera and i dont know how to unbound them from the camera, so they have their own movement.

what happens is that when the camera moves focusing on the player, the enemies are dragged with the camera, if the camera is not moving, the enemies move as expected… any idea how to unbound them so the camera doesnt drag them?

great work with ceramic btw!! its easy to use and i like it a LOT!

@kornjjuan:

Make sure you have the enemies inserted into (preferably) the same layer as the player, and you should have no problem with odd movement.

Glad you like Ceramic!

  • C

@Caleb P thanks!! just added the enemy to the same layer and worked perfectly!

Quick update on engine progress:

I’ve created a “data structure” called a  Twindex - named because of its two almost identical index lookup tables - that allows for quick X,Y position lookups. It’s based on the idea that if you can iterate only through the X,Y positions that actually have something in them, things will work a lot faster. For example, if you are iterating through 24 cells each frame, but only 2 of them actually have something in them, you could actually just do those two and achieve the same effect.

Anyhow, things are looking good - Twindex implementation’ll take a while, but it should be worth it, I think :slight_smile:

Quick question for the community:

Which is better, a single-file tile engine with all the code in one Lua module or a folder with cleaner code but more files? I’m wondering whether Ceramic should be split up into multiple files or not - all usage would be exactly the same, you’d just require() it with

[lua]

local ceramic=require(“Ceramic.Ceramic”)

[/lua

EDIT: If no one has a preference, I think I’ll split things up to get the code cleaner and less overwhelming.

I prefer many files with cleaner code, i think is easier to understand, but thats me :slight_smile:

great about the Twindex! ill check it out!

Ok, I’m really sorry for the long delay…

Not quite done with the update, but here’s an update on the update:

  • Twindex implementation is just about completed (still has a couple of wrinkles to iron out), and makes the culling much faster

  • Aspect ratio and screen size differences render correctly

  • Multiple files instead of one big library (loads exactly the same, only internally it includes all the other files)

  • New data layer format for tile layers, specified with property “!data!” as true - no drawing, erasing, or anything, but you can access X/Y positions through library methods (it’s actually pretty cool…)

  • New “property:” prefix to add to a layer’s properties table, so that you can add custom properties that are keywords in Corona

  • New object layer “get” functions - iterator for all objects, all objects whose name is [x], and all objects whose name matches [x] (using Lua patterns)

  • No scaled camera support yet

I’d also like to thank everyone who uses this for using it - when you’re an indie programmer who does this as a part-time project, it’s nice to have supporters :slight_smile:

  • C

no2games / Caleb P

I tried to download https://github.com/superqix/CoronaTiled/blob/master/tutorial.zip?raw=true and got a page not found.  Where can we get the file?

Thanks

noral.kuhlmann:

The tutorial is now melded into the main repository - just click the ZIP icon and download the whole thing, and you’ll be able to run it from the main.lua file.

Everyone Else:

Apologies for how long it’s taken for the new version… I’ve had to start completely over (text editor state loss :angry:). This implementation, though, should be quite good. I’m going to open a parallel window and rewrite everything (literally).

Ok, I’m really sorry for the long delay…

Not quite done with the update, but here’s an update on the update:

  • Twindex implementation is just about completed (still has a couple of wrinkles to iron out), and makes the culling much faster

  • Aspect ratio and screen size differences render correctly

  • Multiple files instead of one big library (loads exactly the same, only internally it includes all the other files)

  • New data layer format for tile layers, specified with property “!data!” as true - no drawing, erasing, or anything, but you can access X/Y positions through library methods (it’s actually pretty cool…)

  • New “property:” prefix to add to a layer’s properties table, so that you can add custom properties that are keywords in Corona

  • New object layer “get” functions - iterator for all objects, all objects whose name is [x], and all objects whose name matches [x] (using Lua patterns)

  • No scaled camera support yet

I’d also like to thank everyone who uses this for using it - when you’re an indie programmer who does this as a part-time project, it’s nice to have supporters :slight_smile:

  • C

I’m making progress live at http://gymbylcoding.github.io, so be sure to go check if you want to see what’s coming along! You can see the last update time at the bottom right of the screen.

The name of the engine is changing… Again. This time, it’ll be the “Twilight Engine”. The name’ll take effect once the new version comes out.

  • Caleb

This is great work! I’m giving it a go now and hopefully it will be able to make development of my game much more straight forward. Thanks!

There seems to be a problem with the current public release of the Corona SDK and Ceramic. I cloned Ceramic and tried opening main.lua in the Corona Simulator but it crashes with a segmentation error (someone else I know has tested it with the same issue). 

I’m not sure what has changed but has anyone figured out how to get it working? My debugging is getting me nowhere currently. :frowning:

Actually, after another look, this only seems to affect the platformer sample, the other four samples work fine. 

I’m quite new to Corona and Lua, but so far Ceramic has helped me a lot, but I have one question. when I change a scene with Storyboard how do I remove the map from the screen?