delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/19/16:16:51

From: Stefan Boberg <boberg AT team17 DOT com>
Newsgroups: comp.os.msdos.djgpp,rec.games.programmer
Subject: Re: HELP: pixel finder algorithm ??
Date: Wed, 19 Aug 1998 21:04:41 +0100
Organization: Customer of Planet Online
Lines: 28
Message-ID: <35DB2FD9.99D6ECF9@team17.com>
References: <35CE0D3C DOT 63BA AT cam DOT org>
NNTP-Posting-Host: gate-isdn.team17.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Vic wrote:
 
> hi.
> in a game like Worms, for example, you have a generated landscape,
> probably a bitmap (so it's not made by tiles). your "worm" can move on
> it. how can I find out wether the worm can or cannot move on the
> landscape? 

   'Worms 2' does not actually use the display bitmap for collision
detection. It stores an internal 'collision mask', which can contain the
actual slopes at each pixel (generated by the landscape generator)
encoded in some fashion.

   As far as I can remember, the original Worms used a 1-bit bitmap to
store the collision mask, and the gradient at each position is
determined by examining the neighbouring pixels. Pretty straightforward
stuff.

   Some pinball games actually use the same approach. Notably Pinball
Dreams, Fantasies and Illusions. They all use a 'collision mask'
bitmap,  and when a collision is detected, the area intersecting the
ball would be examined to approximate the normal to the collision plane
(line).

--
========================================================================
Stefan Boberg
boberg AT team17 DOT com

- Raw text -


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