SFML community forums

Help => General => Topic started by: lawsonk on October 17, 2016, 04:01:17 am

Title: Visual Studio Debug/Release Issues
Post by: lawsonk on October 17, 2016, 04:01:17 am
I used SFML to create a graphical rendering of the classic Traveling Salesman Problem, which would be solved used a Genetic Algorithm.

Using the debug build version I find that the program runs as expected, albeit at a very low frame rate.
https://www.youtube.com/embed/LYPndQ5kdmo

However using the release build version I find that the counter I used to display the current generation climbs very quickly and that the framerate is no longer limited. It seems almost like part of the code is being skipped so the frame can finish as soon as possible.
https://www.youtube.com/watch?v=6fJuFkVSqlM

If you notice the generation counter doesn't appear to match the redrawing of the tours.

I've tried setting the optimization setting for release to disabled, however, that doesn't change anything. Nor do I think it has anything to do with the included sfml-xxx.dll files.

(https://s11.postimg.org/z65l315xv/debug_folder.jpg)
My Debug Folder

(https://s14.postimg.org/tatr1h4e9/release_folder.jpg)
My Release Folder


I'm using SFML 2.3.2

Frames are locked using ...
window.setFramerateLimit(60);

This following two snippets of code should only run once per frame.
Although I have my doubts that this is the cause of the issue.
if (!paused)
                {
                        generations++;
                        textDisplayHandler.editText(3, "Generations: " + std::to_string(generations));
                        geneticAlgorithm.setTourReference(tourHandler.getTourReference());
                        geneticAlgorithm.generateTours();
                }

renderHandler.Draw();
 
// Draw Definition
void RenderHandler::Draw()
{
        rw_->clear();
        tour_->drawTours();
        text_->drawText();
        city_->drawCities();
       
        rw_->display();
}
 

Anyone have any idea why there might be such a discrepancy between the two build versions?
Title: Re: Visual Studio Debug/Release Issues
Post by: DarkRoku12 on October 17, 2016, 05:19:19 am
1) Use the same framerate limit on the two versions.
2) Use a delta-time based counter, not a generic frame counter.
3)If you want to show code, show a more appropriate code, the two snippets of code show us *nothing*.