This is trapdoors proposal for networking to be implemented in the FIFE engine core. It is only for client-based multiplayer games, and not persistent or server-based multiplayer games. It is written purely with BSD sockets (winsock in Windows).
The network manager is what is used to create multiplayer games. It acts as a network listener. The functions will be:
- init - This will create the NetworkServer and NetworkClient.
- getNetworkServer - This will return the NetworkServer
- getNetworkClient - This will return the NetworkClient
- update - This will listen for messages and connections
- registerListener - This is where listeners are registered to hear network events
- removeListener - This will remove an existing listener from hearing network events
This class is for hosting a game, and it will have the following functions.
- init - This will initialise the server.
- start - This will start the server running. It returns whether it started successfully.
- update - This listens for client messages
- getIP - The IP the server is running on
- getPort - The port the server is running on
- numberOfClients - This will return the number of clients connected.
This class will be used to connect to a server. It will have the following functions.
- init - This will initialise the client, and take in the IP address of the server.
- update - This listens for server messages
- isConnected - This will return whether the client is connected to the server
Using Networking from python
- The server must be started on the host, and all others only need create a client.
- A network listener must first be inherited, and registered with the Network Manager.
- Listening for msgReceived messages allows you to get Network Events.