Glitch - Setting Character Tint

Started by Ryan Timothy B, Mon 07/06/2010 05:29:10

Previous topic - Next topic

Ryan Timothy B

I'm not sure if it's an issue strictly with my game, or with AGS altogether.  I'm using AGS Build 3.2.0.102.

I set the character tint, and honestly I don't understand character.tint whatsoever.  I don't know the limits, I don't understand how it works, etc.  So basically I was playing around with it.

Anyway I did this:  
Code: ags
cMikael.Tint(0, 0, 0, 1, 250);

I wasn't sure what the limits were and just assumed the editor would give me a friendly message or something.

And got this error:
Code: ags

Error: An error occurred while parsing EntityName. Line 2, position 97.
Version: AGS 3.2.0.102

System.Xml.XmlException: An error occurred while parsing EntityName. Line 2, position 97.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.Throw(String res)
   at System.Xml.XmlTextReaderImpl.ParseEntityName()
   at System.Xml.XmlTextReaderImpl.ParseEntityReference()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at AGS.Editor.NamedPipesEngineCommunication.MessageSenderThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


And then AGS crashes.  It also throws me the do not save your game, you've encountered a serious bug, or whatever it says exactly.
When I comment out the character.Tint, it works without issue.

Gilbert

Saturation and luminance accept only values from 0-100 and you set luminance to 250. That's possibly the cause (though, obviously a descriptive error message should appear instead).

It's not easy to spot the ranges for the parameters at first sight, they're actually (as hinted by the Character.Tint() entry) explained in the entry of SetAmbientTint().


Ryan Timothy B

#2
Yeah I figured it was 0-100.  Anything below 0 or above 100 shouldn't crash AGS though.


Anyway now that I've had some time to play with character.Tint, I've found out that it's very odd and I can't understand how it works at all.

For instance (using character.Tint(0, 0, 0, x, 0), x being the saturation below):
Room Lighting  vs  Character.Tint
room lighting -30  = 100 saturation (pure black)
room lighting 0     = 75 saturation   (3/4 black)
room lighting 100 = 0 saturation (normal)
room lighting 230 (pure white)

I can't seem to get the character any whiter/lighter than the normal color with Character.Tint.
I also can't seem to figure out what luminance does.  I'm on 32 bit color, same with the character.

Also any room lighting below -30 or above 230 turns the character's colors all wacky.  A quote from the manual says this "This is different from the editor, which takes values from 0 to 200.".  Are we not supposed to make the character pure black or white?


How do you get room lighting to match up exactly with Character.Tint?  Is there some kind of trick to this that I'm not aware of?  It seems much more confusing than it needs to be.


I've noticed that if you select true to region color tint that it doesn't prevent you from going outside 0-100 or crash.

Pumaman

First of all, thanks for spotting a reliable way to reproduce that "XmlException: An error occurred while parsing EntityName" crash. I've had quite a few Error Reports submitted but not managed to reproduce it until now -- I'll fix it.

As for Character.Tint, you can't use it to lighten the character, only re-colour and darken it.

The Light Level is a separate option which can brighten the character but doesn't support colour tinting.

Sslaxx

Quote from: Pumaman on Tue 08/06/2010 22:06:04
First of all, thanks for spotting a reliable way to reproduce that "XmlException: An error occurred while parsing EntityName" crash. I've had quite a few Error Reports submitted but not managed to reproduce it until now -- I'll fix it.

As for Character.Tint, you can't use it to lighten the character, only re-colour and darken it.

The Light Level is a separate option which can brighten the character but doesn't support colour tinting.
So the effects aren't cumulative?
Stuart "Sslaxx" Moore.

Ryan Timothy B

#5
Quote from: Pumaman on Tue 08/06/2010 22:06:04
The Light Level is a separate option which can brighten the character but doesn't support colour tinting.

So the question is: how can you manually control the light level on the character in the same way the region light level affects the character?  I want to make the character's light level tween into the target light level instead of A: it suddenly snapping into the new brightness/darkness, or B: needing to create a few outer regions to ease the character into the new light.

Obviously I could change the region itself at run time, but since there are multiple characters walking and doing their thing it wouldn't be an effective solution.

Dave Gilbert

I once had to do something similar, so I played with the tints until the character appeared "brighter".  Tinting white seemed to help.

Ryan Timothy B

Hey Dave.  Yeah I've played around with tinting it white, but the closest I can get is a brighter grayed out version of the character.


Anyway, what I'm basically suggesting would be the ability to control the character's light level.  character.LightLevel
Or even better, a reworked tint feature that does the light level as well as colored tint.  That way you can tint your character and change it's light level at the same time. 

As I see it the tint feature right now, it's completely confusing and doesn't offer too much.  Especially since the character.Tint feature has Luminance but the region tint does not.  Perhaps Luminance could be added to the region tint and it could be used to lighten and darken the character just like Light Level (0-200).

As it is now, from what I've read in the manual and played with myself, you can only do one or the other in a region.  Which is changing either the Light Level or the Tint.

Pumaman

Yes, you can only have either a Tint or a Light Level. However, when you use a Tint you can set the Luminance which is the light level, but can only darken and not lighten the character.

It sounds like what you want is a Character.LightLevel property, this sounds reasonable and is something I'll consider for a future version.

Ryan Timothy B

Right on.  Thanks CJ for considering it.
At the moment I'm working with a team on a game with just absolutely beautiful graphics.  I'm the programmer and I'm super picky with just about everything. So any little visual touch up like me being able to auto tween the tint or light level per character would make the transition so smooth and worthwhile. 

So yes, Character.LightLevel or whichever would make an excellent addition in my eyes.

Ryan Timothy B

I'm not sure if this glitch has been fixed or not, I didn't see it in the Fixed section of the new 3.2 release.

Anyway, I'm actually posting in here because I started thinking of something. Having the Character.LightLevel property added to AGS wouldn't exactly help if you're using it to tween the character's Tint or LightLevel from and to each region.

It would work properly when the characters leave one region with LightLevel to another with LightLevel. But if the character is leaving a region with LightLevel to a region with Tint, it would cause visual issues.

What I'm saying is that I still couldn't get smooth color transitions for the character if I had the two types of regions right next to each other; Tint and LightLevel.
I guess when the character is leaving a LightLevel region to enter a Tint region, I could always fade the LightLevel to normal, then fade the Tint to the desired amount, or vice versa. It definitely won't look proper, and could possibly look horrible.


Is there any chance Tint could be modified in the future AGS versions, to do both Tint and LightLevel? Where you can lighten and darken the character just like how LightLevel works plus being able to Tint it at the same time.


If not, I'll still be happy with having a Character.LightLevel property; it's better than not having it at all. Just figured I'd mention what could possibly arise in a situation like that. A little hindsight, if you will.

Dualnames

Quote from: Ryan Timothy on Tue 17/08/2010 23:54:09
Is there any chance Tint could be modified in the future AGS versions, to do both Tint and LightLevel? Where you can lighten and darken the character just like how LightLevel works plus being able to Tint it at the same time.

If not, I'll still be happy with having a Character.LightLevel property; it's better than not having it at all. Just figured I'd mention what could possibly arise in a situation like that. A little hindsight, if you will.

I'd love that, if it's possible. I'd be happy if the last one or both of them is implemented.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk