[RESOLVED] Skippable part of the game that is not a real cutscene

Started by Joacim Andersson, Sun 08/12/2024 19:28:29

Previous topic - Next topic

Joacim Andersson

When my game starts the user has to play through a very restricted part of the game that sets the premise off the rest of the game. This is not really a cutscene since you still play the game and have to move through a few rooms. However, I want the user to be able to skip this part of the game from the start screen if they so desire, especially if they've played the game before. I did this in an old game of mine, but that was 20 years ago and I can't remember the code I used.

If anyone understands what I'm talking about and can give some advice I surely would appreciate it,

Crimson Wizard

#1
Simply change to the room which comes after the intro part, and set global game state accordingly (meaning any changes to characters, inventory and variables that become modified during the course of the intro part).

Joacim Andersson

#2
The intro part ends in the same room as the game begins in, and the continuation is still within this room.

To clarify, the game starts within a room, the player has to leave and follow a path to another specific room where he gets some information. He then returns to the original room and on the way he meets another character that follows him inside the starting room and a conversation is had. The other character then leaves and this is the end of the intro.

The whole intro takes place in 4 different rooms.

Crimson Wizard

#3
Quote from: Joacim Andersson on Sun 08/12/2024 20:15:59The intro part ends in the same room as the game begins in, and the continuation is still within this room.

To clarify, the game starts within a room, the player has to leave and follow a path to another specific room where he gets some information. He then returns to the original room and on the way he meets another character that follows him inside the starting room and a conversation is had. The other character then leaves and this is the end of the intro.

Well, the solution is very straightforward, although amount of work varies from case to case:
- Make a list of changes that player actions do to the game state within the intro sequence.
- Apply them at once programmatically when skipping intro sequence.

This situation is similar to the one when you want to make a teleport to a game chapter - for testing purposes. You need to know how the game state changes between the chapters, and apply these changes in script.
Sometimes it's easy to know the state it should be in. Sometimes it may be more convenient to apply series of changes one by one (even if these are changes to the same object), mimicing player actions that would be made in previous chapter(s).

Global state is usually easy to modify.
Room states are more complicated, since you cannot change room state without loading a room. These are commonly solved by storing global variables that tell how a room should look like when visited next time. When a corresponding room loads, modify its state in "room load" event according to these global variables.

Joacim Andersson

Thank you CW, I do realize that I can write my own code around this, and that's not really the problem. It's just that I kind of remember that I once used some built-in feature for this, something similar to SetRestartPoint except that would require that you've already played through the intro.

Maybe I just remember it wrongly.

Crimson Wizard

Quote from: Joacim Andersson on Sun 08/12/2024 21:51:10Thank you CW, I do realize that I can write my own code around this, and that's not really the problem. It's just that I kind of remember that I once used some built-in feature for this, something similar to SetRestartPoint except that would require that you've already played through the intro.

I see what you mean now.
You can create custom save slots for players that already passed certain stage, that may be used to restore later.
This is done simply using SaveGameSlot / RestoreGameSlot, but you use a slot number outside of a regular range that you let use in save/restore game menus.

But that won't help to skip if they haven't passed that yet.
Alternatively, you may even make one yourself and supply along with your game (except you'd probably need an installer to be able to place one in a savegames folder). Idk how convenient that would be though.

Joacim Andersson

I've considered using save slots but skipped that idea since I want this to be playable in the browser. So, I just wrote my own code around it. It was fairly straightforward in my case; I just thought I remembered another way of doing it. In my case, I just had to change a boolean variable into an enum so it could have a couple of different states, that could be checked in two different locations. If the intro was skipped it just also needed to set a couple of other variables and move the player character to a certain position when the game starts.

So thank you again, I guess I just remembered things wrong.

Danvzare

Quote from: Joacim Andersson on Sun 08/12/2024 19:28:29When my game starts the user has to play through a very restricted part of the game that sets the premise off the rest of the game. This is not really a cutscene since you still play the game and have to move through a few rooms. However, I want the user to be able to skip this part of the game from the start screen if they so desire, especially if they've played the game before. I did this in an old game of mine, but that was 20 years ago and I can't remember the code I used.

If anyone understands what I'm talking about and can give some advice I surely would appreciate it,
I did something similar in Black Friday II. I just added a separate start button, that sets up the variables to what they would have been at the end of the prologue.
It's quite easy to move the characters to the correct rooms, give them the correct items, and even set some global variables that those rooms can read upon their first load, in order to make the correct objects visible or not visible.

The hard part is having the skip prologue button only show up, after you've already played through it. Since you need to effectively store a variable outside of the game, which is read when the game is first loaded.

SMF spam blocked by CleanTalk