Script beggar : please find my bug for me?

Started by Monsieur OUXX, Fri 17/04/2015 17:45:09

Previous topic - Next topic

Monsieur OUXX

OK I never do that, but I'm so baffled that I see no other option than posting my whole AGS project here. I'm not even going to try trimming down the code to show only the bit of code that causes the issue, because I'm certain the issue comes precisely from some variable being overwritten somewhere where it shouldn't -- hence the need for the entire code.

Here is the scenario:
0) Download the app here : https://www.dropbox.com/s/6rzrq569vccuyvf/EasyPerspective.zip?dl=0
1) Run the app
2) Press key "L" (you'll see the little L at the top of the screen become red)
3) Press key "+" (your cursor changes)
4) Click anywhere. A cross appears. It's white. You'll notice that the caption at the top of the screen says "editMode=1".
5) Press key "space". The caption ow says "editMode=3"... and the cross should appear BLUE. Yet it still appears WHITE. Why, why why???

It all happens in function "Draw_VLines" .

It's so, so weird. The instruction "color=COLOR_BLUE" does get called, the color value is correct, and there is no other cross drawn on top of the expected blue cross.

Pro-tip: You'll notice by reading that function's code that if you press "D" while the cross is getting rendered you get some extra Display calls to see more of what's going on. Pressing D again removes the messages (even though it's a bit tricky to press D to both remove the Display and trigger the debug off. Just hold the key down until you succeed).
 

ChamberOfFear

I'm not sure why, as I don't know how the underlying code of that function. But take a look at what I did here
Code: ags

//EasyPErspective.asc
void game_start()
{
  //COLOR_BLUE = Game.GetColorFromRGB(0, 0, 255); 
  COLOR_BLUE = 32;
}


A quick value check shows that the original Game.GetColorFromRGB(0, 0, 255); gets value 31 instead of 32 which is what I believe you want. In your game project's palette, 31 is white and 32 is blue

Monsieur OUXX

#2
What. The. F**k.

@Chamber of Fear, thank you so much for spending time on my issue!

I know AGS for some time now, but I never realized that it relied on a palette for primitive colors, even in 32-bits games.
@Crimson Wizard or monkey_05_06 or someone else, some behind-the-scene explanations about that, just out of curiosity?

Also, why does GetColorRGB generate an incorrect color value? (white instead of blue) Does it have to do with the "TruBlu paradigm" and the fact that the Blue value, unlike the others, can only go up to 248?
 

ChamberOfFear

#3
I retract my previous statement. After reading the documentation on how Game.GetColorFromRGB works, the function retrieves colors from the Color Finder, not the Palette. A quick check shows that the number 31 is indeed supposed to be blue, with RBG values of (0,0,248).

What I think we have here is a bug, go to the Color finder tool, start with all slider values at 0, and experiment a little. When I gradually slide the Red slider from 0 to 255 it gradually shows me shades of Red, same thing with green. However when I try the same thing with Blue it gives colors of all the rainbow.

EDIT:
It's not a bug, I noticed now when I modify the slider of blue that a message pops up saying that for shades of blue the green slider needs to be set to 4 because of locked color numbers.
I just tested this, it should work:
Code: ags

void game_start()
{
  //COLOR_BLUE = Game.GetColorFromRGB(0, 0, 255);
  COLOR_BLUE = Game.GetColorFromRGB(0, 4, 255);
}/code]

Crimson Wizard

#4
Well, this is a very well known behavior in AGS, which still stores color values in 16-bit mode.

An old thread discussing this:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=43311

Check TrueBlue module:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=43966.0

Monsieur OUXX

#5
Quote from: Crimson Wizard on Sat 18/04/2015 15:54:21
Well, this is a very well known behavior in AGS
i had no idea. i thought the only issue lied in the fact that you can't reach a sufficient granularity in color shades with only 24 bits, and also the "248" upper limit with the blue.
But surely there is a way that GetColorFromRGB(nothing, nil, gimme all the blue you can get); doesn't return "that's white for you, bitch"? :D
 

SMF spam blocked by CleanTalk