New Tile Maps Implementation

Discussions for core devs and contributors. Read only for normal forum members to keep the noise low

Re: New Tile Maps Implementation

Postby mzechner » Sun Feb 17, 2013 3:37 pm

The ImageResolver stuff's not really useful ouside the maps package. Let's keep it there.

I'll update the MapRenderer interface and finish the direct loading of Gleed maps today, then we can think about merging with master.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby BurningHand » Sun Feb 17, 2013 4:11 pm

I built a Tide loader yesterday (but I haven't tested it yet). And started on the animated tile implementation.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby mzechner » Sun Feb 17, 2013 6:19 pm

Ok, i moved the tiled renderers to a separate package. We should get rid of the ones we won't have folks use. We should focus on one and making it as fast as possible, given the constraints. Biggest issue i see is that the tilesets are mutable. If they weren't, we could scan the tilesets, and mark any tiles as transparent that have a pixel with alpha < 1. I'll see if we can make that immutable.

I broke the SpriteCached renderer btw :D I think we should use a Mesh instead of SpriteCache. Biggest problem with caching is that we need to get to know if the map changed. I'm hesitant to introduce dirty flags all over the place :/

I'm also trying my luck with the gleed loader. Proves to be hard because i can't use Gleed (loading the test map doesn't work), nor do i have any idea how our own TextureAtlas class can end up in the Gleed output. Siondream, any input on that? Are we supposed to add the atlas property manually to the xml? Not sure that's a good solution.

I want to finish of the tiled map support asap, then merge with master. The Gleed stuff needs a bit of work as well, but that's not a high priority for me. Not a lot of folks seem to use Gleed, and the editor itself hasn't been maintained since 2010.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby siondream » Sun Feb 17, 2013 9:07 pm

mzechner wrote:I'm also trying my luck with the gleed loader. Proves to be hard because i can't use Gleed (loading the test map doesn't work), nor do i have any idea how our own TextureAtlas class can end up in the Gleed output. Siondream, any input on that? Are we supposed to add the atlas property manually to the xml? Not sure that's a good solution.


You need to add an "atlas" property at the root level indicating the path to your atlas file. Problem is, Gleed saves absolute image paths... Boooh... I used Gleed cause I couldn't find another decent non tile based editor. I'm thinking of grabbing Magnesus SVG level system and adapt it to our maps api.
siondream
 
Posts: 364
Joined: Tue Apr 03, 2012 11:59 pm

Re: New Tile Maps Implementation

Postby BurningHand » Sun Feb 17, 2013 9:18 pm

Just tested the Tide loader and all is well there. I am currently ignoring animated tiles in the renderer though, because I am not certain how we should handle setting the animation time. In Tide, maps are constructed in such a way that the tiles have a reference to the map they are being used in, then the map has an update method and an elapsed time which the tiles just query at render time. I didn't want to do that but it is certainly an option.

Also, need to figure out exactly how the parallax stuff works in Tide. The map doesn't seem to specify anything about it so it must be some convention.

Edit:

Digging into how parallax is handled in Tide, it seems that it is a function of the size of the layer to the size of the map. Presently, we do not explicitly store the size of the map (or the layers, though in a tiled layer you would derive it from the count of tiles times the size of the tiles). I suppose it would be a good idea to add a size field to the map and maplayer classes.

Thoughts?
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby mzechner » Tue Feb 19, 2013 3:26 pm

@parallax, whatever is most generic. Having a property on the Map makes sense i guess. Not sure how that works with unit mapping though.

@animated tiles, that's a hard one. We differentiate between Cell and the tile from a tileset. The tile can be shared by multiple cells. If we do animation on a per tile basis, all cells sharing the animated tile would show the same animation frame. Is that ok? In that case i think it would be fine if tilesets kept track of the delta time, map provides an update method to increase/decrease/set delta time, and would hand that to the tilesets which update their animated tiles.

If each cell should be animated individually, even if it shares the same tile with other cells, then the layer would have to keep track of all animated cells and do the update delta time dance.

It's hard from an API perspective, and i fear it will not be the fastest thing on earth.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby BurningHand » Tue Feb 19, 2013 3:34 pm

In Tide, tiles are not shared. Every time a tile is used, it is a new instance. There, instead of the tile holding a TextureRegion, it holds a reference to the tile set and its index in that tile set. This is an interesting approach because the TextureRegion has to be looked up / calculated for every instance of every tile.

I think it's OK for all cells sharing an animated tile to use the same animation frame, personally.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby mzechner » Tue Feb 19, 2013 4:20 pm

Does Tide map to the current TiledMap API then? Can you commit what you have?

I think the tilesets should be responsible for updating state time and setting the texture region on the animated tile. Not sure. It does have a big impact on rendering if we want to do any kind of caching there (not sure about that either, i think we might get away with rendering on the fly)
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby BurningHand » Tue Feb 19, 2013 6:02 pm

It's already on GitHub (sans working parallax) and does map to the api. I was speaking to the original Tide implementation.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby mzechner » Tue Feb 19, 2013 11:35 pm

I've been messing with the Gleed2D loader/renderer today. Gleed2D is horrible, i feel for siondream as he had to suffer through this bullshit. His solution with the texture atlas is a band aid for Gleed2D's inability to even get the basics right. Files are stored as absolute paths in the resulting XML. It's ridiculous.

I propose to drop the gleed2d support, it's a horrible, useless format, the editor hasn't been maintained for 2 years. Instead i propose writting a Gleed2D replacement that actually works as it should.

Tiled and tide support seem to be solid, minus animated tile support, which we can put in later (same for optimizing rendering).

I propose we merge with master tomorrow. I want the wiki article and blog post up, and i want to write a simple platformer example for folks.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

PreviousNext

Return to Libgdx Development

Who is online

Users browsing this forum: No registered users and 1 guest