Page 3 of 27

Re: Advanced Tiled Loader

Posted: Mon May 09, 2011 9:35 pm
by adrix89
The problem with multiple batches is that you limit the number of tilesets you can have

Re: Advanced Tiled Loader

Posted: Tue May 10, 2011 7:09 am
by Kadoba
How?

Re: Advanced Tiled Loader

Posted: Tue May 10, 2011 2:07 pm
by adrix89
A sprite batch uses one image,if you had a map with tiles from 10 tilesets you would have to have 10 sprite batches
So drawing the sprite batch changing the image then redrawing and so on is one solution but my guess is that the cpu would bottleneck it that way
So its probably just simple to have 2-3 spritebatches and if there is more to draw you can distribute it evenly among them

Re: Advanced Tiled Loader

Posted: Tue May 10, 2011 3:09 pm
by Kadoba
I apologize but I must be really missing something crucial. You would still have all 10 of those images loaded into memory. You would still have 10 draw calls. What is the difference in rotating out the assigned images and quads in a few sprite batches than having them already loaded in several?

Re: Advanced Tiled Loader

Posted: Tue May 10, 2011 7:07 pm
by adrix89
Never mind seems I had the wrong impression here.

Re: Advanced Tiled Loader

Posted: Wed May 11, 2011 3:00 pm
by Kadoba
No problem.

In other news, update! SpriteBatch support is working and does drastically improve performance. But as expected it also breaks a few things. Specifically, if you use multiple tilesets on the same layer and the dimensions of those tiles are bigger than the map's tilewidth and tileheight then the drawing order will likely be messed up. It's a specific case but it breaks complete compatibility with Tiled. Using TileLayer:drawAfterTile() is also not possible with sprite batches enabled.

To enable sprite batches set the tile layer's use_batch variable to true. This is set to false by default.

The automatic PO2 fix is also working. To use it set the loader's fix_po2 variable to true BEFORE you load the map.

Here is a full list of changes:
0.8.2 (5/11/11):
- Tileset images are now cached between maps.
- Added an option to automatically pad images for PO2. To do this set Loader.fix_po2 to true.
- Changed Map.tl and Map.ol back to Map.tilelayers and Map.objectlayers. Map.tl and Map.ol remain as aliases.
- Tile layers can now render using sprite batches by setting TileLayer.use_batch to true.
- Added an init.lua file.
- Removed hardcoded require() paths. Added in global TILED_LOADER_PATH to point to the library path.
- Renamed the TileSet functions getWidth() and getHeight() to tilesWide() and tilesHigh().

To download the version 0.8.2 click here.

Re: Advanced Tiled Loader

Posted: Fri Aug 05, 2011 8:17 pm
by pudding
Not sure if this is just a problem with my computer or not but the desert example is being trimmed to what appears to be 1024x1024 pixels in 0.8.2 from the top left corner, that happens whether spritebatches are turned on or off. The obstacles still work even though they're invisible. The problem doesn't exist in 0.8.1.

The version numbers relate to the Advanced Tiled Loader.


Edit:
Sorry, I'm an idiot who doesn't know how to search.

Although it's not entirely clear (to me at least) from the thread, the fix Kadoba suggests in http://love2d.org/forums/viewtopic.php? ... 18&p=34493 resolves this problem.

Re: Advanced Tiled Loader

Posted: Sat Aug 06, 2011 3:32 am
by Kadoba
pudding wrote: Sorry, I'm an idiot who doesn't know how to search.
No that's really something I should fix but I've been lazy. BUSY! I mean busy.

The reason it's bugged is because it uses map.tilewidth and map.tileheight instead of map.width and map.height to limit maximum tiles. But map.tilewidth and map.tileheight are the dimensions of the tiles (in pixels) and map.width and map.height are the dimensions of the map (in tiles).

I'll put the fix in and reupload 0.8.2.

Re: Advanced Tiled Loader

Posted: Tue Aug 23, 2011 7:10 pm
by Kadoba
Hey guys. A pretty big update.

Advanced Tiled Loader 0.9.0 is out! I wanted to clean the code up and make it more consistent. There's quite a few identifier changes which will probably break compatibility if you try and switch out an older version for it. Sorry about that. But I think the changes will help the overall health of the project and make it less confusing for new people to use.

Another big thing is that there is now a github repository. I'm also working on the wiki which will have documentation and some beginner tutorials. It's currently a work in progress though.

Here's a list of the changes:

0.9.0
- Advanced Tile Loader now has a wiki page and a github repository!
- Cleaned up the code quite a bit.
- Classes are now broken up into individual files rather than grouping similar ones into one file.
- Many identifiers have been changed to be less confusing and more consistent. Now camelCase is
used to separate words instead of underscores. Internal functions and data are now prefixed
with an underscore.
- Sprite batch mode can now be set through the map or through individual tile layers. Tile layer
settings take precedence.
- A bug with layer transparency has been fixed.
- Tile:draw() now accepts parameters for scaling, rotation, and offset.
- TileLayer:drawAfterTile() now works with multiple functions
- Forcing a redraw is now automatic when you switch sprite batch modes.
- Added support for flipped tiles that were introduced in Tiled version 0.7.0

Re: Advanced Tiled Loader

Posted: Tue Aug 23, 2011 8:43 pm
by florian
Thank you for this release and thank you very much for putting the code & wiki on GitHub!