So I want to load the tiled map and its elements. Need help with this.
There is no single be-all end-all module/solution for this. There are many, each with their own benefits and draw backs, so we don’t know if you’re referring to specific solution here or asking a general question.
That said, what has your research turned up so far?
Please share links to resources you’ve found and tried and we’ll give you feedback and help deciding which will work best for you.
Google searches that will help:
PS - While Tiled does produce a Lua table in a file, it isn’t really a module (has no functions). You consume this with one of the many solutions out there to do the actual work of creating a level. Thus, my suggestion that you tell us what you have tried.
To prove I’m not too mean a guy, let me get you started on possible solutions:
- https://github.com/ponywolf/ponytiled
- https://github.com/GymbylCoding/Dusk-Engine
- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/tiled/ ( SSK2)
- …
Some great reading and videos if you go with Ponywolf solution:
Getting into it.
You don’t need to quote, you can just respond. Quoting every prior response makes threads hard to read. Please remember. Threads have two purposes:
- A place for you to get help.
- A place for others to go later and read what you asked and what the answers were.
The more legible the whole thread is, the better for #2. Also, I prefer to spend my energy on threads that satisfy both #1 and #2.
Ok I’m trying to use the million tile engine but getting errors. So need help on using it with detail.
Hopefully there are some folks using MTE.
That said, you have the source code so you can add debug code to it as needed to backtrack the error to its source.
Saifuls,
If you change over to the tiled engine and are trying to use ponywolf’s “ponytiled.lua” to translate the files you need to know this…
Currently the file posted on github works fine if you save the map data as a json. However, if you export it as a lua file (like the github explains) you will need to make 1 adjustment to the file.
***NOTE - This change only works for lua files it will mess up the json files if you try to use them with this code.
I reviewed the code and found that if you change the following code in ponytiled.lua
--Located in the function gidLookup() in the ponytiled.lua (line 150 ) for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 0 ) then return v.image, flip -- may need updating with documents directory end end
to
--Simply change the 0 to a 1 (line 150). I expect this to be because lua tables start at 1 not 0. for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 1 ) then return v.image, flip -- may need updating with documents directory end end
This should make it so that the ponytiled.lua file correctly translates and displays lua files exported from tiled.
***NOTE - This change only works for lua files it will mess up the json files if you try to use them with this code.
I reviewed the code and found that if you change the following code in ponytiled.lua
--Located in the function gidLookup() in the ponytiled.lua (line 150 ) for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 0 ) then return v.image, flip -- may need updating with documents directory end end
to
--Simply change the 0 to a 1 (line 150). I expect this to be because lua tables start at 1 not 0. for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 1 ) then return v.image, flip -- may need updating with documents directory end end
This should make it so that the ponytiled.lua file correctly translates and displays lua files exported from tiled.
If you go for Dusk, make sure you export in lua files and always set your image path correctly on the exported map. I had issues when trying json files but maybe you can:
There is no single be-all end-all module/solution for this. There are many, each with their own benefits and draw backs, so we don’t know if you’re referring to specific solution here or asking a general question.
That said, what has your research turned up so far?
Please share links to resources you’ve found and tried and we’ll give you feedback and help deciding which will work best for you.
Google searches that will help:
PS - While Tiled does produce a Lua table in a file, it isn’t really a module (has no functions). You consume this with one of the many solutions out there to do the actual work of creating a level. Thus, my suggestion that you tell us what you have tried.
To prove I’m not too mean a guy, let me get you started on possible solutions:
- https://github.com/ponywolf/ponytiled
- https://github.com/GymbylCoding/Dusk-Engine
- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/tiled/ ( SSK2)
- …
Some great reading and videos if you go with Ponywolf solution:
Getting into it.
You don’t need to quote, you can just respond. Quoting every prior response makes threads hard to read. Please remember. Threads have two purposes:
- A place for you to get help.
- A place for others to go later and read what you asked and what the answers were.
The more legible the whole thread is, the better for #2. Also, I prefer to spend my energy on threads that satisfy both #1 and #2.
Ok I’m trying to use the million tile engine but getting errors. So need help on using it with detail.
Hopefully there are some folks using MTE.
That said, you have the source code so you can add debug code to it as needed to backtrack the error to its source.
Saifuls,
If you change over to the tiled engine and are trying to use ponywolf’s “ponytiled.lua” to translate the files you need to know this…
Currently the file posted on github works fine if you save the map data as a json. However, if you export it as a lua file (like the github explains) you will need to make 1 adjustment to the file.
***NOTE - This change only works for lua files it will mess up the json files if you try to use them with this code.
I reviewed the code and found that if you change the following code in ponytiled.lua
--Located in the function gidLookup() in the ponytiled.lua (line 150 ) for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 0 ) then return v.image, flip -- may need updating with documents directory end end
to
--Simply change the 0 to a 1 (line 150). I expect this to be because lua tables start at 1 not 0. for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 1 ) then return v.image, flip -- may need updating with documents directory end end
This should make it so that the ponytiled.lua file correctly translates and displays lua files exported from tiled.
***NOTE - This change only works for lua files it will mess up the json files if you try to use them with this code.
I reviewed the code and found that if you change the following code in ponytiled.lua
--Located in the function gidLookup() in the ponytiled.lua (line 150 ) for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 0 ) then return v.image, flip -- may need updating with documents directory end end
to
--Simply change the 0 to a 1 (line 150). I expect this to be because lua tables start at 1 not 0. for k,v in pairs(tileset.tiles) do if tonumber(k) == (gid - firstgid + 1 ) then return v.image, flip -- may need updating with documents directory end end
This should make it so that the ponytiled.lua file correctly translates and displays lua files exported from tiled.
If you go for Dusk, make sure you export in lua files and always set your image path correctly on the exported map. I had issues when trying json files but maybe you can: