ObsidianMC / Obsidian

A C# implementation of the Minecraft server protocol.
GNU General Public License v3.0
401 stars 41 forks source link

[ Idea ] [ very cool! ] Splitting up communication and behavior code #182

Closed Naamloos closed 2 years ago

Naamloos commented 2 years ago

This would take a lot of work to actually get set up properly, but it would allow us to very easily create different implementations of behavior for the server.

for example:

Aaron2550 commented 2 years ago

why not just make the two proxy servers one big thing? "debug releases" log things, "release releases" just dont?

Naamloos commented 2 years ago

the one is a "bridge" between two (or more) servers, while the other would be a tool for packet analysis.. quite a difference imho

Aaron2550 commented 2 years ago

The proxy is never between servers. It is always between clients and one or multiple servers. In a production environment nobody should need packet logging, while in a test environment where debug builds are "more useful" you'd probably want the packet logging because well.... You are in a test environment so u wanna test stuff. While I'm not for or against two proxy repos with different uses, I think this approach would/could probably save some duplicate code..

Naamloos commented 2 years ago

the proxy does not connect clients. it connects servers. Allows a client to hop between them.

As for packet logging, I still think it should be a separate application, as it does not need the fancy server switching stuff that e.g. bungeecord would be used for. Both are proxies, but with different use cases.

Craftplacer commented 2 years ago

So decouple handling packets and running game logic into two separate things so you'd have an easier time changing it?

Craftplacer commented 2 years ago

I can imagine it going this way: we define a simple abstract PacketHandler class, which can be inherited by many classes, I'd say you'd just write a default "AuthenticationPacketHandler" with events for handling various auth things.

Aaron2550 commented 2 years ago

A Proxy does not connect Servers. All Clients connect to the Proxy and then the Proxy logs the Players in and out of the Servers it is responsible for/connected to. Example: Lets say you are Hypixel and your Lobby-1 Server goes down. What makes more sense? What im describing on the Left or what youre describing on the Right? image

Naamloos commented 2 years ago

First one, but a server can send the client "back" to the proxy (via plugin) to join another one

Aaron2550 commented 2 years ago

the proxy just logs the palyer out of server1, sends a "teleporting to another world" packet so the client shows the "loading world" screen and then logs the player in on server2

Naamloos commented 2 years ago

😐 the specifics aren't really that important here imo

Naamloos commented 2 years ago

Same ideas are being proposed in #185. I'll close this issue as seb's wording is just infinitely better than what I did here.