TiledMap with HTML5

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

TiledMap with HTML5

Postby Mighty16 » Wed May 30, 2012 8:31 am

Hi! I have a game for Android which uses tiled maps (.tmx) and now I am porting it to HTML5, is it possible to use TiledMap with it?If so, how can I load it without TiledLoader?
Mighty16
 
Posts: 10
Joined: Wed Aug 31, 2011 1:33 pm

Re: TiledMap with HTML5

Postby BurningHand » Wed May 30, 2012 1:01 pm

The Tiled maps don't currently work with the GWT backend. I am in the middle of a rewrite of the Tiled module to rectify that but I can't give any ETA on it.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2429
Joined: Mon Oct 25, 2010 4:35 am

Re: TiledMap with HTML5

Postby Mighty16 » Wed May 30, 2012 1:13 pm

That's no good((I think we can use Java version of Tiled, export as JSON without compression, build custom loader for TMX files using JsonReader. The problem is that I can't figure out how to extract data during
Code: Select all
JsonReader.parse(FileHandle tmxFile)
Any suggestions?
Mighty16
 
Posts: 10
Joined: Wed Aug 31, 2011 1:33 pm

Re: TiledMap with HTML5

Postby siondream » Wed May 30, 2012 2:34 pm

I'm currently working on a rewrite of the Tiled module for my own project, I wouldn't mind sharing it once it's tested on all platforms. It will be compatible with the AssetManager and i'll add culling to improve performance. It's still in design stage though.
siondream
 
Posts: 236
Joined: Tue Apr 03, 2012 11:59 pm

Re: TiledMap with HTML5

Postby BurningHand » Wed May 30, 2012 3:00 pm

That'd be cool. Perhaps we could bounce ideas off each other.

My rewrite is going more a generic route because I personally don't use the Tiled format so I am trying not to tie my rewrite to that format.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2429
Joined: Mon Oct 25, 2010 4:35 am

Re: TiledMap with HTML5

Postby siondream » Wed May 30, 2012 4:37 pm

BurningHand wrote:My rewrite is going more a generic route because I personally don't use the Tiled format so I am trying not to tie my rewrite to that format.


So... Does your approach go through exporting tmx files into your own format or are you not using Tiled at all? If it's the former, what kind of file format are you aiming at? Maybe a binary one so it's faster to load?
siondream
 
Posts: 236
Joined: Tue Apr 03, 2012 11:59 pm

Re: TiledMap with HTML5

Postby BurningHand » Wed May 30, 2012 4:42 pm

My loader (theoretically) handles multiple file formats, at the moment, the Tiled XML format, my own XML format, and JSON are "working". The loader has the ability to save in JSON format, so the idea is that a map of any supported format could be loaded and saved into the "native" format (JSON).
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2429
Joined: Mon Oct 25, 2010 4:35 am

Re: TiledMap with HTML5

Postby Mighty16 » Wed May 30, 2012 6:39 pm

My loader (theoretically) handles multiple file formats, at the moment, the Tiled XML format, my own XML format, and JSON are "working". The loader has the ability to save in JSON format, so the idea is that a map of any supported format could be loaded and saved into the "native" format (JSON).

What about file size of the map? Do you use glib/zlib? The problem is supporting such algorithms in HTML5, I think)) How can we solve it?
Mighty16
 
Posts: 10
Joined: Wed Aug 31, 2011 1:33 pm

Re: TiledMap with HTML5

Postby BurningHand » Wed May 30, 2012 6:50 pm

Mighty16 wrote:
My loader (theoretically) handles multiple file formats, at the moment, the Tiled XML format, my own XML format, and JSON are "working". The loader has the ability to save in JSON format, so the idea is that a map of any supported format could be loaded and saved into the "native" format (JSON).

What about file size of the map? Do you use glib/zlib? The problem is supporting such algorithms in HTML5, I think)) How can we solve it?


The JSON format doesn't have to be compressed, though that would obviously be nice. JSON is a heck of a lot smaller than XML. Unless it were a VERY large map, I doubt it would be a problem. Plus it would be cached by the browser.

I am not real sure if GWT includes the gzip implementation. Perhaps Mario knows... I'll ask him. If anything, you can make sure that your server is serving the files gzipped and let the browser handle it.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2429
Joined: Mon Oct 25, 2010 4:35 am

Re: TiledMap with HTML5

Postby Mighty16 » Wed May 30, 2012 7:09 pm

Today I was trying to compare possible results and my average level map (600x40 tiles) was 2,6 mb -xml, 700 kb -uncompressed base64 and JSON about 400 kb! That's not so good as it was for Android project, where I had 28 kb. And yes, glib/zlib is not supported in gwt, I think it is because Js)))So, it seems that we should use uncompressed JSON for HTML5 version, but I'm trying to find a cross-platform solution, where we have one tmx map(glib) and we build each project and it decodes our map in proper way,e.i. to JSON in order to use in Web App)))
Mighty16
 
Posts: 10
Joined: Wed Aug 31, 2011 1:33 pm

Next

Return to General Development

Who is online

Users browsing this forum: davebaol and 2 guests