Page 19 of 27

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Sat Oct 13, 2012 8:00 am
by Kadoba
If you want to draw everything regardless of where the camera is you can set map.viewW and map.viewH to math.huge.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Mon Oct 15, 2012 5:35 pm
by Xikeon
Hi,

First of thanks for this. Looks great and I would like to use it. I'm having an issue though.

When I launch the app, it shows the map and then directly starts fading out and I only see this:
Image

This is my code:

Code: Select all

-- Isometric Test

function love.load()
	loader = require "AdvTiledLoader.loader"
	loader.path = "maps/"
	map = loader.load("desert.tmx")
end

function love.keypressed(k)
	if k == 'escape' then
		(love.event.push or love.event.quit)('quit')
	end
end

function love.draw()
	map:draw()
	love.graphics.print("Hello World", 100, 100)
end
Does anyone maybe know why this happens?

edit: This seemed to be an issue with getColor() and being handled in IRC. Not an issue in ATL specifically apparently.

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Tue Oct 16, 2012 4:43 pm
by Uhfgood
Still asking for a way to skin maps. I also had a thought about it, what if you saved multiple tilesets in your tiled map, and then the ATL would simply allow you to assign different tilesets to each layer. I don't think it would be hard, you would just be pointing it to another tileset in the currently loaded map. If it is hard let me know. If you don't want to do it let me know if there's a way I could do it myself?

Anyways thanks again for the great library!

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Tue Oct 16, 2012 7:15 pm
by Kadoba
The easiest way would probably be to swap out the image on the tilesets after you load them.

Code: Select all

-- Switch a skin. The skin parameter is a table that has images for all of the different tilesets indexed by their name.
local function reskin(map, skin)

    -- Switch all of the tileset images to new skins but only if they exist
    for tilesetName, tileset in pairs(map.tilesets) do
        if skin[tilesetName] then
            tileset.image = skin[tilesetName]
        end
    end

    -- Clear all of the sprite batches. They use the old images. New ones will automatically be created.
    for layerName, layer in pairs(map.layers) do
        if layer.class == "TileLayer" then layer._batches = {} end
    end

    -- Force a redraw of the sprite batches.
    map:forceRedraw()
end

-- Load the map
local map = Loader.load("myMap.tmx")

-- Suppose these were full of images for the tilesets
local night = {} 
local day = {}

-- Switch all tiles to night time
reskin(map, night)

-- Switch all of the tiles to day time.
reskin(map, day)

Re: Advanced Tiled Loader - Updated to 0.11.2!

Posted: Thu Oct 18, 2012 10:04 pm
by Kadoba
Advanced Tiled Loader has been updated to 0.12.0.

It is now possible to save maps! In addition you can now set ATL properties inside of Tiled itself.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Thu Oct 18, 2012 11:40 pm
by Karai17
Oh wow, both of those features are awesome! I feel like now we can use ATL to create a living-world MMO-type game where players can interact directly with the world and if a server resets, all changes aren't lost :)

Is the world save very resource intensive? Would there be any noticeable lag during a world save event?

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Fri Oct 19, 2012 2:17 pm
by Kadoba
I would also like to note that the saved maps are saved as "csv" and are uncompressed. This is because the current library I use for zlib/gzip only decompresses. If anyone could find me a pure-lua library/script that can compress into zlib/gzip I would be grateful.
Karai17 wrote:Oh wow, both of those features are awesome! I feel like now we can use ATL to create a living-world MMO-type game where players can interact directly with the world and if a server resets, all changes aren't lost :)

Is the world save very resource intensive? Would there be any noticeable lag during a world save event?
It depends on what you mean by MMO-type and how you plan to structure your game. Maps have to be serialized into an uncompressed XML document which is very slow and large on the disk (comparatively). It's perfectly fine for most single player games, but you're going to run into issues if you want to quickly save entire multiplayer living game worlds.

If you're going to have the time and resources to make a large game like that you might want to make your own data format. If you take that route then you could use the provided save feature now and easily substitute your own later. Who knows, maybe it will be fast enough for your needs.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Mon Oct 22, 2012 6:09 pm
by KingRecycle
I feel like I saw this but I can't find it.

Is there a way to not draw a specific layer but keep it's properties?

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Mon Oct 22, 2012 7:06 pm
by Kadoba
KingRecycle wrote:I feel like I saw this but I can't find it.

Is there a way to not draw a specific layer but keep it's properties?
Yes. You can hide a specific layer by setting Layer.visible to false or you can change the map to not draw any object layers by setting Map.drawObjects to false.

Code: Select all

-- Hide a layer
map("MyLayer").visible = false

-- Hide all object layers
map.drawObjects = false

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Mon Oct 22, 2012 11:23 pm
by Karai17
A thought. How feasible would it be to use ATL without grid locking? And further on that notion, How feasible would it be to detect collisions with objects without grid locking? For instance, if I have a rock sitting in the middle of a tile, How could I detect only the part of the tile that is not transparent? Would I maybe need semi-complex polygons over top the collision area, or would it be possible to determine if the sprite's opaque pixels are going to collide with the rock's opaque pixels?

I like ATL very much; working with Tiled maps is quite easy and I wouldn't want to lose such a great tool for this thing I am about to start working on.