Solid Saves? [WIP]

:face_with_spiral_eyes: I want your guy’s opinions. I am working on a script that saves game data and creates an actual save file: “gameName.usv” I’m having trouble retrieving the data in an organized matter but I wanna know if you guys are interested. This is to go towards the asset store but I just wanna know if it’d be worth it to you guys. :roll:

You mean save game files thats easier then player prefs? I would be interested.

I’d be interested, too. Sounds like it would make saves a lot easier.

Definently…but, some things to consider!

  1. Won’t work for webplayer. The webplayer security system prevents all file I/O.
  2. Different genres handle saving in different ways. For an RPG, you’d not only want to save a player’s various stats, but you’d also want to save what equipment they have. A FPS might only save the player’s location and relative position in the linear story arc. A RTS would want to save ‘veteran’ units from a previous single-player campaign.

Serializable save to save xml or binary!

Save structs extremely easily, not that hard to make, takes me like 2 minutes for me to make it for my rpg or my fps.

But some people would like this in the asset store!

As ^ said, webplayer issue. youd have to create a custom system that didnt use io to save it.

  1. Never planned it for Web because I didn’t think it would be possible
  2. This is another BIG problem the only solution that comes to mind in a script for every game genre which common save attritubes preset but even then the problem is choosing what data to save.

You could likely use Unity Serializer for this. Infact, I know you can, I’ve made physical save files. It creates a string or byte format, you then create this into a file of your choice. To load, you load the file, extract the text, and load. Not too much work, either!

That’s actually what I plan to do, im trying to make it universal and more user-friendly. The Debugging seems done but I run into ambiguous reference as I am trying to include System Forms such as the Browse Folder Dialog, to allow the player or even programmer to assign the location of the save data.

You could always just do extension methods and have the people set up the structs or classes to how they want.

This shows the extension method, and the class of playersave.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;

namespace TrueDataBase
{
	public static class Saving{
		public static void save(this PlayerSave ps){
				string filename = Path.Combine(Serializable.GetMyDocumentsDir(),"Test.trudb");
        		FileStream stream = File.Open( filename, FileMode.OpenOrCreate );
        		XmlSerializer serializer = new XmlSerializer( typeof( PlayerSave) );
        		serializer.Serialize( stream, ps );
        		stream.Close();	
		}
	}
	
	
	public class PlayerSave{
		public string name;
		public string level;
		public string type;
			
	}
}

Putting these into a monobehavior class allows you to see how it works! :stuck_out_tongue:

using TrueDataBase;




	void Start () {
		TrueDataBase.PlayerSave ps = new TrueDataBase.PlayerSave();
		ps.name = "cool";
		ps.type = "range";
		ps.level = "99999";
		ps.save();
	}

Thats how Easy Save works, they just do abunch of extension methods, and have alot more of the backside stuff to allow php saving and so on.

Edit: NVM they dont use extension methods, they just use the Type as a variable for the input.

Okay I’ll try using xml, I’ve been trying to use Javascript to implement this. It’s setup is like so.

  1. Extension - debug(for testing), .txt, .xml, and .usf (Unity Save File - my custom file extension)
  2. Location - where so the game can save and retrieve game data from in runtime
  3. Save/Load - save and load the data…

I’m probably being stupid but you way seems very effective

That would be very interesting. I’m not too keen on messing with people’s registry (on Windows), which is what the save solutions I’ve found seem to talk about.

Exactly which is why I thought of this, one question though, can Unity support the System.Windows.Forms namespace? Im getting an Ambiguous reference error which prevents me from furthering my progress because I need @MenuItem to test it but it’s also causing a problem.
[EDIT:] Or is there anyway I can create a shortcut key?

Siaqodb is an excellent object database but has a higher price (for indie).

Perhaps a script that turns a normal class into a serializable one or something?

If I ever complete it and after public testing it I’ll price it around $1-$25 based on popularity and response but I’m getting ahead of myself. Again it’s purpose is to provide an alternative, instead of registry written entries to save data, it tries a way to write them to harddrive.

Hmm, if you need help let me know.

and what do you mean by you need a menu item to keep testing?

@MenuItem…” allows me to add my editor script as a menu in Unity3d and that’s how I test it.

Ohhhhhhhh, ya i just do it the harder way.

What harder way, and how?

Manually do it each time.

[UPDATE] I have decided to create them into two scripts. One editor script and the other a static/global script.

  1. The editor for the save/load parameters.
  2. The regular javascript to actually save and load from the parameters in the editor script.