gpt4 book ai didi

客户端-服务器游戏算法

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:20:20 26 4
gpt4 key购买 nike

对于单机游戏,基本的游戏循环是(来源:维基百科)

while( user doesn't exit )
check for user input
run AI
move enemies
resolve collisions
draw graphics
play sounds
end while

但如果我开发类似客户端-服务器的游戏,如 Quake、Ragnarock、Trackmania 等,会怎样

游戏的客户端和服务器部分的循环/算法是什么?

最佳答案

应该是这样的

客户:

while( user does not exit )
check for user input
send commands to the server
receive updates about the game from the server
draw graphics
play sounds
end

服务器:

while( true )
check for client commands
run AI
move all entities
resolve collisions
send updates about the game to the clients
end

关于客户端-服务器游戏算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/811906/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com