Open Gammer0909 opened 8 months ago
Hello, Sounds very usefull, how would you impliment this?
@MrScautHD
By Gammer0909
This is a data-holding class that needs:
GameSettings
objectThis will create save files to the directory you specified.
This class sets up your settings for loading your save file.
This needs:
This will extract the data from the save file and return it as a GameSettings
object.
(This may change in the future, but for now, this is how it will work.)
To make an object saveable, you need to add the Saveable
attribute to the class.
This will allow the object to be saved and loaded.
ex:
[Saveable]
public class Person : Entity {
// Things derived from Entity
// ....
public string Name { get; set; }
public int Age { get; set; }
}
To save an object, you need to create a SaveSettings
object, and call the Save()
method.
ex:
SaveSettings settings = new SaveSettings("C:/Users/Me/Documents/MyGame/SaveFiles", new GameSettings(), EncryptionMethod.None, SaveType.YAML);
Person person = new Person("Bob", 20);
settings.Save(person);
I will be using the YamlDotNet
library for the YAML serialization.
(Newtonsoft.Json is already a dependency for the project, so I will be using that for JSON serialization.)
The namespace for the Saving system will be in
Sparkle.csharp.saving
and the load system will be in
Sparkle.csharp.loading
and the attributes will be in
Sparkle.csharp.attributes
I will be using the C#
code style, and I will be using the C#
naming conventions.
However, I do some things differently:
// I always use `var` for objects, not new()
var person = new Person("Bob", 20);
// For braces, I use the `K&R` style
// Ex
void Method() {
if (true) {
// Do something
} else {
// Do something else
}
if (false)
Statement();
}
If you request that I change this style for my PR, I will.
Thanks, Gammer0909
(Sorry for taking a long time to respond, I had some things to do and I had to design the API.)
looks very cool!
(Sorry for taking a long time to respond)
Am I clear to start?
Yep!
I propose a Saving System, to abstract save files to make a save game implementation easier.
Do I have to propose how I would have this implemented? If so I will, upon request.
I will start as soon as I'm cleared to start.
Thanks, Gammer0909