Page 1 of 1

save game editor

Posted: Tue Jan 12, 2021 1:31 am
by snowstormnet
hey all,

First let me say I really like this game, props to Eek for this gem. I started writing a save game editor for House Party. I know there are console cheats and some people have been exchanging save game but I wanted to be able to edit everything using coding, to take care of details and keep consistency. I know there are console cheats to complete quests but it does not take care of details like order of events, getting or giving certain item to certain NPC, etc, and I want be able to create save game when this game will get updated without having to start over. Also I wanted to be able to edit my combat skills and whatnot, and to be able to revert choice without starting over, like an elegant cheater.

Currently I can load the file, edit stuff, put it back together in a valid format, etc. I've wrote it in C#. The parser itself is like 106 lines of code and the remaining 702 lines of code are for the data models. At the moment it's a console application but I plan to write a nice GUI for it. Anyway. Didn't just write this post to brag about it. I guess you, players, would probably appreciate such tool as much as I do and I would appreciate if you could give me examples of things you would like such tool to perform at the glance of pressing a button.

Re: save game editor

Posted: Wed Jan 13, 2021 3:03 pm
by ttant
This answer only reflect my pov and not eek teams one.

In my pov, create a savegame from scratch (for any game) is not a good idea: This requires a huge development effort for almost nothing.
I mean, it's easy to look for a savegame which describes what you want, that create one on your own and don't mess up in the order of stuff to add (from a newbie user pov, this feature might be too complex to be used properly).
Furthermore, it might be had to maintain if game engine doesn't stop to evolve.

