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

Support dynamically spawned monsters in multiplayer #6890

Merged
merged 3 commits into from
Jan 11, 2024

Conversation

obligaron
Copy link
Contributor

Fixes #1682

This PR synchronises dynamically spawned monsters between clients (monsters not spawned during level loading).
Doppelganger and Hork demon spawns should now synchronise between clients.
This PR would also allow Leoric to dynamically spawn skeletons in multiplayer (not part of this PR).

Logic

  • Only one player is the dungeon levelmaster (similar to items).
  • This player's game logic decides whether new monsters spawn or not (see the SpawnMonster function).
  • This ensures that the dynamically spawned monsters have the same monsterId on all clients (necessary for correct synchronisation).
  • Other clients are informed about the new monster with the new network command CMD_SPAWNMONSTER.
  • Information about dynamically spawned monsters is stored in DLevel.

This may also be useful for modding purposes.

Source/monster.cpp Outdated Show resolved Hide resolved
Copy link
Member

@AJenbo AJenbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good size of functons and level of comments 👍

@AJenbo AJenbo merged commit 51ab010 into diasurgical:master Jan 11, 2024
23 checks passed
@obligaron obligaron deleted the monsterspawn branch January 12, 2024 05:49
@Chonkblonk
Copy link

Oh sweet, I was just about to look for if anyone had suggested this, because I felt it'd be cool if Leoric would spawn skeletons in MP.

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.

Doppelganger's affix causes desync
3 participants