Getting Started with Networking
This tutorial walks you through setting up a basic multiplayer connection in Plasma Engine, from enabling the plugin to verifying replication with the debug component.
Prerequisites
A Plasma Engine project with a C++ game plugin.
The project should be able to compile and run a basic scene.
Step 1: Enable the Network Plugin
Open your project in the Plasma Editor. Go to Project > Plugin Selection and enable the NetworkPlugin. This makes all networking components and the plNetworkWorldModule available. The engine handles linking automatically -- no changes to your CMakeLists.txt are needed.
Include the main header in your game code:
Step 2: Configure and Start the Network
The best place to start the network is in your plGameState or a startup component. Here is a minimal example using a game state:
Step 3: Verify the Connection
To verify the connection is working, create a simple networked component that logs connection events:
Add this component to an object in your scene. Run two instances of your game -- one as a host and one as a client. You should see the connection messages in the log.
Step 4: Add a Debug Component
To visualize network state in the viewport:
Create a simple prefab with a mesh (e.g., a sphere).
Add a
plNetworkComponentto the root object.Add a
plNetworkDebugComponentto the same object.Place the prefab in your scene.
When you run the game, you will see debug text above the object showing its network ID, replication state, and network role.
Step 5: Check Network State at Runtime
You can query the network state from any component or game state:
Next Steps
Now that you have a working connection:
Spawn networked objects-- Learn to spawn prefabs that replicate across the network.
Use RPCs-- Trigger actions on remote machines.
Build a custom component-- Create a replicated health component.