Forum rules - please read before posting.

SaveSystem changes and versions going forward

edited May 2018 in Engine development
I've been looking at the AC SaveSystem and ID generation. And from what I understand is that if I load scenes additively or have some gameobjects disabled on scene start, there is a real risk that ConstantID's will duplicate. Have you considered perhaps replacing getting constant id from instanceID to System.Guid? (Apologies if this has already been implemented, I'm using a bit older version of AC). Also I'd love a new version of AC that completely trashes super legacy stuff for the sake of usability. (thing I talked about above, Non-unity UI, ActionList and Cinematic classes being the same thing, etc.). Is there perhaps something similar in the works? Asking because our project might still have to update to a newer AC at least one more time. And changing the ID generation by myself would edit A LOT of AC scripts, since Guid is a string and not an int.

Comments

  • edited May 2018
    Having the same ID used in multiple scenes is actually something that the user can benefit from - see this tutorial.

    When loading save games, AC does do a "scene check" when searching for a component with a given ID - which should prevent issues in the (otherwise extremely rare) event that two IDs are the same.

    I accept that there are benefits to a string/Guid-based approach to ID values, but the real issue is in ensuring existing projects wouldn't break if such a change was made.  It's a critical aspect of all AC projects, and isn't something that should be tampered with lightly.  I'd think it more preferable to have a debug script that can search all scenes for matching IDs.

    For the same reason, I am particularly careful when trashing legacy code.  Phasing out the various non-Unity 2D modes has been the major one in recent updates, but the ways in which people use AC are often suprising, and removing code that seems unnecessary will inevitably cause major issues for someone.

    There's also been past cases where removing certain scripts from the package has - due to the way Unity imports packages and keeps tracks of assets - caused other unwanted problems for people.

    I'll accept that ActionList/Cutscene (was that what you meant by Cinematic?) are essentially the same, but there is certainly a case for Adventure Creator-based Menus.  They're better for rapid-prototyping, and easier to get up and running with for those new to AC and Unity.
  • Yes, that's probably the hardest part about cutting down the extremely legacy stuff and making a version that is not compatible with older projects. You'd have to provide support for both versions (new features only for the newer version would make sense, but bug fixing would involve both versions). Anyway, I figured out a way of how to get unique stuff, without breaking previous instance ID's. And it'll have little modifications of original AC, so I have no problem with writing it myself. The idea in general is to have an asset that saves the last given instance ID, and each time it gives one out, it increments a little. So I need only to rewrite GetInstanceID method. To avoid the ID's that were issued previously, I can simply have a list of the previous id's and when the incrementing cursor gets an ID that was used in legacy system, it just moves up once more. The limitation of this, is that it doesn't track deleted objects, so during the lifetime of project development, it can break after two million id's are issued (4 million if we include negative numbers). A reasonable limitation for my project, don't know if it's a reasonable limitation in general. Another option is to have all the ID's issued stored and add/remove them in a sorted list. That would make the limitation of 2 million ID's in the entire project, which I believe is way more than enough for any project. But the downside then would probably be the time it takes to issue those ID's. Unity might even lag every time you'd add a constant ID script. Sadly the chance of instanceID being the same is not super low, so I have to implement one of these approaches.

    As for why I use additive scene load, is because I need a quite complex group of objects (think an entire room or a close-up puzzle loaded when the player has a certain item, regardless of which scene the player is in the actual gameplay. So to store a huge group of visuals, actions and similar in one place I need a scene. Since storing this in a prefab and making all actions into actionlist assets that reference things in that prefab is too unwieldy. But hey, what can you do, different projects have different use cases and you can't cover them all.

  • I just found that constantID has a check of: "if (gameObject.activeInHierarchy)", if that check fails, no id assignation actions are taken. Is there a reasoning behind this check? Any potential pitfalls if I remove it?

  • It should be fine to remove.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.