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 8524991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:50:45+00:00 2026-06-11T07:50:45+00:00

I am working on a map save file. Essentially this map save is going

  • 0

I am working on a map save file. Essentially this map save is going to contain information such as the location of entities, as well as the images of each of the chunks in this world (which change during gameplay). I could save this all in multiple files, however i would rather keep it as one file for simplicity sake (simple for the user that is…) and also, because i do not want the maps to be editable (not just by double clicking an image file at least).

So essentially, it comes down to writing to a file, currently i have it all working, i am writing 2 bytes to indicate the number of chunks along the x and y axis of the world, then go through and store a byte for alpha, red, green and blue for each pixel of each chunk.

Each chunk is a 512 by 512 image. When i save a world (only containing the chunks and world size (2 bytes). The file size is as expected. number of chunks * 512 * 512 * 4 (ARGB) + 2 (world size) bytes.

However, looking at the file size of images of each chunk which i just did a test export of with Bitmap.Save(), each of those image files have a size of 10 – 20 KB. basically, a lot less.

So I need to somehow store multiple images in a single file, taking up a more realistic amount of space.

Either, somehow getting what Bitmap.Save() would usually export, and adding that into the file or having a more space-saving way of storing the image manually, than 4 bytes a pixel.

Does anyone know an approach to either of those? Or another idea to store multiple images effectively?

  • 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-11T07:50:47+00:00Added an answer on June 11, 2026 at 7:50 am

    How about using a BinaryFormatter?

    So design a class to represent your model data that you want to store:

    [Serializable]
    public class MyModel
    {
        public byte[][] Images { get; set; }
    }
    

    and then assuming you have an instance of this class:

    var model = new MyModel
    {
        Images = new[]
        {
            File.ReadAllBytes(@"d:\work\image1.png"),
            File.ReadAllBytes(@"d:\work\image2.png"),
            File.ReadAllBytes(@"d:\work\image3.png"),
        }
    };
    

    you could serialize it to a file:

    var formatter = new BinaryFormatter();
    using (var output = File.Create("images.dat"))
    {
        formatter.Serialize(output, model);
    }
    

    Of course if you have an instance of a Bitmap, it’s just a matter of converting it to the corresponding byte array in order to stuff it inside the model.

    And then later when you want to read the data back:

    using (var input = File.OpenRead("images.dat"))
    {
        var model = (MyModel)formatter.Deserialize(input);
    }
    

    Your model could of course be as complex as you wish. You could associate metadata to those images such as their name, type, … by designing yet another model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't get my head around why this isn't working.. I have two entities
i working on map view. i want to put overlay item on the map
I have a working country map that with regions that animates fill on click
I had a perfect working Google Map, connecting to my Fusion Tables, with nice
I am working on a map with a number of mouse over ''points'' that
I'm working on a Map Editor for an XNA game I'm designing in my
I am working with google map. According to requirements i need to set different
I'm working on creating a map of Day Z (the game) with leaflet JS
I am working on a sample map kit app for iOS. I have everything
I am working with Leaflet for a map on my site. I want to

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.