OLL3

Expansion Required*This article is missing major information related to the game. Please help by expanding its information.*
OLL3 refers to the save game system for OpenLife used by versions 0.1 and higher.. It relies on Python's pickle module. It is the replacement for OLL2, an existing save game system that is rapidly becoming obsolete.

## Mechanic

OLL3 will have an incredibly simple save/load mechanic, since it will only have to deal with a single object; the player class.

Example code [not final]:

```
def save_player(obj, fn):
    # obj refers to the player object, `fn` to the file name
    import pickle
    pickle.dump(obj, fn)
def load_player(fn):
    import pickle
    return pickle.load(fn)
```

### Player object

Starting with Beta 1, there will be a single `player` object that controls every aspect of the game. This one object will store \*everything\* about the game and will be the \*only\* thing stored.

## FAQs

### Q: What happens to my old saves?

Old OLL2 saves may not have a conversion utility built-in at B1's release, but a utility will be added well before 1.0 is released. While we do want backwards compatibility, we do not want to excessively maintain ancient releases for the purpose of allowing those with that version to still play.

In short: At first, you will not be able to play them, but you eventually a conversion utility will be bundled in.

### Q: When Beta 1 is released, how will older releases be maintained?

They will be maintained in an extremely limited way. I doubt that I will be bothered to maintain Alpha releases after Beta releases come along.

### Q: Will I notice a difference between OLL2 and OLL3?

You will find that OLL2 files will not be able to load at first.

## Benefits Over OLL2

* OLL3 requires next to no maintenance once a release is released, and save game conversion may be as simple as a function to add default data [see Issues section]
* OLL3 will be more user-friendly [Any build with OLL3 support will be able to load OLL3 files, regardless of version]
* OLL3 requires a lot less maintenance. OLL2 requires:
	+ Adding hundreds of objects to the end of the save file
	+ Adding those same objects to the SGCU
	+ Testing to make sure that
* The player object will be able to contain other objects such as friends, spouses and vehicles
	+ This makes it super easy

## Drawbacks Over OLL2

* OLL3 may take up more space, since pickle is not very space-efficient
	+ I made a save file in OLL2 and OLL3, and OLL2 took up 1060B while OLL3 took up just 906. Space may not be an issue after all.
* OLL3 may take time to save and load, if a lot of objects need pickling
* OLL3 is less secure than OLL2, which had more rigid control over data types

## Security Issues

Pickle is not secure. Malware could be bundled inside the player object, for instance inside functions inside it. When a function is ran, malware is executed. A simple notice to exercise caution is enough to take away responsibility.

**Note: We do NOT take ANY responsibility for what happens when you play OpenLife, as stated by the MIT license, which does not cover any kind of warranty.**

## Forwards Compatibility

There is a chance for OLL3 saves to work in versions of OpenLife older than the intended version.

## Issues To Conquer

* Pickle can add functions to class objects if they are missing or not the same, but objects themselves are not added
	+ This means that version identification AND save conversion is still necessary
		- The player object will include a game\_version object, which is a list containing the game version
	+ This would be as simple as copy-pasting some stuff and adding code to save\_game(), so this isn't an issue.
* Can pickle load class objects with other class objects inside them?
* Is the pickled data secure enough to prevent editing in notepad or a hex editor?
	+ We do not want to prevent cheating, but we do want barriers in place to prevent it