Performance with special effects
Displaying 1-6 of 6 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ErayMan

I am working on a battle system and it's almost complete, but all of it requires quite a heck of cpu (but is really nifty! :))
It's running fine on most computer so far, but this snippet of code makes even my 3800+ athlon 64 slows down quite a bit, and that's unnacceptable ;).

Basically, I want a red outline around the monster (when it is berserk or whatever) that is glowing from red to black and forth

LucentStatus == % that change back and forth for glowing effect
(it's doing this at each showpage() )

ScaleBlit(-5, -5, ImageWidth(monsterImage) +10, ImageHeight(monsterImage) +10, monsterImage, ImageDest);
Silhouette(0, 0, RGB(1,1,1), ImageDest, ImageDest);
SetLucent(LucentStatus);
Silhouette(0, 0, RGB(255,0,0), ImageDest, ImageDest);
SetLucent(0);
TBlit(0, 0, ImageDest, screen);


It draws the monster a little bit bigger on top of the real monster, then silhouette-black it, then lucent-silhouette-red it, then redraw the original monster on top.

When one monster is berserk, it's actually not too bad! But if I get, say, 4 of them at the same time, it really slows down and it's not the same anymore ;-(

I've found that the Silhouettes takes 9/10 of the processing time.

Is there another way I could do this? Or make it faster?
I believe I could make 2 gifs of the same monster, one that is all black and a little bigger, so I'd save 1 ScaleBlit and 1 Silhouette, but that gets annoying when you have lots of mobs.
Thanks!
(hope to be ready to show a final product real soon! :) Only need status effect and animate player's sprites)
- ErayMan

Posted on 2007-01-05 01:34:15

IkimashoZ

Yes! I had this problem when trying to make comboed kanji fade between white and gold. Here's what I did (using your code)


int BorderColor;

ScaleBlit(-5, -5, ImageWidth(monsterImage) +10, ImageHeight(monsterImage) +10, monsterImage, ImageDest);
BorderColor = mixcolor(rgb(0,0,0), rgb(255,0,0), (LucentStatus*255)/100);
Silhouette(0, 0, BorderColor, ImageDest, ImageDest);
TBlit(0, 0, ImageDest, screen);


I wrote that on the fly, so I apologize if it doesn't compile. But yeah, you get the idea.

Good luck with your project. I hope to see it when it's done.

Posted on 2007-01-05 03:40:49

ErayMan

Oooh, mixcolor sure looks like it'll fit well in my engine hehe!
Yep, that's one good idea, thanks for your help!

Posted on 2007-01-05 16:40:49

Gayo

How heavily animated is this monster sprite? If it's not moving much you'd be much better off scaleblitting it once to buffer and then just silhouette-blitting that.

Posted on 2007-01-05 17:06:50

ErayMan

Well, the monster is static, except for the glowing thing around it.
But I'm not sure I understand.
I mean, I scaleblit it, silhouette it, then blit original on top
I think it's like you say hehe ;)
Or is there something I fail to grasp?

Posted on 2007-01-05 17:42:46

Beni

The first 2 lines can be done once at the beginning of each battle, so you don't need to do it every call to showpage. I think that's what Gayo was saying.

It would be the same as you creating 2 gifs for each monster like you said, except you would be doing it on the fly with code instead of actually creating the files.

Posted on 2007-01-05 19:06:54


Displaying 1-6 of 6 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.