delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/11:11:39

From: Neil Goldberg <ngoldber AT mitre DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: spawning or system for DOS game?.. help me
Date: Tue, 10 Aug 1999 10:03:01 +0100
Organization: The MITRE Corporation
Lines: 43
Message-ID: <37AFEAC5.48AD@mitre.org>
References: <7oak28$865$1 AT nnrp1 DOT deja DOT com> <7ogqna$o76$1 AT ctb-nnrp1 DOT saix DOT net>
NNTP-Posting-Host: mm58842-pc.mitre.org
Mime-Version: 1.0
X-Trace: top.mitre.org 934293652 7911 128.29.96.60 (10 Aug 1999 14:00:52 GMT)
X-Complaints-To: usenet AT news DOT mitre DOT org
NNTP-Posting-Date: 10 Aug 1999 14:00:52 GMT
X-Mailer: Mozilla 3.04 (WinNT; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Stefan Viljoen wrote:
> 
> <zidharta AT geocities DOT com> wrote in message
> news:7oak28$865$1 AT nnrp1 DOT deja DOT com...
> > how to make my game's background move while the character move
> > according to arrorw keys and sound play at the same time?
> > would it be a multithreading?... how to do this in DOS?
> > I know how to do each of them ... but how do I do this at once?
> > spawning?.. system("start ..")? which one ?
> > thanks in advance ...
> 
> I once managed something like this with no fancy stuff like you mention.
> What I did was set up just one loop that has conditionals in it that key to
> differrent speed allegro timers that I set up. For example, to keep the
> character moving, part of my loop checked the "character timer" - when this
> "ticked" I moved the character. Another kept count of how long the current
> song was playing, when it ended the song length timer "ticked" and I started
> up the next song in queue - etc. You can do this to the limit of the amount
> of timers you are able to allocate. You can run through this loop hunderd or
> thousands of times each second, the timers "ticking" at the correct pace to
> keep it all looking real. If you look at any source for almost any DOS games
> that you might be able to find, I think you will see that this is how
> apparent "simultaneous" actions like this was carried out - everything is
> actually done in sequence (HAS to be done in sequence - in a DOS system
> there is usually one processor, one path to memory, one display card, etc.)
> but so fast that it appears simultaneous (i. e. appears to look like
> "multitasking" or multithreading).
> 
> Hope this is accurate and helped some!
> 
> --
> This message courtesy of
> RylanNet rylan AT intekom DOT co DOT za
> http://home.intekom.com/rylan/
> --
> StarWars for ever!.

More information: In fact, even Windows and the programs that run in it
use this method too; the computer is still only doing one thing at a
time. Each process / thread gets a little bit of time CPU every once in
a while.

moogla

- Raw text -


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