Tiled Map Engine

This is a thread for creation of an opensource tiled map loader+game engine.

If you wish to contribute to it, please feel free - just post and you can be included in the development. You can also put feature requests, comments, etc. [import]uid: 147322 topic_id: 35538 reply_id: 335538[/import]

Sounds good. We can keep things on both DropBox (private) and GitHub (public). I just got LUA maps loading in my codebase, so if it’s okay with you we can start there…

Send me your email and I can share the project folder with you. I can handle releases via GitHub at the github URL for the project.

Here’s where the latest code and example will live for the community…

https://github.com/superqix/CoronaTiled/archive/master.zip [import]uid: 51498 topic_id: 35538 reply_id: 141252[/import]

Hey guys, I just found Caleb’s post yesterday, and I’m very excited to see what you two end up creating. I’d like to put in a request if you guys don’t mind.

Request:
–Physics for the Object Layer in Tiled (as well as adding Object Layer support).-- The reason why I point this out is that after people create tiled layers for their maps, it’d be nice to add physics bodies in the form of objects (instead of a second layer with tiles including physics). *Nice for when people are trying to add physics to their map and surfaces don’t match up exactly with tile edges.* Using different layers and creativity, just allowing objects would open a million possibilities and customization right away.

Forgive me but I’m fairly new to programming and have been making a game on corona by myself. I have a question (or request I guess) pertaining to the current version of GridMap. I’m just confused with the documentation for how to add physics to the tiles using your program. Do you possibly have some sample code I could look at where a physics tile layer interacts with some moving object or something? Thanks, rather than having you explain it to me this would probably be better… Then I’m wasting my time and not yours. :slight_smile: Thanks!
[import]uid: 215209 topic_id: 35538 reply_id: 141265[/import]

Hey, @no2games:

I have another suggestion. Instead of communicating with email, how about ALL of the communication goes on within this thread? Basically like using this thread as an email conversation. I know it might get cluttery, but then it would really be open source. If you don’t want to do that, we’ll have to think up something else - I don’t want to communicate through email.

@cjc83486:

https://www.dropbox.com/s/a5y5zhop7mpqsc6/GridMapExample.zip

The images for it are sourced from IndieGameDesigner.com - I got them from this thread and watermarked them. [import]uid: 147322 topic_id: 35538 reply_id: 141319[/import]

@Caleb, I’m fine with using the thread for communication. I think I need an email to share the dropbox folder with you if we both want access to update files. I don’t know if this board does PMs, but that would be better than posting your email here :slight_smile:

BTW, Github is better for merging changes if we get a bunch of devs signing up, but I’m sure we can make it work initially if it’s just the two of us.

I will check out your example too, I’m trying to merge our two code bases right now…

@cjc83486

I’m all about the objects layer. It’s one of the reasons I want to build this importer. [import]uid: 51498 topic_id: 35538 reply_id: 141330[/import]

Okay, it looks like Corona Lime is going OSS on GitHub… That may render this project moot…

http://developer.coronalabs.com/forum/2013/02/01/lime-update-news-not-download-link

I’m going to offer my help getting corona lime onto GitHub, so maybe this turn into updates and such for a common code base. [import]uid: 51498 topic_id: 35538 reply_id: 141332[/import]

Sounds good. We can keep things on both DropBox (private) and GitHub (public). I just got LUA maps loading in my codebase, so if it’s okay with you we can start there…

Send me your email and I can share the project folder with you. I can handle releases via GitHub at the github URL for the project.

Here’s where the latest code and example will live for the community…

https://github.com/superqix/CoronaTiled/archive/master.zip [import]uid: 51498 topic_id: 35538 reply_id: 141252[/import]

Hey guys, I just found Caleb’s post yesterday, and I’m very excited to see what you two end up creating. I’d like to put in a request if you guys don’t mind.

Request:
–Physics for the Object Layer in Tiled (as well as adding Object Layer support).-- The reason why I point this out is that after people create tiled layers for their maps, it’d be nice to add physics bodies in the form of objects (instead of a second layer with tiles including physics). *Nice for when people are trying to add physics to their map and surfaces don’t match up exactly with tile edges.* Using different layers and creativity, just allowing objects would open a million possibilities and customization right away.

Forgive me but I’m fairly new to programming and have been making a game on corona by myself. I have a question (or request I guess) pertaining to the current version of GridMap. I’m just confused with the documentation for how to add physics to the tiles using your program. Do you possibly have some sample code I could look at where a physics tile layer interacts with some moving object or something? Thanks, rather than having you explain it to me this would probably be better… Then I’m wasting my time and not yours. :slight_smile: Thanks!
[import]uid: 215209 topic_id: 35538 reply_id: 141265[/import]

Hey, @no2games:

I have another suggestion. Instead of communicating with email, how about ALL of the communication goes on within this thread? Basically like using this thread as an email conversation. I know it might get cluttery, but then it would really be open source. If you don’t want to do that, we’ll have to think up something else - I don’t want to communicate through email.

