Minecraft

What you end up doing is then basically switching on serialVersionUID to a series of private loader/saver delegate classes. This is sort of more complicated than just settling on a custom binary format in the first place in some ways but actually it’s quite a good solution, just not many people appear to think about this technique.

Cas :slight_smile:

That’s good to know. I never have a problem with it because Eclipse will throw a warning if you use Serializable and don’t have a serialVersionUID.

What happens is that if you add stuff to a class, it will load just fine. If you remove something (not transient), it will explode. You can work around it by doing your own serialization for that class something along the lines of what princec said, but it’s not a pretty solution, and it’s much MUCH more complex than just designing a proper file format in the first place.

Ah, that makes sense then. See, I’ve never done that. :slight_smile:

I almost always end up either:

  • Saving my own text/binary file.
  • Serializing a SavedEntity class for everything that constructs the proper Entity when loaded.

The latter option gives me enough control that I so far have avoided any problems, which the former obviously won’t have issues. There’s also Externalizable if you want to get fancy and still use Java’s output streams.

Kryo! :slight_smile:

Or XML. :smiley:

XML = yuk! Custom binary format FTW!

Cas :slight_smile:

XML is to a developer as taking a screenshot of a text document, drag and dropping it into a word document, zipping it, and emailing it is to a PHB. Both of these really happen. :frowning:

Can I just add my kudos to all the others? Fun sandbox game, and it must be really cool to see all the positive comments on this around the place. Keep up the good work.

A little of topic but… why binary? A simple text format can be pretty compact, not compared to binary but is that an issue?
Text is more human readable but also editable. I couldn’t care less if some guy cheated to beat my game.
Am I missing something?

Easier for a machine to read and write. And therefore easier for you to code. Why deal with Integer.parseInt() when you can just read 4 bytes as an int and know it will work and not throw a NumberFormatException? and so on.

Cas :slight_smile:

Sure, but if it breaks, and you have to do debugging, binary looks like a bunch of random bits, whereas you can probably figure out what went wrong when browsing through human readable data.

is it just me or have the minecraft sales gone extra crazy, 4700 sales in the last 24 hour :o

The server was down for quite some time, maybe people are catching up?

ah good point, or could be the recent stories like this

http://games.on.net/article/10042/Minecraft_Creator_Locked_in_Secret_Talks_With_Valve

I wonder what they meant by ‘eccentric’ …

I’m guessing they just put it because it’s a cliché. If you’ve got one guy working by himself on something, call him eccentric!

His use of Java…?

Looks like Markus has decided what he wants to do with his success, build on it. Probably a natural progression IMO.

Good luck with it Markus, although I’m sure you’ll do just fine :slight_smile:

Congratulations on hitting 1 million sales, Markus, we’re all really proud of you. :slight_smile: