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

Get help using Construct 2

Post » Sun Dec 13, 2015 10:54 am

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
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Sun Dec 13, 2015 3:03 pm

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: level-editor-template-templates_t147776
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Sun Dec 13, 2015 4:07 pm

Thanks @Zebbi.

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.
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Mon Dec 14, 2015 8:48 am

Some help?
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Mon Dec 14, 2015 8:54 am

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

PS: please use local storage, not webstorage..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 14, 2015 9:56 am

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
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Mon Dec 14, 2015 10:17 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 14, 2015 10:58 am

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?
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Mon Dec 14, 2015 11:17 am

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 14, 2015 11:35 am

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.
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests