Added high level networked multiplayer to Godot.

It's complete, but absolutely and completely untested, undocumented and NSFW.
Have fun :-)
This commit is contained in:
Juan Linietsky
2016-08-14 18:49:50 -03:00
parent 01bdfe1ff6
commit 3db36684b1
7 changed files with 698 additions and 5 deletions

View File

@ -81,6 +81,8 @@ Error NetworkedMultiplayerENet::create_client(const IP_Address& p_ip,int p_port,
//technically safe to ignore the peer or anything else.
connection_status=CONNECTION_CONNECTING;
active=true;
server=false;
return OK;
}
@ -144,7 +146,13 @@ void NetworkedMultiplayerENet::poll(){
}
}
void NetworkedMultiplayerENet::disconnect() {
bool NetworkedMultiplayerENet::is_server() const {
ERR_FAIL_COND_V(!active,false);
return server;
}
void NetworkedMultiplayerENet::close_connection() {
ERR_FAIL_COND(!active);
@ -258,6 +266,6 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet(){
NetworkedMultiplayerENet::~NetworkedMultiplayerENet(){
if (active) {
disconnect();
close_connection();
}
}