diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.04k stars 790 forks source link

Demo: Recorded Messages decission #2733

Closed obligaron closed 2 years ago

obligaron commented 3 years ago

Introduction

When we record a demo, we need to record what the player does to replay it. There are multiple alternatives what can be recorded. Each alternative has some pros and cons. Currently UI/Click-based recording is implemented. But we should explicitly decide what alternative (and with them what pro and contra) we want. Switching from one alternative to another is expensive (switch implementation, existing replays gets invalid, ...), so we should explicitly decide what alternative we want to be implemented. This issue can be closed if we have a list of alternatives, a overview of the pro and cons of them and a decision what we want.

Notes to admins: Feel free to edit this post.

Alternatives

UI/Click-based

Description

We record players clicks, keyboard input, mouse movements, ... The replay simulates the same interactions with the UI.

Implementation notes

Cause the UI interactions are replayed, we need to know what UI settings (resolution, panel distance, ...) where used when recording the replay. Else the replay would get out of sync with original play (for example click on the wrong UI buttons cause the panel moved to different location).

Pros

Cons

Command-based

Description

We record players commands. For example move to tile xy, attack monster, pick up item, ... The replay simulates the same commands.

Implementation notes

This is similar to how the multiplayer work. It's possible that there are synergies between replay and multiplayer. Cause we only records actions that have a meaning to game logic, we don't record something like mouse movements. But that also means you will never see mouse movements in the replay.

Pros

Cons

Ending

This issue shouldn't hold us back to improve the currently demo. The currently stated pros and cons are only a initial list. I hope we can have a nice discussion of the pros and cons. πŸ™‚

AJenbo commented 3 years ago

For comparison Dooms demo format consist of the players current state (moving in direction X at a velocity of 50), which is more like a command based recording, though arguably it is even one step deeper in the engine.

I do not know the internal format of StarCraft demos, but during replay you do not see the players mouse or UI interactions so it appears to be using a command based recording as well.

One pro I think you missed with Command-based is that it allows you to control what UI info is presented during playback, which can be helpful to better understand what was going on during game play. i.e. show the stats all the time to see exactly how low the players health drops, or turn of the automap to a a beautiful action replay as your live desktop wallpaper. This is also mere like StarCraft where you get to inspect the game during playback and have separate controls for adjusting playback speed (including pause).

AJenbo commented 3 years ago

Technically you could also have a hybrid format that includes mouse movement in addition to commands, but I think that might add more cons then it's worth.

AJenbo commented 3 years ago

Oh, and a con for input based recording is that it is nearly impossible to read, tweak, fix, or adjust, even with tooling as the data has no real context with out the specific engine state.

AJenbo commented 3 years ago

More cons against input based recording :sweat_smile:

Since input is related to the rendered we need to record the exact frame time to be able to calculate the exact meaning, and set the engine to this state during playback. This causes the playback to be extremely jittery at time.

Recording input also results in much larger demo files, a full run of the game takes about 20mb, though compression gets this down to just 2mb, I think that a command based format will be much smaller.

obligaron commented 3 years ago

For comparison Dooms demo format consist of the players current state (moving in direction X at a velocity of 50), which is more like a command based recording, though arguably it is even one step deeper in the engine.

I do not know the internal format of StarCraft demos, but during replay you do not see the players mouse or UI interactions so it appears to be using a command based recording as well.

I checked my version of StarCraft 2. You can change spectator mode to follow the camera of the player. You also see which unites or buildings the player selects. But you don't see players cursor.

A big difference to Doom or StarCraft is that both don't have much different screens/dialogs/menus that you can interact with. That is different in diablo. You have the npcs (with shops), inventory (with belt), quest, character sheet. And these are core game mechanics. We miss this core mechanics if we only record what actions the player effective does. Example: If we don't record what the player the player does, you could see the player standing for 2 minutes in front of a npc and you would see... nothing. Cause we don't replay when he is browsing the shop items, sell items, repair his stuff or rearrange his inventory.

