Sprite Outline a' la AOE

Started by
1 comment, last by OberonZ 24 years, 6 months ago
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

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Advertisement
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

---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.
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

---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.

This topic is closed to new replies.

Advertisement