@cjc83486:

https://www.dropbox.com/s/a5y5zhop7mpqsc6/GridMapExample.zip

The images for it are sourced from IndieGameDesigner.com - I got them from this thread and watermarked them. [import]uid: 147322 topic_id: 35538 reply_id: 141319[/import]

@Caleb, I’m fine with using the thread for communication. I think I need an email to share the dropbox folder with you if we both want access to update files. I don’t know if this board does PMs, but that would be better than posting your email here :slight_smile:

BTW, Github is better for merging changes if we get a bunch of devs signing up, but I’m sure we can make it work initially if it’s just the two of us.

I will check out your example too, I’m trying to merge our two code bases right now…

@cjc83486

I’m all about the objects layer. It’s one of the reasons I want to build this importer. [import]uid: 51498 topic_id: 35538 reply_id: 141330[/import]

Okay, it looks like Corona Lime is going OSS on GitHub… That may render this project moot…

http://developer.coronalabs.com/forum/2013/02/01/lime-update-news-not-download-link

I’m going to offer my help getting corona lime onto GitHub, so maybe this turn into updates and such for a common code base. [import]uid: 51498 topic_id: 35538 reply_id: 141332[/import]

I’ve still been working on this off and on… I did pull the Physics/Properties code out of GridMap and added to Tiled, but it wasn’t working like I wanted. But, I had a big break though today and bang out a lot of stuff that was just kinda working:

* Set properties & physics from Tiled (thanks to Caleb + GridMap)
* Image Layers
* Object Layers (except for tile objects)
* Physics on object layers with generated bounding shapes (first 8 points)

I still need to clean up some stuff before releasing it into the wild… but it’s looking pretty good.

corona tiled 1

corona tiled 2

[import]uid: 51498 topic_id: 35538 reply_id: 144563[/import]

Wow - looks great!

I’ve also been working on it… Not getting such good results. I’ve been trying (and mostly failing) to get a culling system up.

Which makes me think that we should make a tiled image loader separate from a tiled level builder. I suppose it could just use object layers for physics, and then add it all into the tiled image loader.

Anyways, any ideas on what to name it?

C [import]uid: 147322 topic_id: 35538 reply_id: 144571[/import]

Yes, at some point we should break out the loader/parser from the rendering engine or have different kinds of calls to load maps…

I for sure want to add some more parameters to the load call so you can get to just a portion of the map. that should be enough culling for 99% of the people out there…

function tiledMap:load( mapFile, tileTop, tileBottom, tileWidth, tileHeight )  

Also, one of the issues right now is it’s really hard to set properties of an individual tile in (x,y) space or set an individual objects properties when a object layer has it’s properties set–all these cases tend to overwrite each other.

I think I need some sort of table merge that has a preference setting for which table overwrites the others values.

As far as names go, I’m happy with something simple and straightforward. CoronaTiled is what the GitHub prodject is named, but I’m open to suggestions. :slight_smile: [import]uid: 51498 topic_id: 35538 reply_id: 144577[/import]

Wow, this is nice! Few questions:

Are you using Gridmap, or the one you made previously?
*If the latter, I think you guys should settle on one or the other so you guys don’t overlap on problem solving. :slight_smile:

For the objects that are polygons, it looks like you can use 8 points, in which they can be non-convex as well… is this correct? For the polygon shapes, it looks like there is no middle to the object, do objects sometimes accidently go through these since it has no thickness?

I was talking to Caleb about this before on his gridmap forum, but I’m guessing you’re not subscribed to that Topic… do you think you could have this ready to be used by March 15th? I know it’s only 2 weeks but it seems you are pretty far on it, and that’s when my spring break is. I’ve got a full school load so it’s really the only time I have to put a large amount of effort into my project, so if you could that’d be amazing.

Thanks a lot to the both of you, literally are lifesavors (I wouldn’t have known how to create my game without your projects).

-Curt [import]uid: 215209 topic_id: 35538 reply_id: 144600[/import]

Curt,

This is a combination of GridMap + CoronaTiled, so hopefully you get the best of both. Fast ImageSheet based multi-layer maps and object layers (my CoronaTiled) AND the ability to set Physics and other properties from the Tiled property editor (Caleb’s Gridmap) with some bug fixes and other fun stuff tossed in for good measure.

I think your right, we need to pick a new name and start this as a fresh project so it isn’t confused with all the other projects out there.

Corona’s limit on a physics body is 8 points, and non-convex–I don’t check for either, I just pass the first 8 points and hope for the best.

Things like this are NEVER finished, especially since Tiled supports so many options, but I will post the code so far and an example project/tmx map on GitHub either tomorrow or early next week.

Hopefully a few people can try it out and post some bugs and we can all have something stable by 3/15.

I see few “showstoppers” that I would want to have before we call it a 1.0 version:

* Image layer properties (Stretch to fill map, Tile to fill map)
* A display.newRect() as a map background (solid, gradient)
* Inherited properties at the Map -> Layer -> Individual Tiles/Objects
* Tile objects (player start, power ups, etc)
* Chunking or culling maps
* A few demo projects and maps (Platformer, RPG, Big Map, etc.)
* Documentation, or at least a screencast or two

Anything I’m forgetting? [import]uid: 51498 topic_id: 35538 reply_id: 144611[/import]

I’ve got a name idea - Quartz Tile Engine. That way, if we ever separate the tile renderer and the level builder, we can use rock/mineral names for it to go with the theme. It also sounds pretty cool…

Let me know if that sounds good. That’s all I posted to say - I’ll be back (hopefully) in the morning :slight_smile:

C [import]uid: 147322 topic_id: 35538 reply_id: 144614[/import]

No2games and Caleb,

Yeah that sounds awesome, I don’t mind if a few bugs come up, I’d be happy to test run most of the versions and updates. The game I’m currently making is a RPG, so if you have someone that is making a Platformer, we should have 90% of users covered testing wise.

As far as the design go, I like the idea of making physics objects mainly for the object layer. For most RPG users, I’m unsure if they will benefit too much from tile physics layers over object physics layers. Anyway, this is how I imagine using it:

–Use tile-LAYERS for fore-ground and back-ground layers. *Currently what I’m doing is putting “ground” in the name of the Tiled layers I am having my player walk on. I use a search function for each layer to check for the substring “ground” and put it underneath my character, the rest are set to above.

–Use an Object-PHYSICS-LAYER for houses, trees, fences, etc.
*here you just set the Object physics layer invisible with .isVisible=false These objects don’t really need to be distinguished and can be treated as a layer, since all you need to do is bump into them.

–Use INDIVIDUAL-PHYSICS-Objects for power ups/items/NPC characters
*How I do power-ups currently is use a pre-collision event handler and remove the object before I collide with it. Really all you guys should have to do is to make it so users can access individual OBJECTS. Currently you can set properties on individual objects, so really all people would need to do is have a ‘type’ or ‘name’ property where they can code “Make all objects of type “potionItem” do this…” Basically that functionality is already in there.

–Use Object LAYERS for spawn areas
*Basically you can randomly spawn enemies or items within the bounds of layers of type “spawnArea”. Same thing with a Player start position object. This way making maps is really fast and there aren’t enemies wedged in trees and such.

–Use INDIVIDUAL-Objects for things such as doors and NPC (non-player characters) talking radiuses.
*I’m not sure if I need to use these as physics objects, rather I may just make it when my player is colliding or within a certain distance with these objects to bring up a “talk” or “open door” button once pressed you change map or display talking text.

Well there is how I plan to use it. As you can see, really all you guys have to do is make it so people can add tile layers for background, physic-object-layers for the general static collision (people can make multiple if they want to add character jump features… etc.), and individual physics objects and objects. The rest the user should be able to figure out because there are way too many options that a game designer will want. (possibly the only other thing people could want is physics tile layers and individual physics tiles.

Good luck and thanks a bunch,
-Curt [import]uid: 215209 topic_id: 35538 reply_id: 144630[/import]

Okay, I cleaned up everything this morning and added imageObjects as an object type… These are very cool, because they don’t snap to the grid but use the same images as a tile set, so they are perfect for a layer of interaction enabled tiles scattered about a level.

Caleb and Curt, here’s a direct download from gitHub…

https://github.com/superqix/CoronaTiled/archive/master.zip

Take a look at the TMX file as well for how the layer properties are set up. Right now you go into a layer’s properties and simply add “physics:enabled”=“true” and you get a static body. Add “objects:bodyType”=“dynamic” and they are affected by gravity.

Here are the big issues:

  1. You can’t set a single object or tiles properties–only at the Layer level. This needs to change for this to really be, but I don’t want them to completely overwrite each other. So you could set “objects:bodyType”=“dynamic” at the layer level and “angle”=“45” at the object level and both sets of properties should affect the object.

  2. Polygons and Polylines don’t work consistently. I’m new to Box2d, so I don’t know why. Make some triangles (which should never be invalid) and 80% of them work, but a few act like they aren’t even there. Rects, Circles and Lines work 100% of the time

I love the idea of naming the components out of materials that physical tiles are made out of. There’s Porcelain, Marble, Glass, Quartz, Ceramic, etc. I personally would vote for Ceramic because it begins with a “C” like Corona.

[import]uid: 51498 topic_id: 35538 reply_id: 144680[/import]

Pushed a new commit that takes care of #1 in the msg above. Now you can go into an single object and set its properties. The “physics:” prefix doesn’t work, but “bodyType”, “rotation”, etc. all do.

https://github.com/superqix/CoronaTiled/archive/master.zip

Now if I can only figure out #2

This totally makes me want to build a physics based platformer.
[import]uid: 51498 topic_id: 35538 reply_id: 144693[/import]