I want to create multiplayer 2D top-view race game for 2-4 players. For multiplayer this game will use Google Play game services. Players will move their cars by roration device (accelerometer). This data I will send to all participant in room. Its realtime and this type of game needs, as exact as possible, positions and angle of cars for smooth animations, checking for objects collisions, display positions, etc …, so game must refresh fast enough to be smooth and work with given data.
Google Play game services multiplayer messaging has 2 concepts of exchanging game data between clients:
Sending real time message - Reliable (max 50 messages/sec) and Unreliable
Socket-based
Which concept I shoud use for exchanging players data?
I'm doing something like this too and my plan is to build a prototype with Reliable Messaging first and see how that goes. If the latency turns out to be an issue, I'll then step down to Unreliable Messaging, and then if it's really not working out, Socket-based. As with any software project, having a good architecture will allow you to switch protocols relatively painlessly.
Also, there won't be any wasted work by implementing Reliable Messaging and then switching to Unreliable, since the programming required for Reliable Messaging is prerequisite for Unreliable Messaging.
It'll be nice too if someone with experience could answer this question right off the bat with what will and what won't work.
I'm in the process of developing an almost exactly identical game as you've described for my university project. We use AndEngine as the game engine.
We decided to go for Unreliable Messaging because we read that for quickly-updating games like shooters or racing games it's better to use a UDP-like protocol.
We've had 2 approaches:
broadcasting my car's position to all other users - fairly straightforward and reliable, however with ~30 updates per second still not smooth enough,
broadcasting my car's speed and direction whenever there's any change - very smooth results, however with Unreliable Messaging if any packet gets lost it turns out after some time that the position of the same car is different on different users' devices.
I would really like to upvote the issue and ask someone with experience in the matter to contribute :)
Related
first of all i would like to say that beacons seems to be something great and usable, i am very enthusiastic still i saw it for the first time.
Now, i would like to try them and to make an Android app, but i'm confused about some things that i didn't found it clearly on internet:
Are beacons available already?
How much does a beacon cost?
Does it need to be charged ?
How much time can a beacon work without charging?
Do i need to setup every device for interaction with it?
Can i implement beacon in Unity App ?
Is there any tutorials about using it?
I know, post is a little big, but i would be very glad if i will found here answers. Have a nice day! ;)
Are beacons available already?
yes, check out the internet.. radius networks, kontakt.io, estimote etc., you could also hit Alibaba, or buy a raspberry pi and a bluetooth dongle
How much does a beacon cost?
cheap. Small beacons could be as little $1 each, but these have drawbacks like non-replaceable batteries and short range, Bluetooth 5 beacon could be more expensive, but these can cover a 1km radius (personally I think that's pointless). Typically expect around $30 for a "good" or top-tier beacon company's primary beacon choice. If you buy bulk you get cheaper, but you might want to experiment with a few different kinds before you do that. Our company bought like 300 at one stage and we might need to replace them with a different manufacturer now
Does it need to be charged ?
some have replaceable batteries, some are only available to be plugged in, some are just disposable - you need to track that yourself
How much time can a beacon work without charging?
it can't - you may be thinking of NFC here - a Bluetooth radio/antenna requires more power than you might think (but probably less than both of us think to be honest), however it needs a dedicated power source both to transmit and receive data
Do i need to setup every device for interaction with it?
no, you make an app that listens for it. Well.. there are actually lot of options, however, not with straightforward detection/processing. Eddystone promotes a notion of "the Physical Web", which is like using URLs sent by Eddystone beacons to show you the right content, or iPhones actually have more built in support for some (mainly) retail use cases. Android is great because you can do so much in the background, and foreground services give you a lot more say about how and when you are stopped. You should also be aware that 4/5/6/7 all have different caveats around scanning/receiving, but most of the differences will/should be absorbed by any SDK you might use
Can i implement beacon in Unity App ?
certainly, just find a use case (AR/VR and a drone with a beacon for a Dragon? :O)
Is there any tutorials about using it?
so many, google about, but I would recommend starting with Radius Network's Android Beacon Library.(This uses Altbeacon, but is VERY easily changed to work with iBeacon and even Eddystone, also it's free and these guys know their stuff). Also, there are many beacon apps you should download as the consistency is not guaranteed across devices, and a few apps have a few different features that you might want for debugging. Try Locate Beacon (by Radius) NRF Toolbox and basically any other BLE app with a decent score - it can be really good to cross reference the hits when funny stuff starts happening.
A lot of people talk about Beacons and managing them as if it's more complex than it is, you have an object that just screams an ID every X milliseconds, you hear that, you do something with it, once, every X seconds, or whatever you want
I would say you should get very familiar with the difference between BLE/ Bluetooth Smart and regular Bluetooth that interacts via a GATT server. With beacons you're essentially just listening to a peripheral device that advertises in a set format. As the developer, it is up to you to take this and make it meaningful for your user
I'm currently developing a Real-Time Multiplayer top down shooter.
The Multiplayer is "working" and I'm currently struggling with pushing the player updates such as position and fired shots.
My first try was using the service "appWarp" which worked perfectly but isn't free and only provided around 2 Million Messages in the free version which i completely filled in around 2 weeks with only 2 devices and 2 players. ( Maybe way to much updates send )
Then I implemented Google Play Game Services and tried using this to send the updates:
I'm able to use "sendUnreliableMessage" for Position updates, which works faster than appWarp used to. I use interpolation to get over the package loss issue here which works alright.
But here the problem is with firing shots. The nature of UnreliableMessages is that packages can get lost, which happens a lot. Shooting 4 times only makes around 1 or 2 of them appear on the other device. Which means that 2 packages are getting lost. Using "sendRealiableMessage" i can achieve around 2-3 packages getting through but with, of course a higher latency. Which makes the shots appear after around 1 second on the other device.
For a fast paced real time multiplayer game this is not what i wanted to achieve.
So what is a better way to do this ? I found web based solutions like socket.io but don't really know which fits the best for my needs.
I found this website which contains a big list of every web based solution for this problem but don't really know where to start.
https://www.leggetter.co.uk/real-time-web-technologies-guide/#_hosted-realtime-services
I am really really thankful if someone could help me with this problem!.
Since you're asking for opinion, I can suggest you try Multiplayer in Unity. It is the leading game engine as of today, so you can expect a huge support from a stupendous user-base.
Another option would be Photon. Hope these suggestions helps.
So I am working with a quiz game in android where you are supposed to be two players playing against each other on different devices.
I am trying to figure out how the correct way is to set up the server communication to the devices. I want both devices to know when both players has given their answers to a question so they can receive the game result.
My first thought was that both devices will repeatedly ask the server if the other device is finished so they can have the game result. But I start thinking this is a bad idea as it will cause a lot of unnecessary traffic and probably some background performance.
So what is the correct way of doing this?
The Google Android way of doing this would be using Google Cloud Messaging (GCM.) This approach is battery & processor efficient, supports broadcasting up to 1000 users at once and has built in functionality for outdated/expired messages.
http://developer.android.com/training/cloudsync/gcm.html
Of course there are other ways of communicating that may be correct/right/valid but this approach is the best for your specified requirement.
We are developing a synchronous multiplayer game. As it stands one of the players is selected as the server instead of connecting the clients to a dedicated server.
With the restricted environment of mobile apps, should we still be worried about cheating (from the player running the server) or is this a non issue in the mobile space? Are there any other major concerns we should look out for if we decide to stick with players hosting the game?
All of the below is about Android. iOS is more secure, but the server load issue still applies there too.
If you store game data on the SD card, any app can access that data. You could encrypt it, but it would still be a liability (like the Whatsapp hack here: techcrunch.com/2014/03/12/hole-in-whatsapp-for-android-lets-hackers-steal-your-conversations/)
If someone were to implement a low-level interception / modification of your game server network traffic, this could also be a problem. (http://www.justbeck.com/modifying-data-in-transit-to-android-apps-using-burp-and-backtrack-5/)
If you are using a Service, make sure it's a local service so it's only accessible from your app.
Also, the "restricted" aspect of Android systems can be easily removed by rooting the device.
Another thing to consider is network and cpu load. Both these things could grow big very fast, making the server laggy or even crash, considering the relatively low capacities of Android devices as compared to dedicated servers. Of course, this depends on the amount of work the server has to do per client.
In general, dedicated servers are a good idea, even for Android games I think.
I'd look into this from two different point of views:
Cost/Benefit: have in mind that dedicated server will impact your budget, so ask yourself if cheating is really a concern or not. I'd treat mobile space as other kind of spaces.
Game quality: As #1 is your point of view, this is your players point of view... They are going to feel something is going wrong and think about cheating? maybe. You can fix this with a reputation of the player that is hosting the server.
We are developing an android app, and i need some analytics to track usage patterns in real-time. I tested several analytics and found out that most like Google and Flury cannot work in real-time, and so far the fastest real-time android analytics I tried seems Includeapp.
Does anyone have actual experience using the Includeapp API for this purpose? For example, is it best to track fewer events to speed up things, etc..?
Includeapp tracker engine is flexible enough to track hundreds of events in
real-time. Experimentally, the best case scenario with say 100 events
of events per second is a round-trip time of about 100-200
milliseconds. The worse case scenario, with several hundred events is
less than 4-5 seconds end-to-end.