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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:50:29+00:00 2026-06-04T23:50:29+00:00

I recently starting to work on a tile based game on C++ using SFML

  • 0

I recently starting to work on a tile based game on C++ using SFML library. Because I dont have much exprience with either C++ and SFML I’m pretty sute that the performance issue has something to do with my code.

The basic idea is that I have and 2d array of tiles which I create dynamicly this way:

Tile tiles**;

tiles = new Tile*[sizeX];

for(int i = 0; i < sizeX; i++)
   tiles[i] = new Tile[sizeY];

And I draw everything this way:

for(int x = 0; x < sizeX; x++)
{
   for(int y = 0; y < sizeY; y++)
   {
       tiles[x][y].Draw(app);
   }
}

The variable app is sf::RenderWindow and it passes to the function as reference.

When I draw 10×10 map it runs on slow fps.

Sorry for my bad english!

Thanks in advance!

  • 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-04T23:50:30+00:00Added an answer on June 4, 2026 at 11:50 pm

    Your performance issue has probably nothing related to iterating the 2D array. It’s probably because of Tile::Draw performance, so try to optimize it.

    But anyway – as @chris said, using a 1D vector instead of a 2D array can be a bit faster. But that shouldn’t make significant performance changes.

    The correct way to render a tile map would be to create a large texture and then rendering your tiles onto this texture, and then rendering this large texture to the screen, instead of rendering every tile, like you’d normally do in XNA.

    That’s because the way SFML uses OpenGL isn’t friendly to large number of Draw() calls.

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

Sidebar

Related Questions

We've recently starting using TFS. Currently just for source control. We're considering using work
This work great to delete php, txt and images but I recently starting using
I am currently working on a multiperson team and we have recently starting using
I've recently began using C++ with XCode and I'm starting to miss the integrated
I've recently used git svn and enjoyed it very much. Now I'm starting a
I have recently started studying about threads. I thought of starting from the beginning
I recently left a large university hospital for a much smaller one because of
I'm recently starting to learn Java and have had success writing and compiling my
I have recently starting porting a small app of mine to Facebook as a
I have recently begun to develop a game in Haxe which targets the Flash

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.