For me, your tool may be interesting if I got stuck somewhere (ie I want to beat up Frank but doesn't have all combat skill or not enough stamina), and want to alter some competences without being locked out of achievements.

Still in my pov, a "hack" tool (like some trainer for some games) which lock stamina/health to 100% might be even more interesting for the "beating up frank" task.
This hack tool could also triggers "resetting after orgasm" or "instant cum" (using just one keyboard stroke).

Re: save game editor

Posted: Fri Jan 15, 2021 9:48 am
by RavynousHunter
How'd you figure what the first 26 bytes and the last byte in the save are? I'm guessing a hash, just haven't figured out what variety, yet. The rest is good old JSON, so it shouldn't be too hard to recreate, you'd just need to have some data structures setup properly so they can be converted over with minimal fuss.

Re: save game editor

Posted: Fri Jan 15, 2021 10:46 am
by peter980
Yes, that beginning and end is what interests me too.

What I was able to do, up to this point, it to edit save game directly in Notepad++. But it only worked if I keep exact same file size. So I guess information on file size is one of the things stored in those bytes.

Re: save game editor

Posted: Fri Jan 15, 2021 1:37 pm
by ttant
From what i understand, unity3d is developed using C#. I suppose, the "savegame" is just a binary dump of a Class, using probably a generic binary serializer available in the .net framework.
Recreating such class (or if you're more advanced, decompile then recompile some part of some dll, like Assembly-CSharp.dll in most of unity3d games) may help you.

Re: save game editor

Posted: Sat Jan 16, 2021 3:44 pm
by snowstormnet
RavynousHunter wrote:
Fri Jan 15, 2021 9:48 am
How'd you figure what the first 26 bytes and the last byte in the save are? I'm guessing a hash, just haven't figured out what variety, yet. The rest is good old JSON, so it shouldn't be too hard to recreate, you'd just need to have some data structures setup properly so they can be converted over with minimal fuss.
My current understanding is the save file can be seen as having 3 part;
- the header, which contains the bytes you mention
- the payload, which contain the JSON
- the footer, which contain padding

So far I have been able to cheat the header by adding padding but my understanding is the file length is written in the header itself. A better approach would be to change the header too, I just went for the lazy way for now.

The strategy that worked so far is something like this;
- Parse the original save game, meaning to only retrieve the body part and to create a temporary file that I will refer to as a dump
- Load the json string and read it as a JSON object
- Apply modifications to it
- Pack it back to its original structure and add padding as needed under a new name; I don't want to apply change to the original save file

As for the data structure part, originally I approached this by writing a bunch of models. It was naive on my behalf as it require a lot of writing and it is error prone. At the time I have 2 strategies I'm exploring; to deal with it as a object and instead template my changes and find appropriate keys in the tree or write my own parser to convert json string as object class. For the latter option, there are program that do that already and online services that offer it as well but I would like to write my own and not to rely on online services or third party executable.

As it is now, the naive approach worked but I'm exploring the possibility to use something like Newtonsoft Json JObject and to query the object with linq directly. As a matter of fact, it's working. The main advantage would be that I wouldn't need to worry about maintaining so many models and it would make it possible to quickly adapt for further release.

it also have been challenging on the JSON part itself as there are different character escaping and it's inconsistent meaning sometime a character has a ascii escape sequence and sometime it does not.

Re: save game editor

Posted: Sat Jan 16, 2021 3:50 pm
by snowstormnet
ttant wrote:
Wed Jan 13, 2021 3:03 pm
This answer only reflect my pov and not eek teams one.

In my pov, create a savegame from scratch (for any game) is not a good idea: This requires a huge development effort for almost nothing.
I mean, it's easy to look for a savegame which describes what you want, that create one on your own and don't mess up in the order of stuff to add (from a newbie user pov, this feature might be too complex to be used properly).
Furthermore, it might be had to maintain if game engine doesn't stop to evolve.

For me, your tool may be interesting if I got stuck somewhere (ie I want to beat up Frank but doesn't have all combat skill or not enough stamina), and want to alter some competences without being locked out of achievements.

Still in my pov, a "hack" tool (like some trainer for some games) which lock stamina/health to 100% might be even more interesting for the "beating up frank" task.
This hack tool could also triggers "resetting after orgasm" or "instant cum" (using just one keyboard stroke).
At the moment, I'm unable to create a save file from scratch but if I were to use the same technique I'm exploring now, order of stuff wouldn't be a problem I think. You are correct, the first approach, where I write models is cumbersome and would require a lot of maintenance as update come. Fortunately I explored another strategy that avoid those issues. As of the user experience and how a user would interact with such tool I think it depends how user friendly the user interface would be. As I see it, a good graphic interface require no explanation.

Most trainer I know of rely on editing memory values. My personal opinion is reading memory and how memory behave depend on the game version and if I were to do that, I would need to change the routine as new update come and that would require much more time, but maybe I'm not good enough at this.

Re: save game editor

Posted: Sat Jan 16, 2021 3:52 pm
by snowstormnet
peter980 wrote:
Fri Jan 15, 2021 10:46 am
Yes, that beginning and end is what interests me too.

What I was able to do, up to this point, it to edit save game directly in Notepad++. But it only worked if I keep exact same file size. So I guess information on file size is one of the things stored in those bytes.
That's my current understanding as well. However I have been able to cheat that by adjusting padding at the end of the file. To answer your question more precisely , there is a different header length for auto-save file than from a save file itself. At the time I invested more time on the save file format itself. I wrote some utility to generate report on the bytes information within it. So it boil down to something like this;

(index start at 0, so 0 is like position 1 and so on)
Header start at 0 and end at 35
The padding at the end is byte '11'

The trick is to repeat the that byte value for every char you remove from one of the properties at the end of the file. I know it's dirty but it's working. I'm planning to do it better, using a more appropriate strategy and I understand the implication is limiting the possibilities as well, for now.

Re: save game editor

Posted: Sat Jan 16, 2021 4:02 pm
by snowstormnet
ttant wrote:
Fri Jan 15, 2021 1:37 pm
From what i understand, unity3d is developed using C#. I suppose, the "savegame" is just a binary dump of a Class, using probably a generic binary serializer available in the .net framework.
Recreating such class (or if you're more advanced, decompile then recompile some part of some dll, like Assembly-CSharp.dll in most of unity3d games) may help you.
Thanks for your input. From a challenge perspective I rather not decompile anything, and also because it's a bit too invasive in my opinion and also because it would be against Unity terms of services. I know editing save file may be in a Gray zone but I plan to release this tool publicly and if I were to use such methods I would jeopardize the project public availability because it would be a very good reason for a take-down.

For what it worth I asked Eek privately to get their approval meaning they don't disagree but will not vouch it neither. I have a lot of respect for the devs and the least thing I would want is to go against their will or what they want.

Re: save game editor

Posted: Sun Jan 17, 2021 6:44 pm
by RavynousHunter
snowstormnet wrote:
Sat Jan 16, 2021 4:02 pm
From a challenge perspective I rather not decompile anything, and also because it's a bit too invasive in my opinion and also because it would be against Unity terms of services.
I've already tried via ILSpy; not for the purposes of recompiling or copying anything, just to explore because I like poking around software from time to time. Alas, it seems as though they're either properly compiled (that is, not into CIL bytecode, but proper binary) or compiled into something ILSpy doesn't see as a managed assembly. Unless there's a specific tool floating around for decompiling Unity assemblies, specifically, then reverse engineering the save structure from the binaries is gonna require a whole lot more work.