Currently I have made a flash/as3 Snake game which I want to somehow make it online. So that players can all play together online at the same time.
But my question is, how can I get the informations of the other players? To the players game?
Like when someone move down/up/left or right, how can I get that to show on the other players screen?
You'll need a server that all players are connected to, either via persistent Socket or RTMP connection. Basically your SWF sends information about the players move to the server, which then passes it to all the other connected players.
You can either build such a server by your own, or use existing technoligies like for example FMS, SmartFox or Red5 (here you can find some more).
Related
I'm creating a game with HTML5 and javascript, but am having trouble finding a way to get networking working.
What I want is for one instance of the game to listen on a Websockets/http stack, while the other instances connect to it.
So far, I'm yet to find any way of doing it that doesn't require additional plugins or online services. (ie: Flash or silver light opening the socket and pumping messages back - Something that isn't acceptable for mobile, or an online server like Player.IO, which while much better than Flash, wouldn't work for Wifi networks that are disconnected from the Internet)
While the latter option is a compromise I'm willing to make, I was wondering if it's one I need to make, or if I could survive without it.
Well, if I understand what you are trying to, hope to be right.
Client One:
Plays game, listens to incoming data from Client Two
Client Two:
Plays game, connects to Client One
I'm guessing it's a P2P game? If this is the case, I think you want to look at WebRTC.
Otherwise, peer-to-peer is not really possible unless you run a mediator service that both clients connect to and handle it as a dispatcher.
I was wondering if it's possible to have a music player that will always play music even that the user is not on the site.. Kinda like streaming...
I am using jwPlayer but every time I enter the site my playlist starts from the beginning but I want her to keep playing even if I'm not there..
if there is anyway to do that please tell me..
Thanks in advance
You would need to have a virtual state that the server keeps track of. You would not really be streaming if you don't have a target device to stream to... so the server just needs to keep track of everything then continue streaming at the location you expect when the person reconnects to the server by whatever device they are using.
I'd like to know if I have downloaded (loaded to my computer) any big flash game like Evony or so where does it do the counting? I mean in the flash files which I have dowloaded to my computer, will there be the counting functions where it counts everything like attacking, defensing, etc.
The above is just an example, it could be any big flash game. The question remains the same. Where does these games do the counting part. It is in those flash files or it is somewhere else on their server which I can't see?
That depends of the game and the developers that make them. As rule of thumb for network games is that everything that needs to be stored or process in any way, like counting - is to do it on the server. The Flash player is considered insecure, because it can be easily hacked, so every action in the game that is significant needs to be executed on server, because they are harder to hack.
Again, this really depends on the choices of the developers, how they will structure the game. So you can't really know unless they tell you or you hack the flash code and see it for yourself.
Im wondering if it is possible to output sound to both headphones and built in speakers at the same time. Iv searched but all i can find is references to possible attemps using android. but my application will be web based, using flash and AS3. Can anyone confirm if this is possible or not?
essentially im trying to make a set of DJ decks, and thus need to be able to listen to 2 sounds separately but at the same time (to beatmatch)
Many Thanks
Andy
No, not without a very specific setup. Flash will only output one, globally mixed audio stream from the application. You cannot separate your sounds to be routed to separate outputs.
However, if you're not looking for a general setup but rather a one-off thing where you are able to control the machine it is supposed to be running on - there could be a way. If you are writing an Adobe AIR app, you could write two separate apps:
App A controls the UI and all the sound
App B just receives a sound stream from the first app and plays it
App A then routes the "headphone track" to App B and plays the "main track" as normal.
You could then (maybe) use an application such as Soundflower to route the sound from App A and App B to separate outputs (where one could be the headphones and the other would go to some speakers.)
This all is very dependent on your sound card. You'll most likely need an external sound card to handle the two separate audio streams.
I'd like to build a 2-player turn based game with an authoritative server to manage the game state/logic. The flow I have in mind is something like:
Players are subscribed to a unique game channel (via pubnub/pusher/something similar)
Players submit their turns over HTTP directly to the game server
The server runs the game logic and publishes the result to the game's channel (which both players are subscribed to)
The client handles the response and renders the outcome
matchmaking kind of confuses me though. Any suggestions?
Is that the "right" way of using a pub/sub service in this scenraio? Is there a better approach (something other than polling the server constantly)?
This is a heated topic at our office! I've been using PubNub as an authoritative game server using creative choice of channel names. It works like this:
Run a node.js server (doesn't have to be node; can be anything) that serves your content, and also acts as an authoritative entity.
When a client connects, generate a UUID (can be done either server-side or client-side) and have both the client and server listen on that channel (something like "my_game_[UUID]").
Because no other clients know this channel name, the client and server can communicate freely on this channel.
The server can talk to everyone, and clients can perform secure actions through the server and communicate with each other using an "unsecure" vanilla pubnub channel.
Your proposal sounds great and is the "right" way. The challenge you face is shared from the beginning of the computer epoch, where synchronizing data is a requirement between multiple devices such as a mobile smartphone. Polling is SLOW and expensive (and does not make sense for a large number of players). Multiplayer games is a great example need to pair players and provide game rooms. Your solution is to:
Create a Game Lobby, where players can create game rooms and join game rooms.
Create an Auto-Pair of players (Quick Join) [Recommended]
You may solve this technical challenge with products such as Socket.IO and some other open source options. However you want to just build your game rather than focus on deploying a Node.JS server and hooking it up to Express.
Instead use a Cloud Service like PubNub, PusherApp or Beacon Push. Utilize the Pub/Sub API to synchronize users in a multiplayer environment easily.