实现一个回合制网页游戏

发布于 2024-10-20 20:26:21 字数 195 浏览 11 评论 0原文

我想实现一款回合制网络游戏。我现在的第一选择是战舰。没什么太复杂的,但仍然很有趣。我想要的一些功能是能够邀请玩家参加游戏,能够与潜在的对手聊天,以及在开始游戏后能够与对手聊天。我想我需要某种推送通知来更新你的对手棋盘、跟踪统计数据等。我做了一些研究,现在似乎最有效的方法是使用类似的东西彗星。我正在寻找一些关于使用什么语言以及应该从哪里开始的建议。

提前致谢!

I want to implement a turn-based game for the web. My first choice right now is Battleship. Nothing too complicated but still something decently fun. Some of the features I want are being able to invite players to games, being able to chat with potential opponents, and being able to chat with your opponent once you've started a game. I'm thinking that I'm going to need some sort of push notifications in order to update your opponents board, keep track of stats, etc. I've done a little research and right now what seems would work best is using something like Comet. I was looking for some suggestions on what languages to use and where I should start.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

剩余の解释 2024-10-27 20:26:21

我目前正在制作基于网络的 Tic-Tac-Toe,使用 进行绘画,使用 WebSocket 进行聊天和多人游戏。后者允许您与服务器建立实时连接,该服务器可以直接将所有数据发送给对手。这当然令人兴奋。我使用 Nugget 作为服务器 (C#)。

I'm currently making Tic-Tac-Toe webbased using <canvas> for painting and WebSocket for chatting and multiplayer playing. The latter allows you to have a live connection to a server which can directly send all data to the opponent. It's certainly exciting. I use Nugget for the server (C#).

伴随着你 2024-10-27 20:26:21

我认为这取决于很多事情。

我有一些建议,但也许有人有更好的。

我开始编写游戏xo。 (不知道英文名字)你必须把五个 o 或 x 排成一行。这也是回合制的。我的 php 代码只有几百个,javascript 代码也很少,但游戏速度非常慢。在 2player 模式下,请求-响应有时会达到 1-2 秒,但服务器在我的桌面上。所以实际上不需要转移时间。

我认为如果你创建一个轻量级游戏,用简单的计算php是非常好的,易于开发,也是OOP。

但我认为用 C++ 或 C# 创建本机服务器端程序的最佳方法。

我非常疯狂,我沉迷于速度:D所以我创建了一个简单的C++套接字和ajax通信实现,我将我的apache网络服务器特定目录重定向到我的程序,我用我的程序响应,所以我能够创建请求和响应之间有 4-5 毫秒的差异。

如果你想为大约100名玩家创建一个更大的游戏,我认为原生程序更好,因为你可以将数据存储在RAM中,你不需要每次都执行mysql查询,你可以轻松存储数据,但是你有创建一个通过 HTTP 进行通信的接口。

i think it depend on many things.

i have some suggestions, but maybe somebody has better.

i started to code a game x-o. (dont know the name in english) you have to put five o or x in a row. this is also turn based. i had only few hundred codes in php and little more in javascript, but the game was very slow. in 2player mode, the request-response hit the 1-2 seconds sometimes, but the server was on my desktop. so no transfer time is needed actually.

i think if you create a lightweight game, with easy calculatons php is very good, easy to develop, also OOP.

but i think the best way to create a native server side program in c++ or c#.

i am very insane and i am addected to speed :D so i created a simple implementation of c++ sockets and ajax communications, and i redirected my apache webserver particular diretory to my program, and i responded with my progrram, so i was able to create 4-5 milisecdifference between request and response.

if you want to create a little more big game for aboute 100 player, i think native program is better, because you can store data in the RAM you dont need to execute mysql querys for every time, you can easily store dat, but you have to create a interface to communicate via HTTP.

新人笑 2024-10-27 20:26:21

我会看一下nodejs (nodejs.org)。 Node 是一个高度可扩展的服务器端事件 io 框架,构建在 V8 javascript 引擎之上。有一个名为socket.io的节点库,它使浏览器推送通信变得非常容易。 Nodesocket.com 还正在开发一项新服务,该服务将使您的项目部署变得轻松。

您可能还想查看诸如processing.js (http://processingjs.org/)之类的东西,用于在浏览器画布上绘制游戏。

I would take a look at nodejs (nodejs.org). Node is a highly scalable server-side evented io framework built on top of the V8 javascript engine. There is a node library called socket.io that makes browser push communication very easy. There's also a new service being developed at nodesocket.com that will make deploying your project painless.

You might also want to check out something like processing.js (http://processingjs.org/) for drawing your game on a browser canvas.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文