[gameprogrammer] Re: Since we are on the topic of optomized data structures (:

  • From: "Alan Wolfe" <alan.wolfe@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Mon, 16 Jul 2007 10:38:57 -0700

I would say that the color test would be faster so long as you had a shadow
copy of your video memory in system ram.  Video ram is really slow to read
from, so keeping a copy of the current screen in normal ram would make that
alot quicker.

The color test though makes it so you can't do lighting, alpha blending, etc
in your game since those things could distort the pure colors that you are
searching for, so even if it is faster, it limits your game to have only
very basic cheesey effects :P

My 2 cents! (:

On 7/15/07, Yasser Gonzalez Soto <yassergs@xxxxxxxxxxxxxxx> wrote:

talkin' about collisions between objects, what is easier Color detecting
collision or position calculation collision.

I remember this collision test done in Visual BASIC 5.0:

(A)

for i=0 to scalewidth
  ball.x=i
  for x=0 to 1000:next '<-- making a delay
   if Point(ball.x,ball.y)=RGB(0,0,255) then '<--If ball position detect a
blue color
    msgbox 'Blue box collision'
    exit
   end if
  end for


And this is in  PASCAL

for i:=0 to ClientWidth do
begin
  ball.x:=i;
  sleep(1000); //A delay
   if ball.X > box.X and ball.X < ball.RIGHT and ball.Y > box.Y and ball.Y
< box.Bottom then
   begin
    showMessage('Blue box collision');
    close;
   end;
end;




Which of both is better to use or the most used??



--


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html



Other related posts: