0 Favourites

How do I Create Map Gen Cells? Like Skyrim/Metroid/Daggerfal

  • I want to create large procedural map zones, that can then be saved to meta data. I had a horrible time trying to figure out the NWjs features especially trying to save text files in my own folder. So I'm thinking writing to and reading JSON might be better? I just want to have zones that get created the more you travel and market on a map their positon (an overworld view in the top left or via another menu screen) to show where you are.

    But I'm starting to see some inherent limitations? Like I'd have to have persistance enabled on everything or store each dynamic objects values for whatever I wanted to say each transition? Can saving be localized? Can I just save a layout and load the layout back with a new entity?

    Anyway I had to ask how you create cells to begin with, seems we cant even write to .ini so thats out of the question, and XML only works locally. Any help would be great!

  • For saving and loading with NWjs I like to setup a variable "appPath" to specify where to load from. If I'm previewing I set it to a fixed location on my computer and if it's an export I set it to the same folder as the exe with nwjs.appfolder.

    global text appPath="C:\tmp\"
    
    Start of layout
    system: [inverted] is in preview
    

    set appPath to NWjs.AppFolder[/code:7sh25o66]

    So after that you can specify your files as appPath&"filename.txt"

    Now you could use xml, ini, json or any other format you can come up with but by far the simplest would be to use C2's save state feature. When you use the save action you can then get SaveStateJSON "on save complete" and either write it to a file or save it to the "local storage" object. Loading in turn can be done with the "load from json" action.

  • Oh cool I'll give it a whirl and test it.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • hMM, My apologies, is it possible for you to show me an example of this? I cant figure out how to make this work and the localStorage tutorials on this subject are confusing. And do you know off hand if we can write to XML, maybe a plugin somewhere?

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