Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Dualnames on Mon 25/10/2010 16:39:42

Title: Outline on scaling characters
Post by: Dualnames on Mon 25/10/2010 16:39:42
Okay outlining something is fairly possible. Constantly outlining something that changes size and position is what really makes me wonder. I've tried this a lot, but well, I can't accomplish the effect in the way i want it. Perhaps a plugin could do this better, is my guess. Also faster.

Well, I want a black outline on all characters in the screen that will be always around them. I also want that outline to scale. So more like a dynamic outline. Well, that's all. I've tried lots of things but drawing on the surface doesn't have the effect required. Really, I'm stuck.  :'(

I managed to somehow accomplish the effect with a gui and surfaces but it was slow. Slow as hell. And my coding is messy with drawing surfaces and all.

The problem is the exact same that Journey Down had. Great art - looking bad when scaled. Perhaps using Khris module (with bilinear and stuff) would be the better approach instead of outline?
Title: Re: Outline on scaling characters
Post by: Knox on Mon 25/10/2010 17:49:17
For Khris's module, it really does a nice job of scaling sprites with bilinear filter, but if you're going to do it "live" constantly, I think it might be a bit sluggish...but thats only for tests Ive done in 1024x768, so if you have smaller sprites/smaller res game, perhaps it will be faster...
Title: Re: Outline on scaling characters
Post by: Calin Leafshade on Mon 25/10/2010 18:10:59
The problem here is that you cant access the character sprite after its been scaled. So what you need to do is disable scaling on the character and then manually scale the character as a dynamic sprite using the GetScalingAt function.

Then you can go through the sprite line by line, pixel by pixel after its been scaled.

then for a pixel p:

if p is not transparent but p-1 was transparent make p-1 and outline pixel.
or if p is transparent but p-1 was not transparent make p and outline pixel.

Title: Re: Outline on scaling characters
Post by: Dualnames on Mon 25/10/2010 18:37:22
The reso is 320x200 so it may be fast, but well okay, gonna try Khris much module first, then see what that brings out.

EDIT: Too slow. The main problem is that even with the outline process, it ends up to slow to render. Even with Calin's stuff :(
Title: Re: Outline on scaling characters
Post by: Endres on Tue 26/10/2010 17:23:46
Maybe You could have luck with the Plugin API? I mean, I think that Allegro tolerates pretty much, because my Plugins aren't as clean as they could be. ;D
But it works very fast and I think there may be some Allegro-Functions that would make your life easier...
I think even if you cannot code very good in C++ it could be a try, couldn't it?