如何在 ActionScript for Blackberry Playbook 中创建多人射击游戏?

发布于 2024-11-01 23:41:00 字数 182 浏览 1 评论 0原文

在 Actionscript 中构建多人游戏的良好框架是什么?

我想创建一款多人 2D 射击游戏,例如 Blackberry Playbook 上的 Asteroids;我主要担心的是延迟——如果子弹超级不稳定并且意外击中人,那么射击游戏就不会那么有趣。

我猜想基于 UDP 的框架是最好的。有人能指出我正确的方向吗?

What is a good framework to build a multiplayer game in Actionscript?

I want to create a multiplayer 2D shooter like Asteroids on the Blackberry Playbook; my main concern is latency - a shooter wouldn't be fun if the bullets are super-jerky and unexpectedly hit people.

I'm guessing that a UDP-based framework would be the best. Can anyone point me to the right direction?

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

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

发布评论

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

评论(4

自由如风 2024-11-08 23:41:00

您可以使用很多现成的东西,但基本设置非常简单,但您有一些选择。

最常见的是服务器推送,Flash Media Server、Adobe 的 LiveCycle Data Services 等工具或 SmartFoxServer 等其他工具都可以做到这一点。通过此设置,服务器会保存与连接到服务器的每个人的连接,并在每次应用程序中的数据发生更改时将应用程序状态传递或“推送”给连接的人员。

另一种选择称为长拉,这实际上可以通过任何 Web 服务器来完成。其工作原理是数据存储应用程序的状态,当应用程序启动时,它调用服务器,当它响应时,客户端再次调用服务器。

还有一些其他方法可以做到这一点,但这些是最常见的。但这与 HTTP、UDP、AMF、XMPP 或其他协议无关。协议是发送数据的格式。使用这些开箱即用的服务器,它们通常会输出其中的一些格式,但最快的格式是像 AMF 这样的二进制格式,但并不总是最好的,每种格式都有优点,因为每种格式都为您提供了不同的功能来跟踪事物。

如果您正在谈论一款拥有数百万用户的占领世界的游戏,那么您需要考虑扩展以及当您需要两台或 100 台服务器时会发生什么以及它们如何相互通信。但现在请记住,服务器执行的操作越多,速度就越慢,如果您发送少量数据,它将能够处理更多用户。坚持制作一台高效的服务器,如果你到达那里之后再担心这一点。

您还需要考虑您想要使用哪种服务器端编程语言(如果有)。有些服务不允许你做任何事情,这些服务通常要花钱,而且做不了那么多。 Adobe 喜欢 Java,但也有一些服务器可以以几乎每种语言输出所有这些协议。我最近最喜欢的是 Node.js 一种在服务器上运行 JavaScript 的超快速方法。 Node.js 有一个内置的 HTTP 服务器,但创建一个通过 SocketXMLSocket。像这样的服务器可以轻松处理数千个用户。有许多游戏使用 Socket.IO,如果您想查看我正在谈论的简单示例,您可以 看看这个。

There are many things you can use off the shelf but the basic setup is very simple but you have a few options.

The most common is server push, things like Flash Media Server, LiveCycle Data Services from Adobe or other tools like SmartFoxServer can do this. With this setup the server saves the connections to everyone that connects to the server and passes or "pushes" applications state to the people connected every time the data changes in the application.

Another option is called long pulling, this can be done with any web server really. How this works is the data stores the state of the application, when the application starts it calls the server, when it responds the client calls the server again.

There are a few other ways to do it but these are the most common. But this has nothing to do with protocol like HTTP, UDP, AMF, XMPP, or whatever else. The protocol is the format that the data is sent. With these out of the box servers they normally output a few of these but the fastest formats are binary like AMF but not always the best, there are advantages to each, because each gives you different features for keeping track of things.

If you are talking about have a game that takes over the world that has millions of users then you need to think about scaling and what happens when you need two or 100 servers and how do they talk to each other. But for now keep in mind that the more the server does the slower it will get, if you are sending small amounts of data it will be able to handle more users. Stick with making one efficient server and worry about that later if you get there.

You also need to thing about what server side programming language you want to mess with if any. Some services don't let you do anything, these normally cost money and don't do as much. Adobe likes Java but there are servers that output all of these protocols in most every language. My favorit lately has been Node.js a super fast way to run JavaScript on the server. Node.js has a built in HTTP server but it is just as easy to create a simple server that sends basic text through a Socket or XMLSocket. A server like this will easily handle many thousands of users. There are many games that use Socket.IO and if you want to see a simple example of what I'm talking about you can check out this.

活雷疯 2024-11-08 23:41:00

假设您想使用 Flash/Flex 而不是 Java (Blackberry/Android) 或 Playbook 的本机 SDK -

  1. 有一本书作为灵感:http://www.packtpub.com/flash-10-multiplayer-game-essentials/book 它在服务器上使用 Pulse SDK 边。但是您可以在服务器端使用自己的套接字程序。我在小型纸牌游戏中使用 Perl 作为 TCP 套接字服务器(发送压缩后的 XML),但是这对你的射手不起作用。

  2. Flash 不支持开箱即用的 UDP

  3. 但即将推出的点对点网络协议 RTMFP < a href="http://www.adobe.com/products/flashmediaenterprise/" rel="nofollow">Flash Media Server Enterprise 4(价格对于普通人来说是遥不可及的)

所以你最好的选择是购买 RTMFP 的 Amazon 服务 然后您可以按使用付费并保持可扩展性...

Assuming you want to use Flash/Flex and not Java (Blackberry/Android) or native SDKs for Playbook -

  1. There is a book as an inspiration: http://www.packtpub.com/flash-10-multiplayer-game-essentials/book it uses Pulse SDK at the server side. But you could use an own sockets-program on the server side. I use Perl as TCP-sockets server (sends gzipped XML around) in a small card game but this wouldn't work for your shooter.

  2. Flash does not support UDP out of the box

  3. But there is peer-to-peer networking protocol RTMFP in the upcoming Flash Media Server Enterprise 4 (price is out of reach for mere mortals)

So your best bet is to buy an Amazon-service for RTMFP then you can pay-per-use and stay scalable...

拿命拼未来 2024-11-08 23:41:00

您可以向服务器发出持续的 post/get 请求来获取游戏数据,但对于多人射击游戏,我会使用 SmartFoxServer: http://www.smartfoxserver.com/

You can either do a constant post/get request with the server to get data for the game, but for a multiplayer shooter i'd surgest SmartFoxServer: http://www.smartfoxserver.com/

往事随风而去 2024-11-08 23:41:00

Adobe AIR 通过数据报包支持 UDP,开箱即用。
http://help.adobe.com/en_US/air /reference/html/flash/net/DatagramSocket.html

我找不到适用于 flash 的特定网络 API,但也许您可以构建一个。 Libgren 是开源的,您可以参考它。

您还可以研究 RTMFP,尽管它的重点是传输音频/视频和一些消息(我认为是通过 TCP)。

Out of the box, Adobe AIR supports UDP through datagram packets.
http://help.adobe.com/en_US/air/reference/html/flash/net/DatagramSocket.html

I couldn't find a particular networking API for flash, but perhaps you can build one. Libgren is open source and you can use that for reference.

You can also look into RTMFP though it's focus is on transmitting audio/video and some messages (through TCP I think).

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