[Request] Object as JSON string

Discussion and feedback on Construct 2

Post » Tue Nov 12, 2013 3:35 pm

Hello,

Not sure if this feature is already in C2 as I can't find it, but I would think this would be a great feature to be able to instantly export the whole object with its position variables and behaviors etc to JSON string in to an array value for example and to be able to load it with single action Create object from string. What you guys think?

[email protected] Corrected myself. I'm not grasping easily all that programming lingo. megatronx2013-11-12 16:06:13
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Tue Nov 12, 2013 4:24 pm

Hmm, I guess this could be useful - what do you plan to use it for? Generally you should provide as many good use cases as you can for a feature, so we can prioritise it correctly.
Scirra Founder
B
402
S
238
G
89
Posts: 24,628
Reputation: 196,023

Post » Tue Nov 12, 2013 4:47 pm

Hi, sure, atm I would use it for storing those asJson objects into arrays responsible for storing levels ( then exporting those arrays asJson in to external files ). I've got many types of same types of objects there in different sizes with many different variables responsible for different conditions. Now, when I want to load a level with all the data., on creating the objects I have to set all parameters and variables manually one by one using tokenat, and it ends up being a lot of conditions and actions. Also later down the line the number will increese due to more objects and data I will be adding.

I would imagine it would work something like this in my case

- For each Platform(Family): Set Value at X,Y,Z,Platform.asJson

- Ajax; On completed: Array: load from JSON string AJAX.LastData
- For each XYZ element & Current value =/= 0: create object from JSON string Array.CurValue

So that's how I would currently use it, but obviously it could be used with other data storages, or even multiplayer games for setting data to transfer!

Thanks!

[email protected] Don't want to add to much, but it could go even as far as export layout and layer as json.

[email protected] And thinking about it bit more, maybe there should be to types of storing or an option to either store with position on the layout or without it. Just looking at it from different usability angles.megatronx2013-11-12 19:05:08
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Tue Nov 12, 2013 6:57 pm

@Ashley I mentioned this to you briefly when I popped by the offices. For us it would be a great way to save/load particle object states for weather effects.
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,945

Post » Tue Nov 12, 2013 7:09 pm

Totally. I think now that I would use that for storing everything that would have to have different parameters and values on creation.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Fri Nov 15, 2013 2:40 pm

+1 Managing objects in custom level editors is brutal right now. This would significantly lighten the workload.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 15, 2013 2:46 pm

Having a conversion between objects and JSON can be useful when transferring data with WebSocket.
B
21
S
6
G
5
Posts: 51
Reputation: 4,999


Return to Construct 2 General

Who is online

Users browsing this forum: Badmiracle and 6 guests