Skip to content

Deterministic timer simulation for shrine messages in demo mode#6516

Merged
AJenbo merged 3 commits intodiasurgical:developmentfrom
StephenCWills:demo-timer
Aug 29, 2023
Merged

Deterministic timer simulation for shrine messages in demo mode#6516
AJenbo merged 3 commits intodiasurgical:developmentfrom
StephenCWills:demo-timer

Conversation

@StephenCWills
Copy link
Copy Markdown
Member

@StephenCWills StephenCWills commented Aug 26, 2023

Solves one of the issues listed in #2745.

Dialogs playback is realtime, if the player did not interrupt it (or playback is slower then playtime) the dialog will stay open for a different duration

When recording a demo or playing it back, the game simulates SDL_GetTicks() based on the number of game ticks that have elapsed since the start of the demo, assuming 20 fps. When recording or playing back at faster speeds, this means that shrine messages will disappear faster and dialog will move faster than the corresponding audio.

@StephenCWills StephenCWills marked this pull request as ready for review August 28, 2023 03:24
@StephenCWills
Copy link
Copy Markdown
Member Author

StephenCWills commented Aug 28, 2023

Now that I'm reading it again, I suppose the issue I mentioned earlier was probably referring to speech text, like if you talk to Ogden after starting a new game. This doesn't resolve that, but it does work for shrines. Never mind, it was very easy to include dialog as well.

I'm not sure I like the name of the GetTicks() function. And I definitely don't like having devilution::GetTicks() and demo::GetTicks(). I'm thinking about whether to change one or both of these function names. Maybe.. demo::SimulateTicksAtNormalSpeed()?

EDIT: I think I'm pretty happy with devilution::GetMillisecondsSinceStartup() and demo::SimulateMillisecondsSinceStartup(). Unfortunately, the thing it still doesn't really convey is why you would use this instead of SDL_GetTicks() directly.

@AJenbo AJenbo merged commit 5e77843 into diasurgical:development Aug 29, 2023
@StephenCWills StephenCWills deleted the demo-timer branch August 29, 2023 12:15
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.

3 participants