且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何制作网络多人游戏?

更新时间:2023-02-02 17:58:48

您不能在不使用服务器的情况下创建MMOG或MMORPG,但是可以通过保留一个玩家作为服务器来创建简单的两人游戏.

让我在这里提出一个想法.您创建了一个可执行文件,该文件可以打开一个玩游戏.
1.玩家1开始游戏并生成邀请令牌,IP地址和端口信息,并使用电子邮件将邀请发送给其他玩家.

2. Player 2从电子邮件中获取此信息,并将其输入可执行文件,然后可执行文件使用TCP/IP连接到ip地址和端口.

3.现在,当Player 1可执行文件收到来自Player 2的通信时,它将使用身份验证令牌验证身份.

4.身份验证完成后,将使用TCP/IP套接字终止它们,然后继续播放.

缺点:

1.需要静态IP
2.需要为暴露的端口打开防火墙.
3.电子邮件身份验证不是可靠的形式.
You cant create a MMOG or MMORPG without using a Server,but you can create a simple two player game by keeping one of your player as the server.

Let me put an idea here.You create a executable which playe one opens to play the game.
1. Player 1 starts the game and generates the invitation token,ip address and port information and sends out invitation to other player using email.

2. Player 2 takes this information from email and feeds into the executable which inturn connects using TCP/IP to the ip address and port.

3. Now when the Player 1 executable receives the commincation from Player 2 it verifies the identity using the authentication token.

4.Once authentication comples they are conencted using TCP/IP Socket and continue playing.

Disadvantages:

1. Need Static IP''s
2. Firewall need to be open for the Port exposed.
3. Email authentication is not reliable form.