是否可以使用JavaScript进行实时网络游戏 [英] Is it possible to make real-time network games in JavaScript

查看:132
本文介绍了是否可以使用JavaScript进行实时网络游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用JavaScript制作实时网络游戏?我见过flash做的,但我有兴趣制作一款不依赖于任何插件的基于浏览器的多人游戏。我已经读过,不可能保持Ajax连接为流通信打开,并且每秒进行几次新的Ajax连接以保持客户端与服务器同步是不可行的。

Is it possible to make real-time network games using JavaScript? I've seen flash do it, but I'm interested in making a multiplayer browser-based game that doesn't depend on any plugins. I've read that it is impossible to keep Ajax connections open for streaming communication, and it isn't feasible to make several new Ajax connections per second to keep the client in sync with the server.

推荐答案

使用WebRTC代替WebSockets访问对等和UDP。请参阅此处: WebRTC是否使用TCP或UDP?WebRTC vs Websockets:If WebRTC可以做视频,音频和数据,为什么我需要Websockets?

Use WebRTC instead of WebSockets for access to peer-to-peer and UDP. See here: Does WebRTC use TCP or UDP? and WebRTC vs Websockets: If WebRTC can do Video, Audio, and Data, why do I need Websockets?

这篇关于是否可以使用JavaScript进行实时网络游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