From: "Edmund Horner" To: "Kalum Somaratna aka Grendel" , "Edmund Horner" Cc: Subject: RE: Threading Advice Date: Tue, 12 Sep 2000 14:48:46 +1200 Message-ID: <000001c01c63$f8979e80$799e60cb@morgoth> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal In-Reply-To: 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 Precedence: bulk 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.