OpenTomb icon indicating copy to clipboard operation
OpenTomb copied to clipboard

Lara can't turn

Open Lwmte opened this issue 9 years ago • 37 comments

Does anybody experience this bug? I'm sure everything worked less than one hour ago, but now Lara refuses to turn (although she leans properly).

Lwmte avatar Jul 19 '15 13:07 Lwmte

At least it works for me in 50275d479f93503dcd2c1d3e499ce25b32333e28.

vvs- avatar Jul 19 '15 13:07 vvs-

Well... Something is wrong on my side then! :smile: Although it looks like engine wrongly identifies keyboard input as analog input - i. e. boolean value is treated as integer (degree of analog stick turn).

Lwmte avatar Jul 19 '15 13:07 Lwmte

Is this still valid?

stohrendorf avatar Jul 20 '15 18:07 stohrendorf

No, seems it was some issue with my compiler environment or conflicting commits...

Lwmte avatar Jul 23 '15 16:07 Lwmte

This is very serious.

I believe, the bug is there because whole controls module was converted to boolean logic without taking move_logic and look_logic operations into account.

Lwmte avatar Jul 24 '15 10:07 Lwmte

I still can't reproduce this.

vvs- avatar Jul 24 '15 11:07 vvs-

I actually was very careful when working at the controls; but move_logic and look_logic do the very same as before, as true and false are converted to 1 and 0 in arithmetic expressions (that's defined in the ISO standard of C++).

stohrendorf avatar Jul 24 '15 11:07 stohrendorf

Then I completely don't understand what's happening. It is just very random, but is now much more frequent. Probably really memory corruption issue somewhere?

Lwmte avatar Jul 24 '15 12:07 Lwmte

Funny thing that when I tried to record a video of it in Fraps, it suddenly vanished one more time.

Lwmte avatar Jul 24 '15 12:07 Lwmte

Perhaps it depends on a frame rate? I can't reproduce bugs which require high frame rate for obvious reason :smile:

vvs- avatar Jul 24 '15 12:07 vvs-

Good idea! Fraps forces engine to work at exactly 60 FPS.

Lwmte avatar Jul 24 '15 12:07 Lwmte

It seems that I can't reproduce this bug when I build with Release option set in CMake. Perhaps, it's something related to Bullet as well?

Not sure if we should close this or not... I think I will close it for now, until problem resurfaces with release build. There's already too much things to blame debug build for.

Lwmte avatar Jul 30 '15 14:07 Lwmte

You're not going to believe me, but now I'm getting it with release build.

Lwmte avatar Jul 31 '15 10:07 Lwmte

Is this a 32-bit or a 64-bit build? So far, the only debug/release builds I tested were 64-bit.

stltomb avatar Jul 31 '15 10:07 stltomb

I'm using 64 builds on Linux and 32 bit builds on Windows (both Debug and Release builds), and cannot confirm this.

stohrendorf avatar Jul 31 '15 11:07 stohrendorf

I'm compiling 32-bit, maybe it's related to certain self-built libraries (including Bullet)?

I am using MinGW-64 5.1.0+MSYS2 (latest version).

Lwmte avatar Jul 31 '15 11:07 Lwmte

Are you compiling it using 64-bit compiler targeting 32-bit CPU or using an actual 32-bit compiler? Though, I don't know if it's even possible with gcc.

vvs- avatar Jul 31 '15 12:07 vvs-

I have a self-built Bullet both on Linux and Windows (2.83.5). But from my knowledge 64-bit builds of MinGW were never really considered "stable", i.e. they may produce buggy code.

stohrendorf avatar Jul 31 '15 12:07 stohrendorf

I am compiling using 32-bit compiler (I think so, because all my libs are 32-bit and placed in i686-w64-mingw32 folder).

Right now I have tested the game with my gamepad. It's been a while since I tested it with gamepad, and surprisingly I found another refactoring bug - for some reason, config parsing for movement axes of joypad was removed. But more interesting story is with gamepad and its analog sticks it produces same kind of error - Lara can't turn.

So it's not related to keyboard vs. analog input, as I thought.

Lwmte avatar Aug 07 '15 16:08 Lwmte

Seems I have found a bug. For some reason, when FPS is not power of 60, engine_frame_time returns ridiculous values, like 0.01 or even just 0. I wonder why engine works, and works even at correct speed in such case at all.

So, since rotations are applied based on frame_time values, they are not applied correctly, because frame_time is zero most of the times. Which looks in game as not being able to turn.

Lwmte avatar Aug 07 '15 16:08 Lwmte

I suspect this isn't always the case. Perhaps there is something special in your setup or maybe even MinGW. I never saw such time values and can't reproduce this bug as well.

vvs- avatar Aug 07 '15 17:08 vvs-

What drives me mad is when I modify the source somehow and then recompile it, the bug goes away, but then reappears at some point. Currently I just copied delta * time_scale value into another static temp value and passed it as an argument for Engine_Frame, and bug is gone. But then I just rolled back all the changes and tried to compile it again, and guess what? No bug again!

Lwmte avatar Aug 07 '15 17:08 Lwmte

There exist very tricky bugs with power management, especially CPU states. And sometimes clock values are wrong in such circumstances. That's platform and compiler dependent. I always turn off PM everywhere and that helps.

vvs- avatar Aug 07 '15 17:08 vvs-

I had this happening to me a few days ago randomly. Stopped and started, not had it since though.

Gh0stBlade avatar Aug 10 '15 02:08 Gh0stBlade

Maybe a stupid question, but is your keyboard working properly?

stohrendorf avatar Aug 10 '15 03:08 stohrendorf

Yes, it's totally not related to a keyboard. As I said, the reason is frame_time contains wrong values all along, when FPS is not power of 60. It's either 0.001 or 0 all the time, and 0 is around four times frequent than 0.001. Because of this, rotations are not calculated properly.

I have no idea why it has no effect on animations, since animations should become stuttered as well, but they are not.

Lwmte avatar Aug 10 '15 09:08 Lwmte

I thought it was my keyboard, but I found it works fine on other games when the issue was happening concurrently so definitely an OpenTomb bug.

Gh0stBlade avatar Aug 10 '15 13:08 Gh0stBlade

I had this happen with vsync disabled during framestep testing - the higher the framerate, the slower the turning was. The reason in that case was that Game_ApplyControls() was called more often that the game logic (which it still has to for smooth mouse) and not adding up the total turn for each game logic step - so this may have been fixed by #269.

T4Larson avatar Sep 05 '15 22:09 T4Larson

Actually, it become much worse in #269. I'm getting a very low frame rate and this bug occasionally.

vvs- avatar Sep 06 '15 14:09 vvs-

In #269, the state handler dosn't properly handle slow-turn to fast-turn transition, which are based on the previous flawed frame stepping and animation sizes (like a couple of other state transitions). Have you tried enabling/disabling vsync in the connfig, and see if it makes a difference?

T4Larson avatar Sep 06 '15 17:09 T4Larson