Studio-Lovelies / GG-JointJustice-Unity

It's the repo for the GGJJ Unity version! I'm too dumb to come up with a wittier description.
Mozilla Public License 2.0
7 stars 8 forks source link

Figure out how to preserve evidence from one scene into the next #243

Closed notexplosive closed 2 years ago

notexplosive commented 2 years ago

Description

There are two things I want:

If I'm transitioning from scene_1.ink to scene_2.ink I want the game to remember evidence/court record I obtained from scene1 as I enter scene2. I don't want scene_2 to need to re-add all the things I got in scene_1 (that's a technical debt timebomb).

BUT! at the same time...

If I'm loading a scene_2.ink ad-hoc from the editor I still want it to know what evidence I obtained in scene_1.

Acceptance Criteria

This story will be finished when evidence is preserved from scene to scene without duplicating AND a developer can still load any arbitrary scene and have the correct evidence.

notexplosive commented 2 years ago

Low tech solution: If a script requires you to PRESENT and item, and you don't have it, it gets silently added to evidence at the start of the script (or maybe right when the PRESENT executes)

Say you need to PRESENT the dinos in scene_5, you got the dinos added to the court record in scene_3:

Pros and cons:

ViMaSter commented 2 years ago

From a technical perspective, I see us having to decide on one of these options as a requirement to make this happen, each with its own advantages and disadvantages:

a) For any given script, it's possible to find out the script that ran before

b) Each script is completely unaware of previous scripts, the game clears the court record items between chapters and each script starts by adding all items the player needs at this point

c) The game keeps track of items inside savefiles

Fun fact:
This final approach is both how PyWright (fan-engine in python) and (if this random Phoenix Wright Save File reference is to believed) even the official Ace Attorney Trilogy do it. Beginning to think I'm overlooking a clear advantage of that approach... 🤔


Addressing that list personally, I think I would go for b) for these reasons:

Also, no matter which option we go with, I think having a sanity check as part of the build process would be a wise idea. It can be as simple as (somehow) finding the full list of Ink Stories a player will interact with from start to finish and validating, that at no point the player is asked to PRESENT an item that wasn't ADD_EVIDENCE/ADD_RECORDed beforehand for each script.

PhoebeMitchell commented 2 years ago

I have two ideas and both of them are needlessly complicated :D

  1. Parse the scripts before the game and make each line into its own state object which has all the information it needs to run.
  2. Modify Ink to add in the evidence automatically

As for more realistic ideas I like @notexplosive's idea of checking a script to see if evidence is presented and automatically adding that evidence, and storing the evidence the player has in save data.

Personally I'm happy to stick with the specifying evidence at the start of Ink files but I can see why that would not be preferable.