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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:09:30+00:00 2026-05-26T08:09:30+00:00

I’m implementing a tile engine for games using C++. Currently the game is divided

  • 0

I’m implementing a tile engine for games using C++. Currently the game is divided into maps, each map has a 2D grid of sprites where each represents a tile.

I am coding a system where if several maps are adjacents you can walk from one to the other.
At startup of the game, all the maps are instancied but are “unloaded” ie the sprites objects are not in memory. When I’m close enough of an adjacent map, the maps sprites are “loaded” in memory by basically doing:

for(int i=0; i < sizeX; i++) {
    for(int j=0; j < sizeY; j++) {
        Tile *tile_ptr = new Tile(tileset, tilesId[i][j], i + offsetX, j + offsetY);
        tilesMap[i][j] = tile_ptr;
    }
}

And they are unloaded by being destroyed the same way when I am too far away from the map.

For a 50×50 map of sprites of 32×32 pixels, it takes me roughly 0.3 secs to load or unload which is done during 1 frame. My question is: what is a more efficient way to load/unload maps dynamically, even using a totally different mechanism? thanks

PS : I’m using SFML as a graphic library but I’m not sure this changes anything

  • 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-05-26T08:09:31+00:00Added an answer on May 26, 2026 at 8:09 am

    A different possibility to improve latency, but will increase overall number of ops needed:

    Instead of waiting when you are ‘too close’ or ‘too far’ from a map, store in memory the maps for a bigger square around the player [i.e. if the map is 50×50, store 150×150], but show only the 50×50. now, every step – calculate the new 150×150 map, it will require 150 destroy ops, and 150 build ops in each step.

    By doing so, you will actually need to calculate and build/destroy elements more times! But, latency will improve, since you don’t need to wait 0.3 secs for building 2,500 elements, since you always need a small portion: 150*2 = 300 elements.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I want to count how many characters a certain string has in PHP, but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

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.