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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:28:19+00:00 2026-06-13T18:28:19+00:00

using a file I want to create a map and I am wondering about

  • 0

using a file I want to create a map and I am wondering about the best approach doing so.
Actually I searched the forum but I only found map generation algorithms that randomly creates maps.

Let’s look at a minimal example.
e.g. Ihave a file containing

0110
1001
1000
0000

Every 0 shall be water and every 1 shall be earth.
I would handle this by simply havin two different bitmaps and loading them at the right coordinates. That’d be simple.

But let’s guess we have a 1000*1000 big map and there is only enough space for 16*16 tiles per frame. Then I’d get the current position and would build the map around it.

Assuming we can only display 3*3 tiles, using the minimal example and being at position (2,2) where x and y is element 1..4 so what the user could see at this time would be:

011
100
100

Solution

I thought about using a text file, where a line represents the x-coordinate direction and
a column represents the y-coordinate direction. The whole file is being loaded at the beginning of the program. This shouldn’t use too much ram assuming 1 tile needs 1 byte, what should be enough.

For redrawing the map when the user is moving, I’d get the moving direction and slide the current Bitmap for the height/width of a tile in the opposite direction and only look up the bitmaps for the new blank spaces. So I only need to look up the tile information for m+n-1 (where m is the amount of displayed tiles in y and n in x direction) tiles (max case if moving diagonal) instead of loading m*n tiles everytime the user moves.

Example

I created an example to make the above given example more easily to understand.
this is the whole map:

whole map

We can only display 3*3 tiles and the user is at position (2,2) so what we’d actually see is:

starting position

now he is moving towards the bottom right corner:

Moving

and the black framed section is being move to the opposite direction, so that we get:

after redrawing

now the blank tiles (black framed white areas) have to be looked up and teh final result will be:

final image

Question

is this a good way of building a map? Or are there much faster functions, maybe already implemented in the microsoft xna-gamestudio package ?

  • 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-13T18:28:21+00:00Added an answer on June 13, 2026 at 6:28 pm

    I would pre-fetch 1-2 tiles range outside the screen view, so that you won’t have weird pop-up as the player move.

    But if your game is a top-down tile game, this solution is quite conservative. In most hardware today, you could create a very big range around the player without problem. Just look at the number of block Minecraft can process and display. Since you are reusing the same texture, you just load the asset once and reuse them in a tile, which would probably an object with very little memory footprint.

    Have you tried implementing it yet?

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

Sidebar

Related Questions

I want to create war using grails, but by default it creates war file
This the model that I want to create using json file Ext.define('Users', { extend:
How can I create a .txt file using flex 3? And I want to
I'm able to create an excel file using apache poi. however, i want users
Using C# and WinForms in VS2008, I want to create a file browser control
I am using phpexcel to create a xls file. I want to turn off
I've created a list of files using: file(GLOB_RECURSE DEPLOY_FILES ${PROJECT_SOURCE_DIR}/install/*) I want to install
I've created an ics file using DDay iCal library. Now I want to make
I get a page using file_get_contents from a remote server, but I want to
I want to delete a file using racket. I am using following code. (delete-file

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.