• Advertisement

Archived

This topic is now archived and is closed to further replies.

Sprite Outline a' la AOE

This topic is 6678 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement