delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/11/10:36:44

Date: Mon, 11 Sep 2000 20:25:14 +0600 (LKT)
From: Kalum Somaratna aka Grendel <kalum AT lintux DOT cx>
X-Sender: kalum AT goatbeard DOT grendel DOT net
To: Edmund Horner <ejrh AT paradise DOT net DOT nz>
cc: djgpp AT delorie DOT com
Subject: Re: Threading Advice
In-Reply-To: <968648551.338928@shelley.paradise.net.nz>
Message-ID: <Pine.LNX.4.21.0009112007190.5881-100000@goatbeard.grendel.net>
MIME-Version: 1.0
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

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.

Best Wishes,
Grendel

--
.---------------------.---------------------.----{)--.
| /"__ ._ _  _  _| _ |`-.grendel AT lintux DOT cx.-'(]__/|| |
| \__/ | (-'| |(_|(-'l_ `-===============-' [_]  .-: |
`--------------------------------------------/|\/| |-'

ProZilla, the new Download Accelerator for Linux (GPL), 
<http://www.lintux.cx/~kalum/prozilla.html>




- Raw text -


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