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 siondream » Tue Feb 12, 2013 5:09 pm

mzechner wrote:Gah, that draft got lost. Can you resend to my e-mail address?


Done!
siondream
 
Posts: 364
Joined: Tue Apr 03, 2012 11:59 pm

Re: New Tile Maps Implementation

Postby mzechner » Tue Feb 12, 2013 7:02 pm

For reference: https://docs.google.com/document/d/1U3D ... AAAAFm9wjo

We just agreed on the following plan:

1) Mario adds loading without AssetManager
2) Siondream/Nex create a first draft for docs (wiki/blog post). Doesn't have to be perfect, just needs to tell folks about the essentials
3) Merge to master
4) Improve performance where necessary (blending etc.)
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby siondream » Wed Feb 13, 2013 7:34 am

Added the "accessing map data" section to the blog post and answered your comments. Javadocs are on the works, might pull request hard tonight.
siondream
 
Posts: 364
Joined: Tue Apr 03, 2012 11:59 pm

Re: New Tile Maps Implementation

Postby siondream » Wed Feb 13, 2013 6:17 pm

Javadocs pull requested and blog post draft updated. I think the Javadocs could use some sample code for the Map, TiledMapRenderer and GleedRenderer classes. Nex, could you do that please? The wiki article can pretty much then, be made using both pieces of material.
siondream
 
Posts: 364
Joined: Tue Apr 03, 2012 11:59 pm

Re: New Tile Maps Implementation

Postby BurningHand » Wed Feb 13, 2013 8:49 pm

I can do that this evening.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby mzechner » Thu Feb 14, 2013 12:04 pm

Noticed that the PR you send can'T be merged automatically. Did you also pull in master? That would be bad :)
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby BurningHand » Thu Feb 14, 2013 2:43 pm

I didn't get to the sample last night. A project with a deadline took more time than anticipated. It might be this weekend before I can do it.
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

Re: New Tile Maps Implementation

Postby siondream » Thu Feb 14, 2013 5:02 pm

mzechner wrote:Noticed that the PR you send can'T be merged automatically. Did you also pull in master? That would be bad :)


Yeah, I'll do a local backup, clone again, change my stuff and PR again.
siondream
 
Posts: 364
Joined: Tue Apr 03, 2012 11:59 pm

Re: New Tile Maps Implementation

Postby mzechner » Sat Feb 16, 2013 3:30 pm

Nex already merged it.

I did the following things today:

  • Removed loaders package, moved loaders to their respective packages (gleed, tiled)
  • Added direct loading without AssetManager to TmxMapLoader
  • Added Disposable interface to Map, as Map may store resources itself if loaded without AssetManager. Default implementation does nothing
  • Renamed and cleaned up some tests

We have one big problem, namely the setProjectionMatrix() and setViewBounds calls (the later is only in the TiledMapRenderer). Now, the problem is that you can set a projection matrix that shows a different region than the view bounds you set. That will lead to a lot of folks being angry for not seeing anything on screen.

I propose the following: the MapRenderer interface should be changed. The render() methods do not take view bounds anymore, there will be one without arguments that renders all the layers, and another one with an array of layer indices to be rendered. We'll introduce a new method called setView(). We overload it like this:

Code: Select all
public void setView(Matrix4 projectionMatrix, float viewBoundsX, float viewBoundsY, float viewBoundsWidth, float viewBoundsHeight);
public void setView(OrthographicCamera camera);


The first method is for expert use only. Supply your projection matrix and your view bounds manually. The second one is for the common use case where you use a camera. limiting this to an orthogonal camera makes sense, as we couldn't figure out the viewbounds otherwise (it's already problematic with OrthogonalCamera if you think about direction/up vectors, but we'll ignore and document that case).

I'll also add direct loading to the GleedMapLoader.

Thoughts?
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: New Tile Maps Implementation

Postby BurningHand » Sat Feb 16, 2013 4:09 pm

I like the setView idea. I certainly don't want to have to explain the "well you changed your projection, but not your view" so we should definitely vet that before unleashing this on people. For testing, I went ahead and added this to TiledMapRenderer (I know, it should be on MapRenderer, but I wanted to not mess with anything but the tiled stuff for now). Not sure if I expected there to be any differenece other than it being easier to keep the projection and viewbounds in sync.

On an unrelated note. Is the ImageResolver interface/implementations useful outside the maps package? It doesn't have any direct ties to the maps api (aside from being the only place it is being used currently).
IRC: nexsoftware / mobidevelop; GitHub: MobiDevelop;
BurningHand
 
Posts: 2812
Joined: Mon Oct 25, 2010 4:35 am

PreviousNext

Return to Libgdx Development

Who is online

Users browsing this forum: No registered users and 1 guest