How do I do to include custom maps built by users?

0 favourites
  • 15 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hi guys

    I've a map that I use as background. The map is all divided into squares and I put items over the squares, like fuel, money, health, life, etc. for the player collect them. Just it.

    I intend to create a map editor and I don't know how to do to save the custom map created by user and how to provide it to another players. Maybe I'll need to use a text file with the variables values for each item to store its position and a boolean to check if the player put the item or not and load this information from internet? I really don't know how to proceed.

    I want to include an option to the player choose after finish the game if the custom map created by another user is okay or not. If the map receive 3 rejections, it is eliminated from the repository.

    Thanks in advance for any help

  • You might need to build a level editor that can load and save maps, then you could just load the maps according to how your editor arranges them. There's a few ways of making a level editor, usually by storing strings in external files, you could have a look at this maybe for ideas:

  • Thanks

    I think that I need to use web storage and Json. I've some doubts about Json: can C2 write son files? If not, how can I do this?

    I'll wait some suggestions or maybe simple examples of how to do this.

  • Some help?

  • Save AsJson is an action for practically every object in Construct2..

    PS: please use local storage, not webstorage..

  • Thanks LittleStain

    I really need to understand the whole process. If it's not too much trouble, could you give me more details?

    The user accesses the map editor that contains draggable objects (items) and before positioning the items over the the map he needs to save it, right? How could the program save this informations? (each time that user drop an item I have to save this location on the local storage? and after that the program will save local storage informations in Json file? How (procedures, format, etc)? I'll need to use Ajax for save Json, right? I'll need to store each map in a different json file?)

    Thanks in advance

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You don't need Ajax, you can use it if you want, but you don't need it..

    I can't give you details on how it would work in your project, because I don't know about your project..

    If the player can only place objects in a grid, you could either use an array or the tilemap-object to store the position and save that as json..

    If the player can position anywhere, you might be better of saving each object as json..

    If there are other limitations, you might be able to use those in the saving progress

    I wouldn't save all the time, only when the player is ready and have the player enter a name for his map..

    You could save the asjson to a localstorage item and have a dictionary object with the saved names..

  • The player needs to put the item over a square with sprite on there. When the player save the map, I'll need to destroy these squares that overlapping by items. In this case what's better: a tilemap-object or an array?

    If I save the custom maps using local storage, the others players cannot access these maps, right?

  • What are you using in the game itself right now?

    Seems like it is perfect for tilemap, but if you are using a different method for the map right now, using that method would probably be easier to implement when loaded..

    local storage is local, so it's on the device it's played on..

    If you want others to be able to use the custom map, putting it on the internet should work..

    For that you'd probaly want to use Ajax, php and a database..

    I don't know anything about how to do that, because I never needed it, but there are some tutorials about it.

  • I filled the map with squares (60 x 60) and the items are different animations of theses sprites (squares). But for the editor I intend to create draggable items.

    The process seems to be very complicated. I'll try to find theses tutorials that you mentioned.

  • Wouldn't using the tilemap object be much easier/better than filling the map with squares?

    Just set the tiles of the tilemap to 60x60..

    You could have the sprites to drag and on drag and drop release check the tile which they are overlapping and set the tile to the one that looks like the sprite, etcetera..

  • I never used tilemap object, so I don't know how to do this kind of game with it. I intend to use tilemap objects to create the custom maps editor because it's another game option/mode and it doesn't interfere in the standard game. If have some time, could we build a custom maps editor together ? I'll create the file and we talk about it and after it was finished I commit to create a tutorial. What do you think?

  • I'm very busy, but if you do the majority of the work, I'll probably be able to adapt it..

    Just send me PM..

  • Great. No problem, I do it. I'll prepare the file and sent you the link by PM. Thanks.

  • LittleStain

    Did you received my PM yesterday?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)