Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:17:41+00:00 2026-06-04T00:17:41+00:00

So i am currently working on a simple game project that most people start

  • 0

So i am currently working on a simple game project that most people start of with “breakout”. part of my goal is to make a gamesave of the current gamestate the simplest way possible.
Eg.

==scenario==

then lets say i lose the game or i want to go to bed because i’m tired, so i want to reload the gamestate to where i come back to the same position of the paddle, ball and bricks. the only problem is i have multiple forms and i just want to save this specific form in its specific state.

i have an idea on how to approach (i would find a way to save the position of the paddle, ball and the bricks and that exact time) just i have not a clue on how i would execute it.
How exactly can i achieve this feat?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:17:42+00:00Added an answer on June 4, 2026 at 12:17 am

    This can be a very complex problem but in your case I would suggest starting out simple and going from there as your game becomes more complex. Essentially the probablem is known as Serialization. Or, writing the memory of your application out to disk or a database in a way that it can be read back into memory later.

    There are a lot of techniques for doing this, such as converting your objects into XML or JSON or some other binary file format. A bitmap file for example is just a serialized form of some image structures in memory.

    I don’t really know the technology you are using to make your game other than C# (XNA?) But essentially you want to use some sort of file-system API that’s available in your environment and write your serialized objects there. Based on your question you might need to re-design some of your game to facilitate this. Generally it’s good practice to have a single ‘source of truth’ representation of your game state but even if you don’t you can still probably figure it out.

    So here is a rough outline of steps I would take…

    Serialization

    1. Write a routine that takes your game state and outputs simpler, serializable objects.
      • These simple objects will mostly have all public getter/setter properties with no functionality.
      • Try to write out only the bare minimum information you need to recreate your game state again later.
      • for example see how chess serializes game state: chess notation
    2. Serialize those objects into JSON (because its easy and flexible)
    3. Write that json to disk.
      • I would probably use a convention base approach here.
      • such as “Saves\game1.json” is the state for the first game slot.
      • Just infer the saved games based on the presence of the files of the right name.

    Deserialization

    1. Look for game saves based on the above convention.
    2. Deserialize the JSON back into the simple serialization objects.
    3. Recreate the more complex game state by looking at the serialization objects.
      • Consider using a visitor pattern.
    4. Resume the game using the newly hydrated game state.

    [EDIT: adding some extra links and a quick code sample]

    Here is an open source json library that is quite good: http://json.codeplex.com/

    // somehow convert your game state into a serializable object graph
    var saveState = gameState.Save();
    
    // use json.net to convert that to a string
    string json = JsonConvert.SerializeObject(saveState, Formatting.Indented);
    
    // save that string to the file system using whatever is available to you.
    fileSystemService.WriteAllText("Saves\game1.json", json);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a simple Silverlight app that will allow people to
I'm currently working on a simple game that is drawn on a form by
I'm new to android game development. I currently working on a simple android app
I am currently working on a game engine that needs to move values between
The goal of the assignment that I'm currently working on for my Data Structures
I'm currently working on my 2D game project (Java), but so far any kind
Currently i am working in simple game app using openGLES, draw a line using
I'm currently working on this really simple text based game and to play again,
I'm currently working on a simple game in Java with several different modes. I've
Currently i am working in Simple game application, i have a doubt on glVertexAttribPointer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.