ZeldaMaker dev help

Hey all,
I could use some help with a stuck point if anyone out there is listening.

I’ve been playing around with the idea of creating an rpg map maker tool in the style of the original Zelda. My kids liked MarioMaker and I thought it would be cool to try and do the same for Zelda.

The concept is to create different “rooms” with a grid of images that can be customized, and they all connect to form an overworld map. I’m stuck on how to get each room to save for the user. How would you approach this? Right now I have the Save button displaying JSON data, but not sure the best way to store it. Cookies? Write to a server side MySQL database, etc?

http://tufaccia.us/yrf-rpg/maptool.html

2 Likes

Save it in the browser to localStorage or mayyybe IndexedDB, probably fully automated, perhaps with a manual Save button as well for peace of mind. That’s conceptually similar to cookies but a better fit for this kind of purpose.

Change the save button to an import/export button that offers the JSON up for download (with new Blob() or something) so you can back it up and transport it.

You’ll also need JSON.stringify/destringify for the localStorage and Blob.

Alternatively or additionally you can also encode all the JSON data in the URL as an export method. Then you simply save the URL to save it. This should work as long as your JSON is no more than some 64k characters.

// NB This might accidentally work but it's intended as pseudocode.
const encodedJson = encodeURIComponent(JSON.stringify(jsonObject));
const url = `http://tufaccia.us/yrf-rpg/maptool.html/?data=${encodedJson}`;
window.history.pushState({}, '', url);
2 Likes

@Frenzie Thanks, bro! I’m glad you’re still checking the forum after all these years. I’m going to try your suggestions this weekend.

2 Likes