我目前正在建造我的第一个网站只是为了练习。我在HTML5和JavaScript中扔了一场pong的快速游戏。我想知道如何才能把它变成网络游戏。与HTML5,Javascript和AJAX网络游戏。这会工作吗?
有没有什么能够阻止我说出来,将用户登录到我的网站,将他们的信息存储在sql数据库中,然后查找另一个登录并等待玩我的游戏的人。要处理网络,我可以创建一个sql数据库并使用AJAX将新信息发布到专门处理网络的表中?
这里是什么,我一直在集思广益的视觉例如:
[sql table: network]
[logged in user: Josh] [Josh paddle position Y]
[logged in user: Tim] [Tim Paddle position Y]
Use Ajax XMLHttpRequest to post Josh paddle position Y and Tim Paddle Position Y
to the network table, updating each client's screen accordingly (maybe use XMLHttpRequest.responseText to get the other person's information)
delete network table when both users have left the game
无论如何,如果你不认为这种方法会工作,你可以点我也许是正确的方向?我对网络编程还很陌生,所以也许我很想理解Ajax的工作方式。当涉及到Web应用程序时,网络通常如何完成?