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

Server refactor #403

Merged
merged 29 commits into from
Nov 24, 2023
Merged

Server refactor #403

merged 29 commits into from
Nov 24, 2023

Conversation

Tides
Copy link
Member

@Tides Tides commented Nov 18, 2023

This is a refactoring of Server, WorldManager and packet broadcasting. Abstracting them out further and removing a lot of circular dependencies.

Notable Changes:

  • WorldManager is now a hosted service. It will load or generate specified worlds right after the server itself is started and also manage every loaded world chunk on its own loop. Note that this doesn't tick worlds, as that still handled within the main server loop

  • Packet broadcasting is no longer handled by the server class and is now handled by the PacketBroadcaster class & registered as a hosted service as well for priority queuing & sending packets. There are methods to skip the queue and directly send packets to clients if needed. This is the first iteration and needs more discussion.

  • Entities no longer depend directly on the server to broadcast packets & will inherit the packet broadcaster service from their respective worlds. With this change, we'll have to implement more methods to do specific things (like rotating an entity's head) and not do any packet broadcasting outside of the entity class and serverbound packets.

I planned to also include the plugin manager refactor here but since its as big as these first couple changes so I left it out (#377) ~

I believe these changes are pushing the server further to be more clean and concise while tackling (#185). The end goal is to depend more on Microsoft's hosting extensions and not be overwhelmed overall.

@github-actions github-actions bot added api Relates to Obsidian.API commands Relates to Obsidian.Commands labels Nov 18, 2023
@Tides Tides added enhancement New feature or request epic Very cool server Relates to the server implementation world generation Relates to world generation performance Performance related issue priority: blocking Blocking; must be prioritized labels Nov 18, 2023
Craftplacer
Craftplacer previously approved these changes Nov 18, 2023
@Tides Tides marked this pull request as ready for review November 20, 2023 15:48
Copy link
Member

@Jonpro03 Jonpro03 left a comment

Choose a reason for hiding this comment

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

Refreshing server status during initial world gen causes a crash

Copy link
Member

@Jonpro03 Jonpro03 left a comment

Choose a reason for hiding this comment

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

Crash when loading a world from disk
EDIT: nvm... seems fine after a clean

@Tides
Copy link
Member Author

Tides commented Nov 21, 2023

Crash when loading a world from disk EDIT: nvm... seems fine after a clean

👀

@Naamloos
Copy link
Member

Crash when loading a world from disk EDIT: nvm... seems fine after a clean

Average obsidian update experience

Naamloos
Naamloos previously approved these changes Nov 22, 2023
@Naamloos
Copy link
Member

I was not aware of priorityqueue being a thing, cool!

@Tides Tides merged commit 0ad986f into master Nov 24, 2023
2 checks passed
@Tides Tides deleted the server-refactor branch November 24, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Relates to Obsidian.API commands Relates to Obsidian.Commands enhancement New feature or request epic Very cool performance Performance related issue priority: blocking Blocking; must be prioritized server Relates to the server implementation world generation Relates to world generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants