算法的客户端 - 服务器游戏 [英] Algorithm for Client-Server Games
本文介绍了算法的客户端 - 服务器游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有关单机游戏,基本的游戏循环是(来源:维基百科)
For stand alone games, the basic game loop is (source: wikipedia)
while( user doesn't exit )
check for user input
run AI
move enemies
resolve collisions
draw graphics
play sounds
end while
但是,如果我开发客户端 - 服务器般的游戏,像地震,此Ragnarock,赛道狂飙等,
But what if I develop client-server-like games, like Quake, Ragnarock, Trackmania, etc,
什么环路/算法客户端和游戏服务器配件?
What the Loop/Algorithm for client and the server parts of the game?
推荐答案
这会是这样
客户端:
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
这篇关于算法的客户端 - 服务器游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文