So I am making a Mario maker game I am doing some basic power ups and basic enemys for the first edition but later on I will add more things but for now I need help with a level maker/sharer
Please help with a Mario maker like level sharer
You’ll need to explain what you need help with if you want any response. Make them specific, not a vague generalised request.
So I know how to make the level maker but the problem is I have no idea how to make a way that when you make the level you can then share it but be fore you share it you have beat the level
Gotcha, so you want to make a map editor, run through a level you’ve created and have to complete it before you can share it with others? There’s a bit of work involved with that, but it is achievable.
The easiest way to share information over different devices is via an online database. GDevelop has built in functions that work with Firebase, and you can ask questions here in the forum (or on the Discord channel) if you need help.
To store the information, jsonify the level and store that along with the author, date created, a boolean that it has been completed/beaten by the author and a boolean to whether it’s shared.
In the map editor you could have 2 sections; one for the player’s levels, and another listing all the levels shared by others.
I’m sorry I don’t really understand what you are saying but is there a way you can show me the code to do all of that
Maybe someone else can, I haven’t had the need to use Firebase before, and it’ll take too much time to investigate and work out how to do it. Databases are pretty standard in what they do, so understand one and you’ll get the gist of any database.
Essentially you want to do the following to save a level:
- create a firebase database
- in your editor for the level created, store each object’s name and position into an array or structure variable. If rotation or scaling is possible in the editor, then you’ll need to add that information too.
- JSONify the structure or array variable into a string variable.
- write the value of that string value to the firebase database.
To load a level, it’s almost those steps in reverse:
- read a string from the database
- convert it from json into a structure or array variable
- iterate over that structure or array variable extracting the object name, position and any transformations
- create the object at the position and apply the transformations.
And that will just let you save and load levels. You then need to build in some “security” into it so you cannot load someone else’s incomplete levels or overwrite someone else’s work.
As a starter for you, here are some topics you’ll need to understand to achieve your goal. Look them up or ask the forum on how to do it:
- creating a database
- writing or string data/variables values into the database
- reading data from the database
- updating existing data in the database
- storing object names and screen positions into a structure or array.
- transforming the structure or array variable to JSON format
- transforming a JSON format into a structure or array variable
- iterating over a structure or array and reading object names and positions
- creating objects at those positions in your editor
On thanks will try it when I get the chance
Would it work if j have it generate a random number and then loads that number it sounds like it would work for loading the levels but the problem is I have no idea how I could do that
Sure, if loading a random level is what you’re after. I’d suggest you get the editor level save and load working first. Once you do that, you’ll understand how it works and loading a random level after that will just be a small addition.
Not loading an extra level it was thinking when you save the level it generates a random number so that when you load the level to edit it it will generate the level was saved under that numbet
The problem with that is the same random number could be generated for 2 different levels. What you should do is either store the latest level number in the online database and update that when a new level is saved, or use a hashing algorithm to generate a number that’s based on all the objects in the scene (my preference would be the latter).
Oh I did not think of that is there a different way I can have the levels more secure so that you don’t find someone else’s level