Generic C memory compression / packing
#1 Members - Reputation: 205
Posted 04 April 2012 - 05:12 PM
#2 Moderators - Reputation: 7773
Posted 04 April 2012 - 06:07 PM
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
#3 Members - Reputation: 1283
Posted 04 April 2012 - 09:55 PM
CPU intensive for who? The client is basically just sending input that might only a be a few bytes. It depends on how twitchy your game is, but since you mentioned mobile I'll assume it's not a 400 apm RTS game. Then for getting the state I'm imagining a fixed update rate that's fairly low like 200 ms at the most? (5 updates per second). Assuming you're not updating hundreds of units at once and are doing sane delta updates I don't think you'd hit anything that would be that CPU intensive to deserialize coming from the server.The only thing I could find was an article here http://sirisian.com/.../binary-packet/ but it is regarding packing bit by bit, which I am not going to do since I think it would be too CPU intensive for a mobile game.
That said I wrote these two writers. C++ version. C# version. They are simple binary writers/readers which I wrote for someone that was developing between languages. Basically what's going to help you more than anything is sane delta compression. Not sending anything the client already knows about. Your server should be 100% aware of what the clients know and intelligent in building the per client packets. (I'd give you more information, but I removed my old articles online relating to this so I could rewrite them. Been meaning to get back to that).
// edit also I see my robots.txt isn't stopping people from finding my blog. Interesting.
#4 Members - Reputation: 205
Posted 05 April 2012 - 07:36 AM
I'm thinking using delta updates and only updating quickly for units in the clients currently active viewport will hopefully be enough to limit the bandwidth. I'm adding this to an already completed and mature game, so don't have the luxury of making a predictive system. My goal also isn't to make a 100% perfect sync, as long as its playable and pretty close I will be happy.
#5 Members - Reputation: 205
Posted 05 April 2012 - 01:14 PM
#6 Moderators - Reputation: 3295
Posted 05 April 2012 - 01:27 PM
#7 Members - Reputation: 2369
Posted 05 April 2012 - 03:18 PM
I could get that down to 50-100 kB/s, that seems pretty reasonable.
For a 30 minute session, that's ~180 megabytes. So 6 hours of gameplay will break 1GB/month limit that many devices come with. Some low-end plans only come with 100MB of data or so. These numbers start approaching video on demand.
At $0.1 per MB over that, it would be $36 per hour of gameplay. That is, simply put, insane. Unless you're running a 1-900- business. Honest advice, if planning on distributing such an app, it better come with a huge warning, or you may bankrupt people.
For a RTS, with dedicated protocol, think tens of bytes per second instead.
Even if costs weren't a problem, network reliability is. A small delay will mean corresponding pile-up of data, which isn't biggest problem, but considering the way naive serialization works it may cause bursts of multiple megabytes on spikes.
#8 Members - Reputation: 205
Posted 30 May 2012 - 12:52 PM
Edited by Rasterman, 30 May 2012 - 01:02 PM.






