Which exact topics do I need to do research on in order for me to do something simple as: sending live finger sliding data co-ordinates across the screen to another iOS device over the internet and vice versa?
Take two clients, how can I create a live connection between the two so that when user A, slides his finger across his screen user B should then be able to see where user A is sliding his finger in the form of a dot for example, that too live and vice versa when user B slides his finger across on his iDevice.
A tutorial would be great.
You need to use TCP or UDP IP networking and send the data across in some form that each end can recognize. The easiest way I've found to deal with that in iOS is to use GCDAsyncSocket, a 3rd-party library you can download. The difficult part is that you cannot send the data directly between two iPhones across the Internet, as opposed to across the LAN, without a relay server (which you would need to program) in between unless you use some kind of NAT transversal.
And, of course, you'll need to know Cocoa Touch (AKA iOS programming).
Related
In a World of Warcraft Vanilla Lua Addon Development, how can I issue an HTTP call to receive data back? If not, how can I get data from a web source into the game while playing?
I have a feeling the answer is tragically short, but would like the question asked and answered on Stack Overflow. My research came up lacking, and I recall doing some LUA in ~2007 and was disappointed.
Well, tragically short is an understatement. You simply can't. There was never any APIs that interacted directly with connections, let alone create any, let alone to arbitrary URLs.
Most of them just broadcast game events that occur from the game's connection, and the closest thing you can get to a "data stream" is add-on chat channels. But since bots violate the ToS, you wouldn't be able to make an account that responds to your addon's inquiries.
The closest thing you can get is building an "asynchronous mesh network", but that's only good if your addon has a considerable user base, and it's not guaranteed you'll get information timely.
The general idea is that your addon will have a public key (as in encryption), and you (only you) will detain a private key. Your addon emits a message to any connected peers, which store it on cross-realm SavedVariables, and you hope that someone will have characters on more than one realm. Upon login, the client addon will broadcast its latest packet (still encrypted) to that realm's addon channel, and hopefully within a week or so you might get the updated information across all clients.
A disadvantage is that you'll only get "push" notifications, the client won't be able to send any data back to you*.
That, or you could release a patch for the addon on Curse :P
BUT WAIT!
You mention vanilla, so I can presume you're developing this for a private server. Private servers often have one or a very small amount of realms, making the above mesh network much simpler. Instead of a mesh, just have encryption and manually login&broadcast on each realm every time you want to update the information retrieved.
Plus, you might even be able to contact the server devs to allow you an API that sends messages to the appropriate ingame addon channel (you'd have to ask).
Of course, if you pretend to make your addon server-agnostic, instead of tailored to a specific server, you're back to square one.
* Unless you are really dedicated to make that happen, because it's a ton of work.
There is no web API in vanilla WoW. There is a web browser widget in the game currently though, albeit very limited in usage.
If you have access to the server software code, you may be able to hook listening on specific game channels for user messages in a defined format, and let the server respond in a way for the addon to parse it.
I'm new to Swift and native iOS Development in general, and I'm trying to making an app which allow two or more users to send and receive in real time data about something (such as a line path), similarly to what happen in multiplayer games. It isn't a game, by the way. Let's make an example:
Let A and B be two users.
There is a canvas on this app, for example.
A can draw a line (which should be an array of points) and B see what A is drawing in real time (so B receive the array).
As I said, it's similar to what happen in multiplayer games (but here I don't want a server to manage what people do, I'd like something like P2P or a direct connection between devices).
How should I manage this?
we are working on a game with real-time matches. 2 players. 1 against 1.
I have to define a list of items in common between the 2 players before the game start.
It's not really a problem in the case of 1 player invite another. In this case i can define the player receiving the invite as the "client". The app of the "server" player will generate the list.
But in the case of an "auto-match" not sure how i can define this kind of relationship between my players as the same code is going to run the same way on the two instance of the apps.
Edit:
Will try this idea:
Will use a timeelapsed between beginning of the connection and the accepted connection. Exchange the data between users and determine which one should be consider as master/server.
Will post a detail example if the implementation working.
Meanwhile, still opened to any others suggestion.
In peer-peer networking, each device can function as the server. Make your networking client/server agnostic once the connection is made so that it doesn't matter.
I had that same problem and ended up defining my own network classes on top of AsyncSocket so that I could communicate in a middle layer. It's here if you're interested:
github link here
It suited my needs and it may give you some ideas.
I'm writing a FPS XNA game. It gonna be multiplayer so I came up with following:
I'm making two different assemblies — one for the game logic and the second for drawing it and the game irrelevant stuff (like rocket trails).
The type of the connection is client-server (not peer-to-peer), so every client at first connects to the server and then the game begins.
I'm completly decided to use XNA.Framework.Game class for the clients to run their game in window (or fullscreen) and the GameComponent/DrawableGameComponent classes to store the game objects and update&draw them on each frame.
Next, I want to get the answer to the question:
What should I do on the server side? I got few options:
Create my own Game class on the server, which will process all the game logic (only, no graphics). The reason why I am not using the standart Game class is when I call Game.Run() the white window appears and I cant figure out how to get rid of it.
Use somehow the original XNA's Game class, which is already has the GameComponent collection and Update event (60 times per second, just what I need).
UPDATE:
I got more questions:
First, what socket mode should I use? TCP or UDP? And how to actually let the client know that this packet is meant to be processed after that one?
Second, if I is going to use exacly GameComponent class for the game objects which is stored and processed on the server, how to make them to be drawn on the client? Inherit them (while they are combined to an assembly)? Something else?
First of all, your game logic should be on the server.. Not only does that prevent cheating, but it also garantees consistency, especially over random operations. The clients should only be sending their inputs to the server
I'd recommend your keep the server's window visible to make it a debug console, you'll need it, to know what your server is doing exactly.
For a FPS, UDP is recommended. You'll be sending a lot of data and you don't really care if your packets are all received or ordered. While the packets are not garanteed to arrive ordered, you don't really have to worry about it. Most of the time, they will arrive in order anyway. Let's say you send 60 frames per second to your clients and one of your packet arrives in the wrong order: Your client will have erroneous information for 1/60th of a second, which is barely visible.
Finally, you should send a serialized representation of your game state multiple times per second to your clients. They should be able to retrieve that information and draw it the same way as your server. You could even serialize your gamecomponent and send it if you think that's appropriate. It's really up to you to decide.
Hope this helps!
When programs such as Skype streams video from a user to another and vice versa, how is that usually accomplished?
Does client A stream to a server, and server sends it to client B?
or does it go directly from client A to B?
Feel free to correct me if i am way off and none of those is correct.
Skype is much more complicated than that, because it is Peer to Peer, meaning that your stream may travel through several other skype clients, acting as several servers. Skype does not have a huge central system for this. Skype always keeps track of multiple places that it can deliver your stream to, so that if one of these places disappear (that Skype client disappears), then it will continue sending through another server/skype-client. This is done so efficiently, that you don't notice the interruption.
Basically , this is how its achieved.
1) encode video / audio using the best compression you can get. Go lossy compression and plenty of aliasing to throw away portions of video and audio which is not usable. Like removing background hiss
2) pack video / audio into packets and put a timestamp on them. The packets are usually datagrams.
3) send packets directly to destination. Use the most appropriate route. You dont have to send all packets the same way. Use many routes if possible. P2P networks often use many routes to the same destination
4) re-encode on the destination. If a packet is too old , throw it away. If packets are lost , dont bother about it since its too late.
5) join the video back and fill in the missing frames the best you can.