我正在开发一个基本的MMORPG使用统一引擎。我需要一个简单的解决方案(库,框架)来制作一个高效的服务器。完成这项任务的最佳方法是什么?
发布于 2015-12-31 06:15:06
最初的帖子是这里。
- [Using SmartFox with C# (I) : Installations and 1st handshaking](https://xinyustudio.wordpress.com/2015/09/14/using-smartfox-with-c-i-installations-and-1st-handshaking/)
- [Using SmartFox with C# (II) : Login and join room](https://xinyustudio.wordpress.com/2015/09/14/using-smartfox-with-c-ii-login-and-join-room/)
- [Using SmartFox with C# (III) : Frequently used functions](https://xinyustudio.wordpress.com/2015/09/14/using-smartfox-with-c-iii-frequently-used-functions/)
具体来说,您可以连接到smartfox服务器,并在连接时得到通知:
private SmartFox client;
private string serverIP = "127.0.0.1";
private int serverPort = 9933;
private string zone = "BasicExamples";
client = new SmartFox();
client.ThreadSafeMode = false; //true for Unity3D
client.AddEventListener(SFSEvent.CONNECTION, (evt) =>
{
bool bSuccess = (bool)evt.Params[“success”];
Console.WriteLine(client.IsConnected ?
“Successfully connected to SmartFox Server” :
“Failed to connect to SmartFox Server”);
});
client.Connect(serverIP, serverPort); 登录成功后登录并上钩:
var request = new LoginRequest("UserName", "Password", zone); //[1]
client.Send(request); //[2]
client.AddEventListener(SFSEvent.LOGIN, (evt) => { //[3]
Console.WriteLine("The User login success");
});
client.Connect(serverIP, serverPort); 2. 光子是另一种流行的后端服务器/服务。
光子服务器为您提供了多人游戏的统包框架。从零开始,或者在源代码中包含的几个示例应用程序之上构建自己的自定义逻辑,并使用免费服务器SDK。这可以让你快速而轻松地获得巨大的结果。
用于安装连接的代码段:
using UnityEngine;
public class RandomMatchmaker : MonoBehaviour
{
void Start() {
PhotonNetwork.ConnectUsingSettings("0.1");
}
void OnGUI(){
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
}
} 会客室/大堂代码片段:
public override void OnJoinedLobby()
{
PhotonNetwork.JoinRandomRoom();
}用于安装日志记录的代码片段:
PhotonNetwork.logLevel = PhotonLogLevel.Full;用于错误处理的代码片段:
void OnPhotonRandomJoinFailed()
{
Debug.Log("Can't join random room!");
PhotonNetwork.CreateRoom(null);
}关于这个主题的一个很好的教程可以找到这里。
3. Firebase可能是第三种选择,但其表现可能还不清楚。
4.其他(OpenSpace、RedDwarf、ElectroServer、Player.IO、Red5、Mesmotronic多用户服务器等)
查看此 伟大的职位 以获取详细信息.
https://stackoverflow.com/questions/34541869
复制相似问题