mocha-engine / mocha

Mocha: A work-in-progress 3D game engine
GNU Lesser General Public License v3.0
53 stars 7 forks source link

(Draft) Implement Networking using GameNetworkingSockets and Quake 3-like snapshot system #53

Open xezno opened 1 year ago

xezno commented 1 year ago

Note - this is a draft pull request and isn't ready to be merged yet.

Description

This pull request implements networking functionality for our game engine using the GameNetworkingSockets library for transport and a snapshot system similar to Quake 3's architecture. It includes the following features:

Various low-level engine changes have also been made - these are now merged into master as part of #58.

API Changes

Networking

Synchronisation To synchronise a property or field over the network:

[Sync] public string MyNetworkedString { get; set; }
[Sync] public string MyOtherNetworkedString;

Method Stripping To strip methods:

[Event.Tick, ServerOnly]
public void ServerTick()
{
    DebugOverlay.ScreenText( "Server Tick..." );
}

[Event.Tick, ClientOnly]
public void ClientTick()
{
    DebugOverlay.ScreenText( "Client Tick..." );
}

How to Test

To test the networking functionality, do the following:

  1. Clone this branch and build the game engine
  2. Run the game engine and connect to a server or host a game
  3. Play the game and observe the networking behavior

Related Issues

This pull request is related to the following issues: