Jump to content
  • Advertisement
Sign in to follow this  
scrotumface

Saving an instance of a game in java

This topic is 3175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am not sure how basic this is, but how can a game be saved in java. I have a tic tac toe game, and want the player be able to save the exact game they are on and all their statistics in a database. So when they start the game again, it allows them to load a game using a password.

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you want to be able to save/load using a password? It is rather cumbersome to write passwords down on paper for saving, you can lose it or your dog cam eat it etc.
It is much easier to save the state in the traditional way, e.g player gives a name to a save file and then you he can choose one of them for loading.
For the actual saving/loading part, you can use the Serializable interface and ObjectOutputStream to export your game state into a file.

Share this post


Link to post
Share on other sites
Quote:
Original post by Momoko_Fan
Are you sure you want to be able to save/load using a password? It is rather cumbersome to write passwords down on paper for saving, you can lose it or your dog cam eat it etc.
It is much easier to save the state in the traditional way, e.g player gives a name to a save file and then you he can choose one of them for loading.
For the actual saving/loading part, you can use the Serializable interface and ObjectOutputStream to export your game state into a file.


Yeah, the password idea, was just so that players can have a kind of account on the database, and load it whenever, and all their statistics will be loaded, the profile will be loaded.

But yeah, the traditional way is okey.

I will look at those 2 you mentioned. Are they all that is needed, and for loading?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!