Tiled

This topic contains 18 replies, has 5 voices, and was last updated by  juliocmfj 2 weeks, 2 days ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #9996

    juliocmfj
    Participant

    Is there any module to load maps made using the Tiled editor?

    If not, I will start developing a module for this purpose using Json to read the data.

    #9997

    Mark Sibly
    Keymaster

    That would be great!

    #9998

    juliocmfj
    Participant

    Hey, Mark! I had made a class that did this in BlitzMax, except that the reading was done .csv exported by Tiled.

    Today Tiled has greatly changed the way information is stored. The tiles information is separated from the main map. I am not Json’s master, but I will learn to develop this class that I believe will greatly help everyone.

    Start tomorrow and God willing I will get something functional soon and post here in the forum.

    #10000

    therevills
    Participant

    Not sure if its any Help, but Samah did create a Tiled Reader for MonkeyX1 for Diddy:

    https://github.com/swoolcock/diddy/blob/develop/src/diddy/tile/diddyreader.monkey

    BTW Playniax has created a Pyro 2 Tiled converter:

    Playniax news

    https://playniax.itch.io/pyro-2-tiled-converter

    #10001

    juliocmfj
    Participant

    Therevills, I really liked the Playniax version, which is paid and I do not have an internacional credit card.

    And about the Diddy version, it’s 2015, Tiled has changed a lot from that period to today…

    But I will give a study and see a way to develop this module based on the current version of Tiled.

    If you have more suggestions, send it helps a lot.

    #10005

    juliocmfj
    Participant

    I was able to read and interpret pratically all information from the main file that Tiled generates in *.json. However, I’m having trouble reading and manipulating JsonArray.

    Any simple example?

    #10006

    Mark Sibly
    Keymaster

    Both JsonObject and JsonArray have GetString,GetNumber,GetObject and GetArray methods, JsonObject.GetBlah() is ‘keyed’ by string, JsonArray.GetBlah() is keyed by int index.

    #10007

    Playniax
    Participant

    Hey guys, after reading this I just decided to make it FREE!

    You can download it for free or name your own price… Thanks.

    https://playniax.itch.io/pyro-2-tiled-converter

    Now there is always room for alternatives so don’t let it stop you from creating your own!

    #10008

    juliocmfj
    Participant

    I understand how it works with a simple array. But when it has:

    “array” : [
    {
    “data” : [0, 1, 2…],
    “data2” : “test”
    }
    ]

    In this case, an array with several different elements and other arrays inside it…

    I can not read this type of array.

    #10010

    juliocmfj
    Participant

    Hey Playniax, only now that I’ve seen your comment.

    Well, great initiative of yours. I do not even know how to thank. I know it takes a lot of work to develop these things, but you can be sure that your attitude will be of great help to those who can not afford it.

    Thank you so much, really!

    #10011

    Mark Sibly
    Keymaster

    There are several ways to do this, but the basic idea is to test the JsonValue type of each element.

    But I would have though the format for a tile map would use ‘known’ keys etc. Otherwise, kind of a PITA.

    #10012

    TomToad
    Participant

    Took a look at a simple json output from Tiled.

    The “layers” array is actually an array of objects. Each object contains info about each map layer. The “data” array within the layer object contains the actual map data.

    I wrote a little sample here that reads the data, stores it in an array, and prints the info. Not complete, but hopefully will help.

    Hmm, When I post the code here, I get a “Forbidden” error. well, you can grab the source here. https://drive.google.com/open?id=0B1zQ5dfVU3jbZGtjZmtCckx3SWM

    #10017

    juliocmfj
    Participant

    The json thing is, I’ve never worked with him. The first time I made the class that handled tile maps made by Tiled, I used the *.csv format and read using String[] and methods like Split(“”) to make inclusion in the arrays…

    Now having to work with json is a whole new thing for me. With Mark’s secons example, I was able to understand the JsonObject question. I just did some tests and I was able to read those data.

    TomToad, I’ll tale a look at your code to learn more about json. Thank you for all your help and thanks again to Playniax for “releasing” the class he developed for the same purpose.

    #10018

    juliocmfj
    Participant
    #10052

    juliocmfj
    Participant

    First test completed successfully!!!!

    I was able to load and display a map with a layer and a tileset associated with it.

    In the image is the print with the map being executed and the main code.

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic.