User:RossyMiles/Flatline: Difference between revisions
RossyMiles (talk | contribs) (a work in progress ^_^) |
RossyMiles (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
Flatline is the most recent proposed multiplayer mod for Oni. This document is a work in progress. | Flatline is the most recent proposed multiplayer mod for Oni. This document is a work in progress. | ||
== Flatline API == | |||
Both the Flatline clients and dedicated servers will run inside Daodan inside an official build of Oni. This is because a copy of Oni is needed to fully simulate the scripting and physics in a game. | Both the Flatline clients and dedicated servers will run inside Daodan inside an official build of Oni. This is because a copy of Oni is needed to fully simulate the scripting and physics in a game. | ||
Two sets of functions will be provided. The Net* functions will provide a basic, non-blocking UDP sockets library. The FLr* functions will be the rest of the code required. | Two sets of functions will be provided. The Net* functions will provide a basic, non-blocking UDP sockets library. The FLr* functions will be the rest of the code required. | ||
== NetPlatform_* == | === NetPlatform_* === | ||
bool '''NetPlatform_Initalize'''()<br> | bool '''NetPlatform_Initalize'''()<br> | ||
This function is called when the network functionality is required. On Windows, it makes a call to WSAStartup. | This function is called when the network functionality is required. On Windows, it makes a call to WSAStartup. | ||
Line 13: | Line 13: | ||
For every call to NetPlatform_Initalize, there has to be a corresponsing call to NetPlatform_Shutdown. On Windows, this function calls WSACleanup. | For every call to NetPlatform_Initalize, there has to be a corresponsing call to NetPlatform_Shutdown. On Windows, this function calls WSACleanup. | ||
== NetUDPSocket_* == | === NetUDPSocket_* === | ||
int '''NetUDPSocket_Create'''(uint16_t '''port''')<br> | int '''NetUDPSocket_Create'''(uint16_t '''port''')<br> | ||
Creates a new, non-blocking, UDP socket and binds it to the port specified. If the specified port is 0, the socket is automatically bound to an unused port. | Creates a new, non-blocking, UDP socket and binds it to the port specified. If the specified port is 0, the socket is automatically bound to an unused port. |
Revision as of 02:10, 16 July 2009
Flatline is the most recent proposed multiplayer mod for Oni. This document is a work in progress.
Flatline API
Both the Flatline clients and dedicated servers will run inside Daodan inside an official build of Oni. This is because a copy of Oni is needed to fully simulate the scripting and physics in a game.
Two sets of functions will be provided. The Net* functions will provide a basic, non-blocking UDP sockets library. The FLr* functions will be the rest of the code required.
NetPlatform_*
bool NetPlatform_Initalize()
This function is called when the network functionality is required. On Windows, it makes a call to WSAStartup.
bool NetPlatform_Shutdown()
For every call to NetPlatform_Initalize, there has to be a corresponsing call to NetPlatform_Shutdown. On Windows, this function calls WSACleanup.
NetUDPSocket_*
int NetUDPSocket_Create(uint16_t port)
Creates a new, non-blocking, UDP socket and binds it to the port specified. If the specified port is 0, the socket is automatically bound to an unused port.
bool NetUDPSocket_Close(int socket)
Destroys a UDP socket created with NetUDPSocket_Create.
bool NetUDPSocket_Send(int socket, sockaddr_in/sockaddr_in6 address, const char* data, uint16_t datalen)
Sends a packet of data to the specified address using the specified socket.
bool NetUDPSocket_Recieve(int socket, char* data, uint16_t* datalen, sockaddr_in*/sockaddr_in6* address)
Recieves a single packet from the specified socket. Places the received data in "data", the length of the data returned in datalen, and the address the packet was received from in address.