Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Threads and Drawing  (Read 937 times)

0 Members and 3 Guests are viewing this topic.

mitrious

  • Newbie
  • *
  • Posts: 11
    • View Profile
Threads and Drawing
« on: September 23, 2012, 12:21:44 am »
Well, I'm creating a 2D game and using SFML, I've been wondering if it's worth dividing the logic and window handling of the game. Like this: putting the drawing and updating the window logic into one thread and the game logic in the main thread, making they work kinda together. I made a test to see if I could get it done and it seems like I can, at least I was drawing in one screen and updating logic on the other, but I didn't care so much about the FPS of both, I have an idea of how to do this, so I think it would work.

Anyways, is this a good idea?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Threads and Drawing
« Reply #1 on: September 23, 2012, 08:09:30 am »
There are quite a few boundaries you have to keep track un a mulithreaded enviroment, so it may not be the most trivial although it might seem to work you still can have race conditions etc.
If you should do it depends highly on what your game is all about and if it's worth it. You might get a boost in FPS but then again the FPS count probably is alright already without the seperat threads...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/