Hi there,
I’ve changed around my whole network code to use Kryonet instead of gzipped strings. Unfortunately I ran into three connected issues, and I was wondering if there is a way to solve them.
-
Whenever a player connects to the server the area around him is sent from the server, at the moment I’m sending an area of 2000x2000 tiles to give the player a view distance of 1.000m. While this never was a problem before the Kryonet TCP send bytebuffer gets filled up very quickly and the whole server crashes, never recovering. I can catch the error and restart the server, but I was wondering if there was a better way to handle it.
-
The only way I managed to “solve” it was to start the server up with new Server(25 * 1024 * 1024, 1024 * 1024); Is allocating 25mb of buffer per connection really the way to solve such a problem? What about when people have created huge structures, do I have to go in and increase the number just in case the player loads that part of the map at startup?
I could lower the amount of data sent somewhat or throttle the sending of the land, but I’d prefer to have it work without having to rewrite a lot of code and decrease the experience of the players. -
Back when I used gzipped CSV’s an empty container (an array of 4356 shorts) took about 500-700 bytes, and now they take 8kb. Is there a way to compress the data or does it have to take as much as each individual value? I was looking at the Deflate serializer, but I didn’t get it to work on a short[].
Kind regards,
Mike