Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial savegame back to work #661

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

StraToN
Copy link
Collaborator

@StraToN StraToN commented Dec 27, 2022

Fixes issue godot-escoria/escoria-issues#217
Fixes issue godot-escoria/escoria-issues#209

edit:

@StraToN StraToN force-pushed the issue-217-savegames-new branch 2 times, most recently from 0857842 to 87a08e5 Compare December 28, 2022 17:51
@balloonpopper
Copy link
Collaborator

Generally the saved games worked. Here's the issues I found.

  • Started room 5. Picked up all objects. Combined pen and paper (so now I have no pen and paper, I now have a filled form instead). Saved.
    I then quit escoria (we really need a way to start a new game without having to quit entirely and restart...), ran Escoria and loaded the save game. My inventory had the filled form, but also had the pen and paper as well.

  • Brand new game started in room 5. Saved without changing anything. Talked to worker in room 6 which sets the "talked_once" global to true. Reloaded room 5 save. Walked to room 6 and talked to worker. Talked_once had not been reset and was still true.

  • Started room 3, talked to sign and pushed button. Saved. Checked I could go to room 4. Restarted escoria, loaded room 3 save. Tried to go into room 4, doorway wouldn't work.

@balloonpopper
Copy link
Collaborator

Retested tonight

  1. I started a new game (F5), went into room 2, went back into room 1. I saved, then tried new game. The new game button did nothing. I got the new game button to work later, but with this process it didn't. If I continue, then go back into the menu, save still doesn't work.
  2. Started a new game, went into room 2, opened the bridge, went into room 3, talked to the switch. Saved. Went back into room 2. The bridge wrongly did it's "close" animation as I entered the room.
    Tried to reproduce this but couldn't.
  3. Start in room 5. Walk into room 6. Walk halfway to the worker. Save. Reload. Mark's position gets reset, and the worker is now facing upwards.
  4. If you start in room 1, go to room 2, go back to room 1 and walk to the middle of the room. The say command for the trigger area will be firing so Mark will be in the middle of saying something. If you press ESC while he's talking, you can get back to the menu, but the buttons won't work until he finishes talking in the background.

Everything else I tested worked as expected.

@StraToN
Copy link
Collaborator Author

StraToN commented Jan 30, 2023

  1. I started a new game (F5), went into room 2, went back into room 1. I saved, then tried new game. The new game button did nothing. I got the new game button to work later, but with this process it didn't. If I continue, then go back into the menu, save still doesn't work.

Should be fixed.

  1. Started a new game, went into room 2, opened the bridge, went into room 3, talked to the switch. Saved. Went back into room 2. The bridge wrongly did it's "close" animation as I entered the room.
    Tried to reproduce this but couldn't.

I tried to reproduce but couldn't either. Strange one :/

  1. Start in room 5. Walk into room 6. Walk halfway to the worker. Save. Reload. Mark's position gets reset, and the worker is now facing upwards.

I could reproduce this. Fixed.

  1. If you start in room 1, go to room 2, go back to room 1 and walk to the middle of the room. The say command for the trigger area will be firing so Mark will be in the middle of saying something. If you press ESC while he's talking, you can get back to the menu, but the buttons won't work until he finishes talking in the background.

On my way to fix this.
godot-escoria/escoria-issues#352

@balloonpopper
Copy link
Collaborator

balloonpopper commented Feb 11, 2023

Latest test results

  1. Run room 5. Pickup pen and paper. Use pen with paper. While he's talking about writing on the paper, do a save. Wait for the speech to finish. Load the save.
    Findings : He was in the middle of talking when I saved, he is not talking after load. Also, he's facing the front (he was facing to the right when I saved). Lastly, the pen and paper have disappeared and have not been replaced by the completed application form. So there is no pen, paper or filled in form anywhere.
    When you use pen with paper, they both disappear from the inventory, he talks, then the filled form is put in his inventory. As it looks like the in-progress script doesn't complete after the restore, he never gets given the completed form.

  2. Further tests show that facing direction doesn't appear to be restored on other save scenarios.

  3. Load room 14. Wait for walker to start walking. Save. Return to game. Quit to menu. Load save game -> crash.

Argument 1 ("True") is of type bool. Expected [ string ].```
The "prepared_objects" (esc_command.gd - line 127) are "button_main_change_scene true false"

image

Also hit this problem talking to the button in room 3, saving then trying to immediately load the save.

  1. I start a new game (F5 in room 1), wait for Mark to walk a bit, press esc, press new game, it goes back to the game and continues where it was (i.e like I've pressed "continue game" rather than "new game")
ESC (2023-02-11T23:34:27) D esc_event_manager.gd: Queueing event newgame in channel _front.
ESC (2023-02-11T23:34:30) D esc_command.gd: [wait] Return code: 0.
ESC (2023-02-11T23:34:30) D esc_group.gd: Statement (wait: [2]) was completed.
ESC (2023-02-11T23:34:30) D esc_command.gd: Running command walk_block with parameters [player, r1_destination_point2, False].
ESC (2023-02-11T23:34:31) D esc_event_manager.gd: Event 'newgame' is already the most-recently queued event in channel '_front'. Won't be queued again.
ESC (2023-02-11T23:34:33) D esc_movable.gd: player arrived at r1_destination_point2.
  1. I run room 1 (F5) then go to room 2. I press new game. It starts a new game but between hiding the menu and restarting the player in room 1, I see room 2 again for ~1 frame. It's not a show stopper, but I would like to fix it if we can.
    (My other new game tests were fine - it appears that inventory state and the state of items in the game world are correctly put back in their start state)

  2. The load game file list isn't consistent with either ordering the save games in the order they were saved, or alpha-numerically.

image

  1. If you select a new save slot you get asked if you'd like to overwrite the slot. It's a new save so I think we should hide this prompt.

  2. Loaded room 5. Walked into room 6. Walked halfway to the worker. Turned to face left. Save. Immediately load. Mark's position is reset to the doorway.

  3. Load room 5. Run with F5. Load the save in (8) above. Immediately press ESC to pause -> crash.
    image

  4. Start in room 1 (F5). Walk to room 2. Walk to room 1. Walk to the left. Once the trigger area fires and he starts talking, hit escape and try to press the save button. It doesn't work until he finishes talking in the background.

@StraToN StraToN marked this pull request as draft March 2, 2023 07:43
@StraToN
Copy link
Collaborator Author

StraToN commented Mar 31, 2023

@balloonpopper Cases 1, 2, 3 and 4 should be fixed in current state.
I'm checking out the next cases.

@StraToN StraToN marked this pull request as ready for review April 17, 2023 08:40
@StraToN StraToN marked this pull request as draft April 22, 2023 17:02
@StraToN StraToN force-pushed the issue-217-savegames-new branch 4 times, most recently from 8b27ec1 to 4f547f3 Compare May 3, 2023 21:55
@StraToN StraToN marked this pull request as ready for review May 10, 2023 20:55
@StraToN
Copy link
Collaborator Author

StraToN commented Jun 22, 2023

Note: this PR is ok for review. Don't mind the conflict, I'll fix it soon.
@BHSDuncan @balloonpopper

addons/escoria-core/game/core-scripts/esc_item.gd Outdated Show resolved Hide resolved
addons/escoria-core/game/escoria.gd Outdated Show resolved Hide resolved
addons/escoria-core/game/escoria.gd Outdated Show resolved Hide resolved
addons/escoria-core/game/scenes/sound/esc_music_player.gd Outdated Show resolved Hide resolved
@StraToN StraToN force-pushed the issue-217-savegames-new branch 3 times, most recently from fffc3ae to 2801dc1 Compare June 25, 2023 09:46
@StraToN StraToN requested a review from BHSDuncan June 29, 2023 21:11
@balloonpopper
Copy link
Collaborator

@StraToN Tested this tonight
Issue 1) Started a new game. In room 1 as Mark is walking I saved then continued my game. Mark kept doing his walk around the room as as part of the cutscene at the start of room 1.
I reloaded the save and it didn't resume the cutscene.

Issue 2) Hitting enter doesn't work when supplying a name for the save

Issue 3) Loading room 1's scene I get this error 4 times
res://addons/escoria-core/game/core-scripts/esc_item.gd:187 - Invalid get index 'GROUP_ITEM_CAN_COLLIDE' (on base: 'Node (esc_autoload.gd)').

Issue 4) I start in room 1, walk to room 2, walk back to room 1. Using the left door in room 2 the game crashes with
"Left operand of 'is' was already freed."
The Global ID of the object that has been freed is "player"
image

I'm also seeing a bunch of errors in the debugger, I don't recall seeing any of these except the navigation warning.
image

Issue 5) Start in room 1. Walk to room 2. Use the button and cross the bridge. Save. Load save from Issue 1. Try to exit room 1. Crashes with the error in issue 4.

I'm having trouble testing as I get issue 4 after every reload so I'll stop here.

From what I could test in the first few rooms, it appears that the state of the pictures in room 1 and the buttons in room 2/3 were all being reloaded correctly.

@BHSDuncan
Copy link
Collaborator

Good testing. Yeah, we should almost always being using is_instance_valid when checking for valid objects. I wish it would just do that by default when doing something like if object: but oh well.

@StraToN StraToN marked this pull request as draft October 3, 2023 15:04
@balloonpopper
Copy link
Collaborator

As discussed on discord 14/10/23, please save the "is disabled" flag for collision shapes as part of items in save games.

@StraToN
Copy link
Collaborator Author

StraToN commented Feb 6, 2024

Important note : only blocking commands can be saved at the moment, as scheduled events are ran in the _front channel and disappear immediately as they are run, unless they are blocking.

Fix: multiple left clicks on bg don't allow player to fly above navigation holes

Save terrain nodes into savegames
Fix savegames loading: set enabled terrain
Fixes issue godot-escoria#217
Fixes issue godot-escoria#209
Apply suggestions from code review
Add settings into savegame
Fix: on savegame load, only add item to inventory if global is true
fix: Clear globals before loading
Add a "New game" option in Pause menu
Fix: save correct initial position of NPC
Fix: duplicated cameras in room on savegame load from same room
Fix: new game button didn't work multiple times in a row
Savegames: manage music resume on savegame load
Set initial state of ESCItems so that they are saved in savegames
Fix: saved escitems weren't loaded to their correct orientation
On savegame load, resume ongoing event
Fix: don't set_state if state is empty in savegame
Fix: starting new game while an event is running now works
Add scheduled events to savegames
Co-authored-by: Duncan Brown <[email protected]>

Some more fixes

Apply suggestions from code review

Co-authored-by: Duncan Brown <[email protected]>
Apply suggestions from code review

Fix: trigger_out event was fired when loading a saved game while player was in a trigger area

Add documentation

Fix: allow enter key to validate savegame name

Fix Running Event loading execution

Manage scheduled events (test in room16)

Fix some potential errors

Thanks @enekonieto

Fix core referencing plugin content

bugfix: fix loading non string globals

fix: Reset event's statement to resume to 0 if event was completed

feat: Save/load ESCItem.custom_data

fix: remove logs

Save target for camera to follow

This resets the cameraat the right position after loading a game

Managing inventory items order at game save & load
@enekonieto
Copy link
Contributor

After applying my last PR saving a game in room01 and then loading crashes:

E set_interactive.gd: [set_interactive]: invalid object. Object with global id intro_animation_player not found.

I don't know how to solve...

But the save system has improved a lot with your last commit. You can now combine paper and pen from room05, go to room06 and save. After loading (skipping the current error) room05 does not have paper and pen and you have the combined item in inventory. I think this is the first time this works, good work!

@StraToN
Copy link
Collaborator Author

StraToN commented Aug 22, 2024

After applying my last PR saving a game in room01 and then loading crashes:

E set_interactive.gd: [set_interactive]: invalid object. Object with global id intro_animation_player not found.

I don't know how to solve...

But the save system has improved a lot with your last commit. You can now combine paper and pen from room05, go to room06 and save. After loading (skipping the current error) room05 does not have paper and pen and you have the combined item in inventory. I think this is the first time this works, good work!

Thank you for your encouragements. I want to apologize for the long time waiting for this to progress again at last ; I am just getting back to it after a long period of professional transition (still currently ongoing though) that was sucking all my time and until recently my motivation. But it is finally getting back somehow. Anyway :

I have observed the same issue. The reason is that saving now saves all objects recorded in the Objects Manager, so we don't loose them (or, at least, their properties that changed from default). But I need to change how loading works so that we don't apply ESC commands onto objects that are not in the current room (because other rooms are not loaded, so aren't the objects they contain).

@StraToN StraToN marked this pull request as ready for review September 24, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants