Wednesday, August 17, 2016

My take on No Man's Sky missing multiplayer feature

IMHO, what has happened to No Man's Sky's "missing" multiplayer feature is a no-brainer.  I think they originally planned to have it in, but eventually came late to the decision that it was not going to be completed in time for the release date, which couldn't be put back again.  However, Sean will have been under immense pressure to never actually say "NMS will *not* have multiplayer", since sales would have been adversely affected.  His hope was that no-one would manage to meet up until they had added the multiplayer feature in an update (and also try and discourage people from even trying to meet up due to the immense odds of that happening), but unfortunately, they did.

So Sean did the only thing he could: avoided directly answering any questions (since to say anything other than "multiplayer doesn't exist" would be an outright lie) and is now hoping that the multiplayer feature could be completed ASAP and added as a "multiplayer fix", since the feature was already there, just wasn't working properly.  Right?

Monday, August 15, 2016

Use InputStream.available() with caution

You might assume that InputStream.available() returns how many bytes are available to be read from your stream. And you'd be almost right; it's really how many bytes are guaranteed to be available, not how many are actually available. 

Okay, to get to specifics, my problem occurred when I used a ZipInputStream wrapped around a file. I (stupidly) assumed that all the bytes must be available, since it's a file sat on my computer. However, since ZipInputStream reads a compressed file, the number of bytes available isn't the same as the original file size. (I should mention that at this point I didn't actually know I was reading a zipped file, as the whole point of streams is that you don't normally need to bother yourself with the implementation).

In addition, ZipInputStream.available() only returns either 1 or 0, so it would be unwise to use that size as the basis for an array to ready the data in.

So, my point is, available() should really be [treated as] a boolean.  If it's > 0, great, you can read something.  Just don't put any reasoning behind the actual number.