Sample examples
The examples below are based on the git sample project, see the link below for more information.
Client
- Proxy & Stub
// Client -> Server RMI Proxy instance
Simple::Proxy g_SimpleProxy;
// Unlike an RMI proxy, it is used after overriding a function.
class SimpleStub : public Simple::Stub
{
public:
DECRMI_Simple_ShowChat;
DECRMI_Simple_SystemChat;
DECRMI_Simple_P2PChat;
};
// RMI stub instance for receiving messages
SimpleStub g_SimpleStub;using namespace Nettention.Proud;
// An RMI proxy is used to send messages.
// The function call is executed in a different process.
static Simple.Proxy g_Proxy = new Simple.Proxy();
// The RMI stub is used to receive messages.
static Simple.Stub g_Stub = new Simple.Stub();- Defining RMI functions
RMI functions use the following conventions for easy naming.
=> DEFRMI_GlobalName_FunctionName
- Create a NetClient object
- Connecting Events
You can design the logic you need in the server connection event and then use it.
- Proxy & Stub Registration
- Connect to a server
Then, in a function that will be called every frame, call netClient -> FrameMove().
Call netClient.FrameMove() in a function that will be called every frame thereafter.
By default, a FrameMove must be performed before the event is fired.
Server
- Proxy & Stub
- Defining RMI functions
- Create a NetServer object
- Connecting Events
- Proxy & Stub Registration
Start a server
Common
- vars.h
- vars.cpp, vars.cs
Last updated