technical problems with alpha channels and area scaling

Started by stuh505, Sat 29/05/2004 01:24:11

Previous topic - Next topic

stuh505

1 - i've noticed i get a faint but very noticeable black box surrounding sprites displayed with an alpha channel, even though the edge of the alpha channel is pure black.  This problem occurs when the importated sprite is shown in the editor as having a solid color border.  if the sprite is shown with a pink "transparent" border, the problem doesn't happen.  however, there doesn't seem to be a way to choose between the two...sometimes when I choose "upper left corner transparent" it will show that color as transparent even though it is being overrided by the alpha channel...and other times, it keeps it the regular color...under the same circumstances i've had it go either way.  but many sprites just seem to always want to have a black border and no matter how many times i try to re-upload it it wont get that pink border.

2 - the second problem isn't actually with the area scaling, it's with the "adjust character speed with scaling function," which just doesn't seem to work right.  with little scaling, my character appears to walk normally.  but zoomed out, his walk step will cause him to jump up to double his sprite width...when close up, he does not do this.  it also is getting really wierd pauses, so what i see is my character pauses...takes a huge jump across the screen...pauses...repeats, it looks nothing like walking :/ 

Hollister Man

#1
Try un-checking (or checking) the adjust speed with scaling box in the character palette.  It will stop the character from slowing at small sizes, but it works.  Supposedly CJ has fixed it in a new release?Ã,  (haven't downloaded it yet myself. :/)
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

stuh505

but i need it slowed...have you seen my latest background in the critics lounge?  I go down to 5% scaling in that...he'd be walking like 80 mph..

Hollister Man

I know, but does it solve your problem with the jumpiness?  Have you downloaded the latest release?  It is a problem with the scaling and speed, I'll bet you.  Its probably related to the 'stop moving, walk forever' bug in Garfield.  Speed scaling is awesome, but the reason it took so long to implement is that it took rewriting very old code to make it work, I think.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

Fekix

hmm maybe you can solve the speed problem with scripting. I didn't test it myself but i thought of this in repeadely_execute:

Code: ags
SetCharacterSpeed(6/(GetPlayerCharacter(), GetScalingAt(character.[GetPlayerCharacter()].x, character.[GetPlayerCharacter()].y))*100);


Maybe there's something wrong with the syntax but maybe it helps you :)
Code: ags
Currently working on: My Little Real Life Adventure

Pumaman

If the alpha channel is definitely 255, you should not get the pixel displayed at all.

Can you upload something that demonstrates the problem for both (1) and (2)? I haven't seen problems like this myself.

stuh505

problem 1 - well...it turns out this is actually a bug in photoshop (6.0), not in AGS.  whenever I resize an image, it very slightly increases the brightness of all the outer pixels.  this explains why I was getting a faint outline, after having made sure the alpha channel was purely transparent there.

problem 2 - is there a way to script around this?  Fekix posted a way (with a few syntax errors :P) but even if those errors are removed it still won't work because there is division that will create a non-integer and there is no integer() function.

pumaman, I made a test game with nothing but 1 background and the ROGER char...buts it's 13.7 MB, even so...wouldn't know where to host it.

I haven't done thorough testing, but the problem occurs at least in the following situation: set ROGER's speed to 16, make him walk a scaled distance from 200% down to 5%.  He walks smoothly at first, then he starts bunny hopping like crazy...

Gilbert

#7
Quote from: stuh505 on Mon 31/05/2004 04:23:30
problem 2 - is there a way to script around this?Ã,  Fekix posted a way (with a few syntax errors :P) but even if those errors are removed it still won't work because there is division that will create a non-integer and there is no integer() function.

Well actually there's no non-integer operation in AGS currently, so the division is integer division already. I don't know, and never tested, but I think the "correct" code should be:

SetCharacterSpeed(GetPlayerCharacter(), (6*GetScalingAt(character.[GetPlayerCharacter()].x, character.[GetPlayerCharacter()].y))/100);

It probably won't work anyways as SetCharacterSpeed() is not meant to be called when the character is moving.

Gilbert

I just did a little testing with roger on a bg of 10% to 200% scaling, and I don't have the "jumping" problem in the small size. Have you tried checking "anti-glide" mode (or vice versa) ?

Scummbuddy

Quote from: stuh505 on Mon 31/05/2004 04:23:30
pumaman, I made a test game with nothing but 1 background and the ROGER char...buts it's 13.7 MB, even so...wouldn't know where to host it.

is that just the game folder, or compiled, or what? and is that zipped?
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Scorpiorus

#10
Quote from: Gilbot V7000a on Mon 31/05/2004 04:59:20SetCharacterSpeed(GetPlayerCharacter(), (6*GetScalingAt(character.[GetPlayerCharacter()].x, character.[GetPlayerCharacter()].y))/100);

It probably won't work anyways as SetCharacterSpeed() is not meant to be called when the character is moving.
Yeah, it won't work because changing the speed in that way would force the pathfinder to recalculate the path and therefore stop the character first with the StopMoving command.Ã,  But afaik, the SetCharacterSpeed() just stops the character if he is currently moving, thus you have to do MoveCharacter after changing the speed in either way. I'm afraid that's something impossible to achieve with the scripting only unless you also simulate pathfinder functionality but that would be rather slow with scripting anyway.

Pumaman

2. I think the effect you're seeing here is because you're using a walking speed of 16. At this sort of speed, the method used for adjusting speed with scaling doesn't look too good.

Mind if I ask why on earth you're using such a huge movement speed? I can't say I'd expect it to look good with any kind of movement at that speed.

stuh505

Quote2. I think the effect you're seeing here is because you're using a walking speed of 16. At this sort of speed, the method used for adjusting speed with scaling doesn't look too good.

well i think the speed is a literal amount of pixels it jumps or something, not a factor of character size...and with a reasonably sized character(350 pix high) in 800x600, i find it necessary to have a speed 14-20 to have natural looking walk for my characters.

why would the method of adjusting speed not work with higher numbers?  why wouldn't it just keep the speed scalaing synchronized with the character scaling?

QuoteSetCharacterSpeed(GetPlayerCharacter(), (6*GetScalingAt(character.[GetPlayerCharacter()].x, character.[GetPlayerCharacter()].y))/100);

It probably won't work anyways as SetCharacterSpeed() is not meant to be called when the character is moving.
Yeah, it won't work because changing the speed in that way would force the pathfinder to recalculate the path and therefore stop the character first with the StopMoving command.  But afaik, the SetCharacterSpeed() just stops the character if he is currently moving, thus you have to do MoveCharacter after changing the speed in either way. I'm afraid that's something impossible to achieve with the scripting only unless you also simulate pathfinder functionality but that would be rather slow with scripting anyway.

yeah, this is the code that i tried earlier...but it won't even compile, it says "invalid value for speed parameter" or something like that, I was assuming because it didn't know what to do with the decimel.

Quoteis that just the game folder, or compiled, or what? and is that zipped?

exe uncompressed

QuoteI just did a little testing with roger on a bg of 10% to 200% scaling, and I don't have the "jumping" problem in the small size. Have you tried checking "anti-glide" mode (or vice versa) ?

disabling anti glide did remove the bunny hoping, but it just replaced it with sliding...not exactly a solution.  it also seems to speed the character up a lot.

did you have a high speed value in your test (16-20)?


Pumaman

Quote from: stuh505 on Mon 31/05/2004 16:58:45
why would the method of adjusting speed not work with higher numbers?Ã,  why wouldn't it just keep the speed scalaing synchronized with the character scaling?

It works just fine, but the problem is that it doesn't look good.

Basically, the character moves each time their animation frame changes. At 100% scaling, your character will move 16 pixels each time.

At 200% scaling, the character will move 32 pixels each time, which is rather a large distance to move in one go, which is why it looks 'jumpy'.

It cannot intersperse the movement between animation frames, because if it did you'd get the gliding effect.

To reduce the effect, you can try speeding up the character's animation speed.

stuh505

Pumaman, that is not the problem I am having...

My problem is that down at 10% scaling I would expect him to be jumping only 1.6 (1 or 2) pixels...but instead he is jumping near 16.

Pumaman

Ah, in that case I see what you mean. Currently the scaling movement adjuster works in increments of half the move speed, and changes the delay between each update to get the right speed.

This looks fine on characters with normal walk speeds, but with a speed of 16 I can see how it would look a bit jumpy, because it'll still be moving in units of 8 pixels. I'll add it to my list.

Hollister Man

Like the P-Man said, you might try increasing the animation speed of your character and reducing the walk speed.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

SMF spam blocked by CleanTalk