On average my save files measure from 1kb for your basic freshly made newbie to 25kb for a character with over 200 "objects" in their invent (per slot) each save holds 3 slots (so anywhere from 1kb-70kb++) but now i want to be able to show the player their character inside a grid above the load button so they can see it rather then having popups with generic text.
So anyways
Question 1: Are their more ways to save that could reduce the save file size even further? im trying to get the lowest possible save file sizes while having a large amount of "objects" in the user (using .move etc) (These range from verbs, skills and actual items). i also have a skills "list" that holds all the skills the player has learned as opposed to storing them "inside" the mobs "contents". -if you want to view the way im currently saving just scroll down past next question to the code snip.-
Question 2: The next question is how would i go about reading a savefile "slot" specific to each players slot without -actually- loading the player. all my current attempts have left me with a loaded mob and rendering all my client verbs that change the screen useless cause of the mob being changed. I need to be able to load several vars from the file and then run them through the "Builder" proc i use to recreate images from those vars. so i can then display it. (Ive seen people just save a copy of the players icon to the savefile. but that bloats the files and would conflict with Q1)
--Codes
mob/var
colour_hair = "#000000"
colour_eye = "#000000"
type_hair = "bald"
type_base = "pale"
var/list/types_hair = list("bald" = 'Icons/blank.dmi',"test1" = 'Icons/NOICON.dmi')
var/list/types_base = list("pale" = 'Icons/Base_Tan.dmi',"tan" = 'Icons/NOICON.dmi',"medium" = 'Icons/NOICON.dmi',"pallid" = 'Icons/NOICON.dmi')
mob/proc/Builder_Player()
src.icon = types_base[type_base || "pale"]
var/olays[0]
var/hair = types_hair[type_hair || "bald"] + colour_hair; olays += hair
// var/eye = 'Icons/NOICON.dmi' + colour_eye; olays += eye
for(var/A in equipment)
var/cr1
var/obj/cr2
var/icon/cr3
var/items/Equipment/B = equipment[A]
cr1 = B.reference
cr2 = new cr1()
cr3 = cr2.icon + B.colour
cr2.icon = cr3
olays += cr2
src.overlays = olays
/*End--
Char Builder proc */
client/proc/Load(playerslot)
var/savefile/F = new(savedir)
F["/Slot[playerslot]"] >> src.mob
client/proc/Saver()
spawn() mob.Save()
mob
Write(var/savefile/F) //writes the file pretty straight forward
F["savefile_version"] << SVER
..()
F.dir.Remove("icon","overlays","underlays")
F["SavedX"] << x
F["SavedY"] << y
F["SavedZ"] << z
Read(var/savefile/F)
loc = locate(F["SavedX"],F["SavedY"],F["SavedZ"])
var/version
F["savefile_version"] >> version
if(isnull(version)) version = 0
..()
if(src.trading | src.shopping)
for(var/items/o in objholder1)
objholder1 -= o
contents += o
src.trading = 0
src.shopping = 0
mob/proc/Save()
if(!src.cur_created)
return
if(!istype(src,/mob/human/player))
return
var/txtfile = file(savedirtxt)
var/savefile/F = new(savedir)
src.icon = null
src.overlays = null
F["Slot[src.cur_slot]"] << src
fdel(txtfile)
F.ExportText("/",txtfile)
src.Builder_Player()
Save individual variables, not whole mob (Health, Mana, etc).
On top of that, you could save names of objects, either their paths, instead of whole object (I'm talking about objects in src.contents), it might save icon of it, or some other information.
Question 2:
If you'll save only individual variables, you could easily read what icon player should have, what he is wearing, etc. then build virtual character and show it.
Other way is to set client to null before saving (if I remember correctly), this way when you load it won't automatically assign mob to player.