non-Programmer's common problem

Discussion and feedback on Construct 2

Post » Thu Sep 24, 2015 4:59 am

what is the difference between
**save & load** action and **local storage & WebStorage**
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Thu Sep 24, 2015 5:52 am

I am a non-programmer
I don't know anything about programs
but now with the help of construct 2 now i can make games myself. It feels like awesome
but most of things are there that we non-programmers can not understand, may be its only me
.
.
expression are very hard to understand
there are a lot of expressions I don't know what they are, and what they can do
.
may be expression are easy understandable for a programmers
.
.
I am from India and my English is not so good may be that is the reason
.
i have seen too many tutorials their are lots word words that I can't understand
.
for example
.
what is Json
what is string
math expressions are totally out of my mind
in math expression their is 'abs' expression what says calculate absolute (positive) value of a number
what is absolute value or positive value, and how can i use it, I don't know
.
.
i have take about 1 month to understand that what are the variables and what they can do
.
when i was new in construct 2 variables makes me upset because i was not understanding
when i got a little about variables then i saw instance variable
i was going to give it up
but i decided to read tutorials over tutorials
i have read lots of tutorials related to variables
thank GOD
now i got what they are
.
but still there are a lot of things that i have still did't get
.
now i in saving game progress
no tutorials is helping me to understand it
.
there is save & load, local storage, web storage
but i am not getting it
.
i don't know how much time it will take
.
.
Thanks to all members who answered my questions
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Thu Sep 24, 2015 6:57 am

luckyrawatlucky wrote:but still there are a lot of things that i have still did't get
.
now i in saving game progress
no tutorials is helping me to understand it
.
there is save & load, local storage, web storage
but i am not getting it
.
i don't know how much time it will take
.
.
Thanks to all members who answered my questions

Language will always be a barrier when learning. :)

Saving stuff in C2 can be a little confusing if you are a non-programmer. Here is a quick explanation of each:

Save & Load - Will save the current state of the game, meaning everything in the game is saved. This is very good if you want to make a normal save/load game functionality in a game. Because you don't have to specify what stuff should be saved or not. Because everything is saved. You can use the "No save" behaviour on individual objects if there is something that you don't want to be saved.

https://www.scirra.com/tutorials/526/how-to-make-savegames Here is a very simple example of how to set up a Save & load functionality.

Local storage - As far as I remember this and the webstorage was the only way to locally save your game, before the Save & load functionality was added. But local storage can be useful if you just want to store a few pieces of data locally on your computer, such as a high score etc. So you save a part of the game progress. It is not good for making a full save/load functionality, as you would have to save each individually thing in your game. The reason its called local storage is that its stored locally on your computer/phone etc and is not shared between the browsers. Also there is a limit to how much you can store, the manual state that this is at least 50 mb depending on the browser used.

Web storage - This is according to the manual deprecated in favour of the local storage plugin above. So best thing you can do is to ignore this one and just use local storage if you need to save a few number of data. The chances that you really need this is fairly low and will most likely be obvious if you run into a situation where this is the only way to do something. But as again its very unlikely to happen.

This explanation is of course simplified on purpose. But hopefully it gives you an idea when to use one over the other and what you can expect from each of them.

The best thing you can do, is just try to set up something very simple for each of them and see how they works in my opinion.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Thu Sep 24, 2015 7:17 am

thanks @nimos100
i am always a fan of those people who believes in help others
when some good people help me and make my life easy then i become crazy for making him my friend
i really hearty appreciate you because you guys are making us a stepahead
.
dear friend
i have one question now
local storage saves variables in devices or PC
but
Is save & load, save data on devices too??
.
actually i have made a levels game
and now i have no idea how to save
i should just use save & load or should use local variable
if local then how
i have followed some tutorials
in which
first find key
if find then get key
if get key then set key
.
this is i have done but it never saves anything
may i am somewhere wrong
but i don't know where
.
my screenshot of testing save
dropbox.com/s/gkz6kdb06pfm7bn/sample%20copy.jpg?dl=0
.
i have used this tutorials and download capx
scirra.com/tutorials/1461/how-to-use-the-localstorage-plugin
.
i just add score to coins in this file for checking it is working or not
but it is not working
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Thu Sep 24, 2015 1:34 pm

luckyrawatlucky wrote:i have one question now
local storage saves variables in devices or PC
but
Is save & load, save data on devices too??

Yes

luckyrawatlucky wrote:actually i have made a levels game
and now i have no idea how to save
i should just use save & load or should use local variable


You have to decide when its worth saving. You are getting a bit confused about how to use it correctly it seems from your screenshot.

Here is an example of how to set it up, this is what the program looks like:
Image

And this is the code:
Image

The way the program works is that if you click the button "Check if key "Test" exists it will check if a key named "Test" is currently stored in the local storage. This is code (2) in the screenshot.

If a key named "Test" doesn't exists it will create a key called "Test" and set its value to "Test now have a value" also it will write in the list "Key missing", this is code (3) in the example and will look like this:
Image

If you click the button "Check if key "Test" exists" once more. The key now exists, so its no longer missing. So it will now instead use code (4) and write to the list "Key Test exists" and it will now look like this:
Image

Clicking the button "Load content of key "Test"" will get the value from the local storage, which I put to "Test now have a value". This is code (5). When the data have been loaded code (6) will be executed as well. And will look like this:
Image

The reason for code (1) and to clear the storage on start of layout. This is simply for testing purposes as the key "Test" will still be in the storage even if you restart the application. So if you want to keep the value of "Test" in the storage, you have to remove code (1).

Using local storage for saving a few variables or part of you games progress is good. However as I mentioned it not very good if you want to save the complete state of your game. Because you will have to store a lot of variables.

So before you start creating a save/load system you need to decide where it make sense to save and where it doesn't. For instant in your example it seems like you want to save every time the player picks up a coin. But wouldn't it be better to just save between maps and just use the Save/Load function instead?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 15 guests