Skip to content

Add implement Multiplayer System (LAN Host/Join + Target Server)#179

Open
kuwacom wants to merge 5 commits intosmartcmd:mainfrom
kuwacom:main
Open

Add implement Multiplayer System (LAN Host/Join + Target Server)#179
kuwacom wants to merge 5 commits intosmartcmd:mainfrom
kuwacom:main

Conversation

@kuwacom
Copy link

@kuwacom kuwacom commented Mar 2, 2026

Implement Multiplayer System (LAN Host/Join + Target Server)

Description

This PR implements a Windows64 Multiplayer System, including LAN host/join flow, target-server join support, and reconnect stability improvements.

image

image

Changes

New Behavior

  • Windows64 can host/join multiplayer sessions from the in-game Join Game flow.
  • Gameplay/network session traffic uses TCP.
  • LAN discovery uses UDP broadcast plus local same-machine fallback.
  • Direct target endpoint join is supported via -target <IP:PORT>.
  • Reconnect now restores normal chunk streaming performance.

Previous Behavior

After reconnecting, chunk loading could become very slow or appear stuck.

Cause

Per-system chunk-sent flags were not cleared on reconnect, leaving stale streaming state.

Fix Implementation

  • Added Winsock-based Windows64 networking layer (WinsockNetLayer) for host/join transport.
  • Added LAN advertise/discovery and target endpoint integration in session search/join flow.
  • Added CLI options:
    • -name <PlayerName>
    • -host <IP:PORT> : default 0.0.0.0:25565
    • -target <IP:PORT> : default 255.255.255.255:25565
  • Cleared stale per-system chunk-sent flags on reconnect and hardened disconnect/rejoin handling.
  • Updated project files and README usage documentation.

Acknowledgements

Special thanks to LCEMP/LCEMP.
This implementation was heavily based on the following repository:

Related Issues

kuwacom added 4 commits March 3, 2026 03:44
- Implement Windows64 LAN multiplayer (host/join, discovery, session flow)
- Add command-line options for multiplayer testing: -name, -host, -target
- Add multiplayer usage docs to README
- Reference implementation: https://github.com/LCEMP/LCEMP
…terrain load speed

- Add SystemFlagClearForSystem (PlatformNetworkManagerInterface / GameNetworkManager)
- In PlayerList::placeNewPlayer, clear flags when no active player exists on the same system
- Prevent initial chunk transmission from being incorrectly skipped after disconnect/reconnect
# Conflicts:
#	Minecraft.Client/Minecraft.Client.vcxproj.filters
@simulpingus
Copy link
Contributor

#170

@lspepinho
Copy link
Contributor

What does this PR add compared to Simul's?

@kuwacom
Copy link
Author

kuwacom commented Mar 2, 2026

Oh, I didn't there was already one like that.

I haven't checked that one yet, so I'll give it a try.

@kuwacom
Copy link
Author

kuwacom commented Mar 2, 2026

What does this PR add compared to Simul's?

It looked almost the same to me.
The only differences I noticed were the addition of startup options for the host address and port, and the way world names are displayed in the server list (showing IP and port).

There might be other differences in display, connectivity, or specific bugs.

@lspepinho
Copy link
Contributor

They are based on the same fork, so its the same bugs. @kuwacom

@smartcmd
Copy link
Owner

smartcmd commented Mar 2, 2026

Close this PR?

@void2012 void2012 added the duplicate This issue or pull request already exists label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Online / LAN Multiplayer Support

5 participants