我目前正在建造我的第一個網站只是爲了練習。我在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應用程序時,網絡通常如何完成?