Weird MovementSpeed WalkSpeed problem (3.4.0.7.)

Started by Kumpel, Mon 04/07/2016 01:37:34

Previous topic - Next topic

Kumpel

Hey there,

I am working with 3.4.0.7. and I am having a problem with setting up the walk or/and movement speed of a char.

I began doing all movement with Char.Move because he is not fully visible in the game, but after noticing that the AGS engine seems to be missing a command for setting the general movement speed of a char via code, I changed it all to char.Walk. Now the weird stuff began. First the char got his walkspeed via char.SetWalkSpeed and it worked perfectly, but I missed a few char.Move's and these started behaving strange. The char started moving very fast (like speed 10 and more) now and the value 1 in the option "MovementSpeed" at char properties didn't change that. So I changed that move too but then every "char.walk" also started to have the movement speed. I then tried to reduce the speed with char.SetWalkSpeed and used negative values. At first the char walked as it should, very slow, because I used "-10". But after trying to speed him up, he now ignores every change. Neither SetWalkSpeed(10,10) wouldn't speed him up, nor seems MovementSpeed with any value to make a change.

I also tried enabling/disabling the other option like UniformMovementSpeed, MovementLinkedToAnimation or AdjustSpeedWithScaling. Didn't work either.

Is this possibly a bug in the beta or am I missing something here? How do i reset my char to walk/move in normal speed again?


Not completely related but also weirdly behaving command in 3.4.0.7 is the new char.SetLightLevel (Awesome command!) which seems to be scaled from -100 (formerly value 0 for very dark) to 100 (very bright, formerly value 200) with 0 for normal light(formerly 100). Is this wanted by the developers or did something go wrong here?

Crimson Wizard

#1
Quote from: Kumpel on Mon 04/07/2016 01:37:34
Not completely related but also weirdly behaving command in 3.4.0.7 is the new char.SetLightLevel (Awesome command!) which seems to be scaled from -100 (formerly value 0 for very dark) to 100 (very bright, formerly value 200) with 0 for normal light(formerly 100). Is this wanted by the developers or did something go wrong here?
According to the manual, the value range 0-200 comes from very old (DOS) version of AGS. The only place where you use this range is when you set region's light level in the room editor.
Internally, game still uses -100 -> +100 range, the value that you type in region properties gets converted.
This information may be checked here: http://www.adventuregamestudio.co.uk/wiki/Region_functions_and_properties#Region.LightLevel
Also, I recommend updating to 3.4.0.9 (Beta 2), because it includes the updated manual, explaining all the new commands and their parameter ranges:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=53665.0

Kumpel

Thanks for the advise on updating the beta. It took a few minutes to find a way to test the game in screen-size and not original size (had to build an *.exe, start the setup, change the scaling factor and somehow all this is saved for testing too), because this option is missing in the general game  preferences window, but now it's all good.

No idea about my more pressing issue though? Here is what I did and what once again worked at first and then again not anymore. I put char.SetWalkSpeed (inside an if (!char.Moving clause ... (roll)) before every char.Walk. Somehow this way the engine does what I want. But then again suddenly it does not anymore and runs fast again. Then I channged all the walkspeed values in the SetWalkSpeed-commands once again to negative numbers. Again the char walks slow but at some point, after reducing the speed while something happens, it starts to act strange again. Suddenly all walks are very slow, ignoring the SetWalkSpeed commands to fasten the char again... What the heck is happening here? :-\

Btw could someone explain to me, how SetWalkSpeed works ingame and how this WalkSpeed is connected to MovementSpeed?






Khris

There's two values, AnimationSpeed and MovementSpeed. The latter is changed by SetWalkSpeed, but you should probably change Character.AnimationSpeed instead.
The MovementSpeed is actually a distance, not a speed. And the AnimationSpeed is not a speed either, it's a delay (named AnimationDelay in the editor's character section).

What happens is when the character is walking, AGS changes both the position and frame of the character. An AnimationSpeed of 4 means the character changes position every 4th frame, or ten times per second (default game speed: 40). With each change of position, AGS switches to the next frame of the walking animation, that's why the delay is called "AnimationDelay".

Movement speed is the number of pixels the character moves in between frames. This number is usually determined by the walk cycle sprites; using a value that's too low will create moon walking while using one that's too high will create gliding. In other words, to change how fast the character moves, one should only change the AnimationSpeed. A lower value increases speed. A higher values slows the character down.

If "Movement linked to animation" isn't set to true, AGS will move the character MovementSpeed pixels every frame, and animate the character independent of position changes. This should be used for characters that float, where the walk cycle doesn't have to be synced to the ground.

Kumpel

Thanks for clarifying that for me a little bit. I would have never guessed, that SetWalkSpeed is equivalent to MovementSpeed option and AnimationSpeed is equivalent to AnimationDelay. 8-0 Maybe You guys should consider hinting to that in the help file. I never found it there, or maybe i was just too blind (laugh)

I cleaned the values and did a fresh start:

Since my char isn't seen that much, he has no actual walk animation and floats, as you said (two frames, same view as talk). Therefore changing the AnimationSpeed isn't working as it seems to have no influence at all. I noticed now, that setting the SetWalkSpeed to -1 from the beginning on is a good speed for the sprite. everything higher than 0 makes the char run like hell. (roll)

Now it seems to work as expected. Thanks again, Khris!






SMF spam blocked by CleanTalk