Menu

multi-thread for different media

2004-07-04
2013-06-04
  • Twan Jans-Beken

    Twan Jans-Beken - 2004-07-04

    I was thinking about how the final program will run: I guess that there are several very distictive processes and I wonder if these should/could be programmed as separate processes (threads).

    Processes:
    - graphics (time critical for flicker-free display)
    - background music (time critical, distinct from game)
    - AI (much CPU time)

    Graphics is the most critical if we want the game to move fluently. Therefore this process must have the highest priority.

    Background music is the simplest task. The music can be from a WAV file or from a CD (which I prefer). However, since this music has no relation with the game I do not like to handle it in the main game loop. We just must be able to start, stop and probably fade the music.

    AI is not time critical. Units simply continue with there current task (or wait) until new orders arrive. AI will however consume large amounts of CPU resources. Such a process can easily be interrupted for graphics update.

    So, is it wise to make our program a multi-thread application?

     
    • i no h0w 2 tipe g0od

      It seems like the most likely choice, and would probably save us some headache later on (maybe). But for the sake of brainstorming, what other ways could we do it?

       

Log in to post a comment.