Home News Features Games Authoring Community Forums About Contact
   

May 18, 2013, 05:26:12 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: setCharacterDrawMode to be extended  (Read 1633 times)
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« on: May 13, 2010, 05:29:20 AM »

I've started looking at Erwin's request to expand on the functionality of setCharacterDrawMode. The most obvious way to do that is to simply add a third (optional) parameter to the function, so that you can say:

setCharacterDrawMode (char, TRANSPARENT, 128);

That would be equivalent to saying simply setCharacterDrawMode (char, TRANSPARENT); 255 would be completely solid and 1 would be equivalent to INVISIBLE. (INVISIBLE is 1 and not 0 so that the mouse still will react to the character.)

It's easy to use and easy to implement, and the DARK, SHADOW, FOGGY and GLOW modes could be handled the same way. But implementing it like that has one downside: The draw modes are still mutually exclusive, so you can't make something FOGGY and TRANSPARENT.

An alternative is to expose the internal workings of the engine through three new functions, but that would be a bit more complicated:

setCharacterDrawOpacity (char, value);
setCharacterDrawLight (char, value);
setCharacterDrawGlow (char, red, green, blue);

Thoughts?
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Erwin_Br
Administrator
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1667



WWW
« Reply #1 on: May 13, 2010, 06:20:06 AM »

I have no need to combine effects. Generally I'm all for flexibility, but I wouldn't blame you if you go for a solution that's easier to implement.
Logged

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." --A. de Saint-Exupery
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #2 on: May 13, 2010, 07:26:15 AM »

I would go with the three functions. It's more obvious and natural than having predefined modes and then changing them again.

EDIT: Maybe put all modes except transparent into one function?
setCharacterDrawGlow (char, red, green, blue, value);
« Last Edit: May 13, 2010, 07:36:00 AM by BigMc » Logged
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« Reply #3 on: May 13, 2010, 07:48:04 AM »

I have no need to combine effects. Generally I'm all for flexibility, but I wouldn't blame you if you go for a solution that's easier to implement.

It's not so much a question of how hard it is to implement. (I know exactly how to do both solutions. The difference is mostly adding a few more variables to each character.) The main reason I'm hesitant to do it the second way is that it'd add complexity for the SLUDGE programmer.

I would go with the three functions. It's more obvious and natural than having predefined modes and then changing them again.

You think the three functions way is more natural? More powerful, yes, but more complicated to use. The equivalent of

setCharacterDrawMode (char, GLOW1);

would be

setCharacterDrawLight (char, 192);
setCharacterDrawGlow (char, 64, 64, 64);

instead of

setCharacterDrawMode (char, GLOW, 64);

and instead of

setCharacterDrawMode (char, SHADOW, 128);

we have

setCharacterDrawOpacity (char, 128);
setCharacterDrawLight (char, 0);
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #4 on: May 13, 2010, 08:14:20 AM »

If you have predefined modes, you have to look up or know what they mean. Also the value parameter changes it's meaning depending on which mode you use, which is bad.

I'm not shure if I understood what setCharacterDrawLight would do. I thought it's the transparency value of the overlay color, is that right? That's why I proposed to put that into the glow function.

I think it's quite natural to specify the overall transparency and the color and transparency of the overlay. Isn't that all what is needed?
Logged
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« Reply #5 on: May 13, 2010, 08:22:50 AM »

I'm not shure if I understood what setCharacterDrawLight would do.
It sets the lighting of the character. (Same as the DARK mode.)
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #6 on: May 13, 2010, 08:30:49 AM »

Isn't that the same as GLOW and FOGGY just with a black overlay instead of white or grey?
Logged
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« Reply #7 on: May 13, 2010, 08:43:02 AM »

No, but I see what you mean. The end result actually is the same. Maybe I'm thinking too much in terms of how it's implemented under the hood. Now I understand why you keep talking about an overlay and why you thought the separate functions to be natural.

It's a new angle to think about it from, but you may be on to something good here... I'll have to do some more thinking.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« Reply #8 on: May 13, 2010, 10:19:01 AM »

Having thought about it, I think BigMc's idea is good. Here's the current plan:

setCharacterTransparency (char, value);

Sets the opacity of the character.

A value of 0 = solid.
A value of 255 = INVISIBLE

setCharacterColourise (char, red, green, blue, value);

Blends the character with the given colour.
A value of 0 draws the character normally.
A value of 255 replaces all colour with the given colour. (Alpha values are unaffected.)

Thoughts?
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Erwin_Br
Administrator
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1667



WWW
« Reply #9 on: May 13, 2010, 10:21:58 AM »

Yes, this will work great.  Smiley
Logged

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." --A. de Saint-Exupery
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1161



WWW
« Reply #10 on: May 14, 2010, 01:25:34 PM »

Now I've added the functions. They're in SVN, so they'll be in the next build.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
 
Unauthorised reproduction of anything on this website is not allowed without our written consent.
Materials on this site are the property of their respective owners. Copyright © Adventure Developers. All rights reserved.