Dynamically Recoloring Monsters

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Dynamically Recoloring Monsters

Post by Sophia »

Gambit37 wrote:"dsb_set_tint" will recolour monsters -- but this seems to just be an overlay that allows the underneath colours to show through. Is there a function for completely changing the colour of a monster but retaining the lumninance of each pixel? IE, could you say apply "brown" to the monster, and every pixel goes brown but retains it's brightness level so you can still each each pixel? This would be cool for doing things like making monsters turn to stone, ice, etc. without having to create hundreds of new images. Here's an example of what I mean:
Image
I've been adding some pixel-level color manipulation commands to DSB 0.47 and this is now doable.

Right now, it'll allow tweaking of the RGB and/or the HSV of each pixel on the monster's bitmap. This should let you do pretty much every simple color effect you can think of.

Fancier filters will be more work for me-- so I'm probably not going to do them unless they're relatively easy and specifically requested-- but I figured I might as well at least mention something before it's all set in stone. :)
Mon Ful Ir
Adept
Posts: 221
Joined: Sat Jan 07, 2006 1:54 am
Location: Britain

Re: Questions about DSB/ESB

Post by Mon Ful Ir »

How complicated would a transparency filter be? I can see potential uses where a designer might want to turn creatures into ghostly versions of themselves, and/or back again.
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about DSB/ESB

Post by Sophia »

Oh, I should have mentioned that. You can tweak the alpha channel, too, which will let you do that. :)
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Dynamically Recoloring Monsters

Post by Sophia »

I had a bit of flash of inspiration on this topic recently when I remembered that there are already hooks in the code for giving Lua a rather high amount of control over the contents of a bitmap by means of the bitmap_tweaker property. In the standard base code, this is used to properly crop wall writing from a distance, so that it vaguely resembles what is actually written on the wall. Unfortunately, this method won't work, because trying to dynamically tweak monster images in this way slows the game down pretty unacceptably, at least if it does it dynamically on every frame. Some means of "caching" the result might work better, but there comes a point when it's simpler to just create the bitmap ahead of time, and I might be at that point. Of course, this has its own downside too, because having base code functions that deal in dynamically created and copied bitmaps only complicates things if/when I want to make the editor handle graphics.

So, in other words, the basic structure is in there, but I'm not sure how to expose it to the user in a way that isn't atrocious. Ugh... :(
Post Reply