Where to save a user's game?

Eventually I hope to distribute the game I’m building, and users will want to save their game state somewhere. It seems from this tutorial that a good place to do that is in the assets folder:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:save_and_load

But that's talking about scene graph nodes, and it doesn't actually say specifically, so let me ask:
  • Will the assets folder always be present and writeable in an installed instance of my game?

  • Is this the right place to be saving things like the user's game state?

Thanks!

Great, those two answers together are just what I needed. Thank you!

Generally, I’d always try and use javas built-in property file support… For small amounts of data you can store binary data even, using uuencode or similar to convert the data to plain text. This way assures that you can always save the data on any platform even in a platform-specific manner because its built into the java spec.

Short answer is “no”. In general, by the time the game is distributed, all of its assets are in a jar file and there is no “assets folder”.

I generally save my user’s game files (ie. their save-game, not the levels and assets) to the user’s home directory.

[java]String userHome = System.getProperty(“user.home”);[/java]

As Paul said, the assets directory will be a jar file and will get updated when new updates are released, especially if you launch with webstart.

Oops, I just wrote wrote this code a few days ago as a test and put it up on the wiki. It wasn’t meant to suggest the “assets” as the path. I’ll update it with what Sploreg said.