Tiled (TMX) Loader

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Re: Tiled (TMX) Loader

Postby mzechner » Tue Nov 23, 2010 8:41 pm

I guess it would be a good idea to setup a Google Code project for this tile map stuff so everyone in this thread can contribute, i.e. debug, optimize and so on. If all works out we'll integrate it into libgdx core. I'm afraid i don't have time to setup up things at the moment (book writting is eating me). Would you be willing to throw the desktop and android projects of your tile map stuff up on google code? Just have libs/ folders in both and but the latest nightlies in there. Nate and me could then rebind the projects to the source code for debugging and everyone else can grind away on the actual code.
mzechner
Site Admin
 
Posts: 4875
Joined: Sat Jul 10, 2010 3:50 pm

Re: Tiled (TMX) Loader

Postby BurningHand » Tue Nov 23, 2010 8:49 pm

I just created a project up on Google Code:

http://code.google.com/p/libgdx-tiled/

Have yet to add my source I have yet.
Will report back here once I do.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: Tiled (TMX) Loader

Postby aksarfevad » Tue Nov 23, 2010 8:53 pm

I don't mind putting my code up there. I have most of the core code almost done (the stuff we don't need to worry too much about optimizing). All it really needs is better documentation and object loading (which would be simple to add).

BurningHand: I'll have to see (when I get home) if my rendering suffers from the same slowdown with 4 layers using the row meshes. Your implementation sounds very similar to mine. How many tiles on screen/what size? What device were you testing on? All I have is a Motorola Droid.
aksarfevad
 
Posts: 275
Joined: Fri Nov 19, 2010 4:19 am

Re: Tiled (TMX) Loader

Postby BurningHand » Tue Nov 23, 2010 9:03 pm

I was using an ADP2, which is an HVGA. I was using 32px tiles so, 15 * 10, though only a small portion were textured.
I have a Droid and a Evo that I can test on as well, though I saw a major slowdown on desktop too.

The SpriteCache method has much better performance, but I had the issue I mentioned in an earlier post. I think it boils down to the index issue, the SpriteCache is indexed, my mesh was/is not.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: Tiled (TMX) Loader

Postby consiliens » Tue Nov 23, 2010 9:15 pm

I'm interested in isometric maps and am looking forward to seeing the TMX code.
consiliens
 
Posts: 177
Joined: Wed Oct 27, 2010 6:55 am

Re: Tiled (TMX) Loader

Postby aksarfevad » Tue Nov 23, 2010 9:37 pm

The only worry I have with using the sprite cache is the limit on the number of total tiles per sprite cache.

mzechner wrote:SpiteCacue uses indexed geometry internally so you have 64k/6 tiles agailable at most. I think going witu Mesh is actually a hetter idea now that i tapked a little witu Nate


Doing the math if we assume 4 layers that leaves us with 2.67k tiles per layer. This sounds like a lot, but that limits the map size (assuming square) to about 50x50. I haven't tested indexing either, but I guess I don't really understand how that works. I thought it was just a convenience option. We could still use indexing outside of the sprite cache class and see if that improves things. Are you using GL_TRIANGLES or GL_TRIANGLE_STRIP? I don't think I'm getting any improvement from using a triangle strip anymore but I haven't tested it to see. Have you enabled face culling?

consiliens: Isometric maps haven't even been considered by anyone so far. It looks like they would take more processing than the orthogonal since they have overlapping tiles (at least in the example image on the Tiled site).
aksarfevad
 
Posts: 275
Joined: Fri Nov 19, 2010 4:19 am

Re: Tiled (TMX) Loader

Postby aksarfevad » Tue Nov 23, 2010 9:44 pm

Nevermind on the indexing... google is my friend. I will have to look into using indexes. I think you are right it could be much faster.
aksarfevad
 
Posts: 275
Joined: Fri Nov 19, 2010 4:19 am

Re: Tiled (TMX) Loader

Postby consiliens » Tue Nov 23, 2010 11:58 pm

aksarfevad wrote:consiliens: Isometric maps haven't even been considered by anyone so far. It looks like they would take more processing than the orthogonal since they have overlapping tiles (at least in the example image on the Tiled site).

Once the code is available I'll look into isometric support. AndEngine doesn't support isometric so it'll be a nice feature for libgdx.
consiliens
 
Posts: 177
Joined: Wed Oct 27, 2010 6:55 am

Re: Tiled (TMX) Loader

Postby BurningHand » Wed Nov 24, 2010 4:10 am

I'll do my best to "standardize" my code tonight/tomorrow and get it uploaded asap.

BTW, anyone who wants to participate officially on the project over there,
please let me know.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: Tiled (TMX) Loader

Postby aksarfevad » Wed Nov 24, 2010 4:34 am

I have cleaned up my project quite a bit. I've been testing the time it takes just to draw all 4 layers. I'm looking at about 7mS for each draw on my Motorola Droid (sounds fast enough to me). I have blending enabled and have some tiles that are translucent. I'm really happy with where mine is now.

http://www.filedropper.com/myrpg_1

What I have left to do:
-add object loading
-add support for GLES 2.0.
-document better and add the license info
-create a "proper" test setup

Please try it and report anything you don't like :)
aksarfevad
 
Posts: 275
Joined: Fri Nov 19, 2010 4:19 am

PreviousNext

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 3 guests