delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/11/22:47:40

From: "Edmund Horner" <edmund1 AT geocities DOT com>
To: "Kalum Somaratna aka Grendel" <kalum AT lintux DOT cx>,
"Edmund Horner" <ejrh AT paradise DOT net DOT nz>
Cc: <djgpp AT delorie DOT com>
Subject: RE: Threading Advice
Date: Tue, 12 Sep 2000 14:48:46 +1200
Message-ID: <000001c01c63$f8979e80$799e60cb@morgoth>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <Pine.LNX.4.21.0009112007190.5881-100000@goatbeard.grendel.net>
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Thanks for your advice, it sounds wise and is very encouraging.

BTW, what exactly are race conditions and mutexes, and would I really
encounter them if I used threads in a (relatively) simple program like this?

Thanks again,
Edmund.

> -----Original Message-----
> On Mon, 11 Sep 2000, Edmund Horner spoke the following immortal words,
>
> > My game has several things it needs to be doing all the time:
> >
> > 1. Redrawing the screen.
> > 2. Responding to input.
> > 3. Moving and updating units.
> > 4. Occassionally doing big things like pathfinding.
> >
> > Can any of you guys tell me whether I would be advised to use real
> > threading, or how I can accomplish an adequate solution without it?
>
> If you are not familiar and even if you are familiar with threads, my
> adivce would be don't use them, as there is no justification for using
> them when other simpler and equally(more?) effective methods are
> available.
>
> The trick is to do the above steps in a order, ie Responding to input,
> then updating the units, and then redrawng the screen. If the above are
> done fast enough it will give the illusion to the user that everything is
> hapenning at once, which is the effect that you want to achieve I assume.
>
> Also please consider this, if you use threads for each of the above tasks,
> you would have to worry about thread synchronization, and to prevent race
> conditions, mutexes etc....if you don't know much about those issues..then
> why bother with the added complexity and bugs that it might introduce.
>
> The plain and simple illusion method is the best IMHO.
>
> Great games like doom etc don't use threads, so there is no restriction in
> creating great games just because you don't use threads.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019