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

Get help using Construct 2

Post » Sat Nov 07, 2015 4:07 pm

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!
B
5
S
1
Posts: 68
Reputation: 515

Post » Sat Nov 07, 2015 6:53 pm

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.
Code: Select all
global text appPath="C:\tmp\"

Start of layout
system: [inverted] is in preview
> set appPath to NWjs.AppFolder

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.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Sun Nov 08, 2015 1:44 pm

Oh cool I'll give it a whirl and test it.
B
5
S
1
Posts: 68
Reputation: 515

Post » Sat Nov 14, 2015 7:35 pm

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?
B
5
S
1
Posts: 68
Reputation: 515


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests