I am programing a game and want to save a couple of variables that are bool type. All of the values are stored In class named "Variables". can it be done without using external files if possible?
Asked
Active
Viewed 2,465 times
0
-
1Need more info. Are you trying to save these values across gaming sessions? Are you working inside of a game engine such as Unity? – Dave Jellison Apr 24 '16 at 11:06
-
It is a Windows form app. This variables show if a level is completed or not. And are stored as "public static bool name;" into a class called Variables so they can be used in all forms. – Venelin Minchev Apr 24 '16 at 11:09
-
7May be it is too early to program a game? – Giorgi Nakeuri Apr 24 '16 at 11:09
-
What do you mean by too early? – Venelin Minchev Apr 24 '16 at 11:10
-
4Nothing personal, but when you are asking for how to store variables it is not time to program a game. It is time to learn basics for now? – Giorgi Nakeuri Apr 24 '16 at 11:12
-
It is how to save them. – Venelin Minchev Apr 24 '16 at 11:13
-
Well, there are many ways: external files, databases, registry... – Giorgi Nakeuri Apr 24 '16 at 11:16
-
2Are you asking about how to set a variable, or how to persist data externally? They are two very different questions. – yaakov Apr 24 '16 at 11:18
-
1How to persist data. I just wrote the title wrong. – Venelin Minchev Apr 24 '16 at 11:20
1 Answers
1
If you're programming against the Windows Forms model you can look into saving such simple data in the Application settings. This will alleviate some learning curve on serialization.
Take a look here for some insight: Best practice to save application settings in a Windows Forms Application
If the save game data is going to get more complex you'll probably want to start searching for info on XmlSerializer, JSON serialization, or if you need your data concealed from prying eyes: BinarySerializer

Community
- 1
- 1

Dave Jellison
- 924
- 13
- 22