开发者

Implementation of Multiplayer game - Jquery Application Level?

开发者 https://www.devze.com 2023-04-02 00:18 出处:网络
Good day! I am planning to create a multiplayer board game using java, jquery, dwr, ajax. In my java, i will store data into application level. Using dwr and ajax, I can retrieve data without the nee

Good day!

I am planning to create a multiplayer board game using java, jquery, dwr, ajax. In my java, i will store data into application level. Using dwr and ajax, I can retrieve data without the need to refresh my browser and do JQuery animation accordingly. My problem is, If there are many players, how can the JQuery animation automatically changes for everyone to see it without the need for them to refresh their browser.

For example, player 1 is on grid(1,1). My code will allow player 1 to go to grid(1,2), grid(1,3) etc. using Jquery with corresponding animation. But the other player(u开发者_StackOverflow中文版sing another browser) will not be able to see this. How can i make the other player see it? Is it possible that the second player is also accessing the browser of player 1 remotely? Any suggestions/books/articles/code samples regarding this would do.

Thank you.


1) You can do it with Ajax by calling ajax calls every second for every user to check if there are changes on board.

2)To not to make many ajax calls you can use Comet.

3)From performance view the best way is to make TCP server and use sockets. You can use Websockets or Flash socket proxy.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号