One pro I think you missed with Command-based is that it allows you to control what UI info is presented during playback, which can be helpful to better understand what was going on during game play. i.e. show the stats all the time to see exactly how low the players health drops, or turn of the automap to a a beautiful action replay as your live desktop wallpaper. This is also mere like StarCraft where you get to inspect the game during playback and have separate controls for adjusting playback speed (including pause).

I think this is also possible with UI/Click-based approach, but adds more complexity. That's why I added Viewing different content (for example another resolution) then the original player is easier. I added more examples to the pro and added it explicitly as a contra to the UI/Click-based alternative. πŸ™‚

Oh, and a con for input based recording is that it is nearly impossible to read, tweak, fix, or adjust, even with tooling as the data has no real context with out the specific engine state.

That's true. It's a mess with all the click coordinates. πŸ˜„ Added it as contra. πŸ™‚

Since input is related to the rendered we need to record the exact frame time to be able to calculate the exact meaning, and set the engine to this state during playback. This causes the playback to be extremely jittery at time.

I tried to describe this with If the UI changes, replays can get invalid (more unstable).. Two questions:

Recording input also results in much larger demo files, a full run of the game takes about 20mb, though compression gets this down to just 2mb, I think that a command based format will be much smaller.

I also think so. Added it as a contra. πŸ™‚

AJenbo commented 3 years ago

Do I miss the point? Do you mean that the replay could also jitter?

Currently the rendering will jitter since they are replayed at your current time, but the demo has set a fame time that is likely not visually correct during playback. This can cause the screen to shake a few pixels between each frame, or play at an inconsistent pace (very visible if you slow down the replay to 5 ticks/sec)

obligaron commented 3 years ago

Currently the rendering will jitter since they are replayed at your current time, but the demo has set a fame time that is likely not visually correct during playback. This can cause the screen to shake a few pixels between each frame, or play at an inconsistent pace (very visible if you slow down the replay to 5 ticks/sec)

I think this is a bug (see #2750).

ThomasChr commented 3 years ago

I think the command based version is definitly more stable and has the added bonus that the viewer could open windows to see stats while the demo plays. So the only thing needed is to add the ability to record which interactions with the NPCs happend. But that is for sure more easy then coping with newly added buttons in the UI!

NiteKat commented 3 years ago

Just tossing my two cents in, command based version is what I would vote for. A cool feature in that would be to have the ability to decouple the camera from the player doing the demo - so you can move around the current floor without having to follow the player. If demos are to work in MP eventually, would be cool to see what other players were up to while you were fighting a horde of monsters alone. πŸ˜†

obligaron commented 3 years ago

From a technical/architecture view command-based solution is clearly better. And I would also prefer this solution.

But before we close this issue, I would ask a last time if we want some of the missing features to be added additionally to the command-based solution. I heard at least one comment. πŸ˜‰

Feature Description
Mouse movement You would see where the mouse (in dungeon) is for the player.
Opened Panels You can see what panels (inventory, character, quest) the player has currently open.
Selection You see what object the player selects (in the dungeon; for example a monster or a shrine).
Inventory Actions Inventory selection. Item pickup in inventory and held in cursor.
Automap You can see if the automap of the player is open and what location it is pointed to.
NPC Interaction Shows what menus the player is currently browsing (shop, talk, etc.).
Messages from objects You see the same shrine messages as the player. (could be included per default)
Videos You see the diablo kill movie. πŸ˜‰ (could be included per default)
... Something I missed.

Note that all listened features are not included per default in a command-based solution, cause they are not needed for multiplayer and game logic. So additional features add more effort and complexity. That means they are not free and perhaps we will never add them. But if we really want them, it would be great to know beforehand, cause some design decisions of the command-based solution could be affected by these features.

Possible priorities could be

All features with no reply would be interpreted as not interested. 😁

AJenbo commented 2 years ago

We shall have a command format that can be used both with network, demo, local and hotseat!

ThomasChr commented 2 years ago

And so it shall be!