问题描述
Hello Codeproject,
你可能知道或者可能不知道我在过去一年左右开发游戏,我终于准备开始让它在线。
然而,在我完成基础工作(工作服务器和客户端)后,我开始研究移动系统,以便两个客户都知道他们都在搬家。
这段代码基本上如下:
>客户1移动。
>客户端1将数据包发送到已移至的服务器。
>服务器将相同的数据包发送给客户端2.
>客户端2读取数据包并更新另一个客户端的实体。
一切都完成后,我看到了结果,他们有点让我跳了起来。另一个玩家的FPS似乎大约是5,如果不是更少,这是因为将数据包发送到服务器并返回到另一个客户端。
现在为什么.NET这么慢?因为这不是我的朋友,这是我的电脑到我的电脑到我的电脑。
有没有人有任何可能有助于解决这个问题的解决方案?因为我看到像Minecraft,Team Fortress 2这样的游戏具有更复杂的功能,并且它们在适当的服务器上没有任何移动延迟。
所有的问候,
- Deviant
Hello Codeproject,
As you may or may not know I've been developing a game for the past year or so, and I am finally ready to start making it Online.
However, after I had gotten the basics done(Working Server, and Client) I started working on the movement system so that both clients were aware that they both were moving.
This code is basically the following:
> Client 1 Moves.
> Client 1 Sends a packet to the server where it has moved to.
> Server sends the same packet to Client 2.
> Client 2 reads the packet and updates the other client's entity.
After everything was done, and ready I saw the results, and they kinda made me jump. The FPS of the other player seemed to be about 5 if not less, and this is because of the sending of the packets to the server and back to the other client.
Now why is .NET so slow? Because this wasn't me to my friend, this was my computer to my computer to my computer.
Does anyone have any solutions that might help fix this problem? Because I see games such as Minecraft, Team Fortress 2 whom have more complex features, and they don't have any movement lag on a proper server.
With all the regards,
- Deviant
推荐答案
这篇关于.NET TCP客户端/服务器太慢了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!