Question regarding Localstorage/Webstorage/Dictionary

Discussion and feedback on Construct 2

Post » Fri Nov 04, 2016 1:58 pm

Hello everyone, I'm working on a quiz game, you can check out some of my tweets regarding it (twitter.com/donrifgames). It will have at least 900 questions (I handle questions by XML, but I have to duplicate the same layout 900 times!....maybe i'm doing it wrong, can I keep one layout and change informations on it everytime?)

So that causes some slowness, I have found some framerate issues on iOS: the localstorage is too slow, the app works fine but it takes time to retrieve saved data. On Android, the asynchronous problem seems to work better than on iOS, though i have not fully tested it on Android.

I have seen a post by @sqiddster where he suggests to save variables/arrays in a dictionary and load the dictionary on startup with the localstorage plugin. I didn't seem to understand how exactly.

Your help will be much appreciated!
B
24
S
6
Posts: 64
Reputation: 1,436

Post » Fri Nov 04, 2016 2:43 pm

If you are creating 900 layouts for 900 questions you are definitely doing something wrong. You should work on the 1 layout solution.

Storing 900 values in localstorage shouldn't run out of the space limit.
B
138
S
33
G
17
Posts: 1,560
Reputation: 20,832

Post » Fri Nov 04, 2016 3:45 pm

glerikud wrote:If you are creating 900 layouts for 900 questions you are definitely doing something wrong. You should work on the 1 layout solution.

Storing 900 values in localstorage shouldn't run out of the space limit.

That's exactly why I thought, but I want to move between questions and it doesn't seem to work when I make "Restart layout" and I change values according to the XML. Any tips?
B
24
S
6
Posts: 64
Reputation: 1,436

Post » Sat Nov 05, 2016 2:13 pm

Well not much anyone can do without a glimpse of your code. You should provide a .capx file. I'm not saying that I'll definitely have time to look into it, but you increase the chance of getting help by providing a code example with the problem.
B
138
S
33
G
17
Posts: 1,560
Reputation: 20,832

Post » Sat Nov 05, 2016 11:48 pm

glerikud wrote:Well not much anyone can do without a glimpse of your code. You should provide a .capx file. I'm not saying that I'll definitely have time to look into it, but you increase the chance of getting help by providing a code example with the problem.

Alright, thanks, my code is a bit too long and complicated, i'll try to do a simplified capx for the example.
B
24
S
6
Posts: 64
Reputation: 1,436

Post » Sun Nov 06, 2016 2:44 am

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Nov 08, 2016 1:33 am

korbaach wrote:simple example:

sample_questions.xml

QuizXML.capx



Image

Thanks very much korbaach, I managed to do it simply by changing a variable according to the XML.

Image

The red underlined variable is the key: I created a layout named "1" and I add 1 to the variable level_number to pass to the next question.

The "q" node in the XML is what controls which question you are in.
B
24
S
6
Posts: 64
Reputation: 1,436

Post » Wed Nov 09, 2016 11:55 pm

Concerning the WkWebview, I can't load images from XML using "Load image from URL" on iOS, i read this post by Ashley (https://www.scirra.com/blog/ashley/25/h ... -wkwebview) but I can't quite understand if there's a solution to it or not. Anyone can help me ?

Edit: nevermind amigos, i found the solution: loading-files-not-working-with-wkwebview_p1072160?

I had the 233 C2 version too, it was corrected since then! :)
B
24
S
6
Posts: 64
Reputation: 1,436


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests