About Online and Offline

Get help using Construct 2

Post » Fri Jan 31, 2014 9:06 pm

Hello,

I try construct 2 from nearly 2 weeks and i'm asking a question that i haven't find any answer in google and in FAQ.
I know that we can ask to a remote server via Ajax to get datas (like XML and i think JSON). I know that we can "translate" the game for a lot a platform like html5, ios, android, ...
I would like to keep in local information about levels to let's players play even if there's offline.


I found about Webstorage and it's about keeping information in local or in session.
For volume reasons i think i would like to keep few levels.
When playing offline on android device (for example), online does not updte until :
-synchronization of offline device connect to online
-online computer is used to play online

Can i use Webstorage for this kind of use? or what should i use?
If i choose local storage (seems to be better for the behaviour i want) when occurs the cache clearing? can i force the cache clearing?

I got information in the manual https://www.scirra.com/manual/120/webstorage
B
8
S
2
Posts: 35
Reputation: 838

Post » Sun Feb 02, 2014 5:30 pm

Finally i reach this article... I do not try for now but it should help me.

https://www.scirra.com/tutorials/526/how-to-make-savegames
B
8
S
2
Posts: 35
Reputation: 838

Post » Sun Feb 02, 2014 10:40 pm

[QUOTE=Teclis01]I would like to keep in local information about levels to let's players play even if there's offline.

Can i use Webstorage for this kind of use? or what should i use?
If i choose local storage (seems to be better for the behaviour i want) when occurs the cache clearing? can i force the cache clearing?[/QUOTE]

Yes, you can use Webstorage offline, it does not require an Internet connection.

I'm not sure about how to force the cache to clear using C2. Though, what is your ultimate goal and reasoning for clearing the cache? Just in case you have newer data online?

When you create/publish new updates, then you should be incrementing your C2 version number (found in project properties). I believe browsers use this information in the offline.appcache file to determine whether or not it should try to download new assets. It's been awhile since I've last used it, so I forget the exact details.danialgoodwin2014-02-02 22:41:24
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Sun Feb 02, 2014 11:03 pm

Yes, exactly.
People could play online and offline. Each x levels it will be mandatory to connect (cause i don t want user's download all levels in one time)
When they up x levels they will download the x next level. To be able to play offline and update online when they finish thoses levels
B
8
S
2
Posts: 35
Reputation: 838


Return to How do I....?

Who is online

Users browsing this forum: Magistross, tarek2 and 2 guests