Jump to content

  • Log In with Google      Sign In   
  • Create Account


Sprite Outline a' la AOE


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 OberonZ   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 October 1999 - 03:17 PM

Hello again, boys and girls.

Today' s question is brought to you by the Diet Coke of Evil: 1 Calorie, not Evil enough.

Ahem... Sorry, I'm in a slightly silly mood.
Anyway. In AOE when a unit is partially obscured, a colored outline appears around the contours of the sprite, only the obscured part.

I was trying to figure out how this is done, but the only way I came up with (at 1am) seems silly, slow, and inefficient, but here goes.

Given:
1) a mask of the outline of the sprite
2) a mask of the object that is blocking the view

Do:
1) find the union of the bounding rectangles.
2) AND the masks (within the union of bounding rectangles), this should give you a new outline.
3) Putpixel of a bright color for every black pixel in the new mask

Problems:
1) Extra bitmap (boolean array?) for every frame of animation for every sprite.
2) 1 sprite 32x64x32 FPS = 65K calls to GetPixelColor (or equivalent) per second!

Possible solutions:
1) Blit the new mask in the color needed (how?)

For the sake of discussions, lets say we are using DirectDraw for a 2D app.

Any ideas, comments, suggestions?
Thanks,

-OberonZ


Sponsor:

#2 mason   Members   -  Reputation: 128

Like
Likes
Like

Posted 11 October 1999 - 10:41 AM

Hmm... dest color keying, maybe?

Plop down the villager sprite first.

Now, let's say you have a sprite containing only the outline of the character in some bright color (say, RGB(0,0,255)). You can figure out which part of the villager sprite rectangle is occluded by the building... for the occluded rectangle, you Blt your special outline sprite down.

Then, when you blt the building, you dest colorkey with the outline color (0,0,255). Presto, the villager outline shows thru.

Not sure if this would be faster or slower than what you described, but at first glance it seems like it might work.

BTW: AoK - great game. Catch me on the Zone sometime ("Menin") and I'll play ya.

Mason McCuskey
Spin Studios
www.spin-studios.com



#3 OberonZ   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 October 1999 - 03:17 PM

Thanks Mason,
but I have a question, isn't destination color key the color what will be coverd up by anything blitted over it?

If that's the case, an outline of (0,0,255) and with a colorkey of (0,0,255) will yield and obstacle in the shape of the outline! At least, that's how Inside DirectX describes the process.

Hmm...
If the order was changed, Sprite->Obstacle->Outline, that might work but it could be a pain, since the obstacle has to know that it obstructed something and inform it, or the sprite has to be aware of future obstructions.

Thanks,
-OberonZ






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS