OpenGothic icon indicating copy to clipboard operation
OpenGothic copied to clipboard

Ladder Progress

Open thokkat opened this issue 3 years ago • 8 comments

Climbing upstairs works now. Might require some adaptions once downstairs climbing is possible.

I tested only in the swamp/-camp. I guess in the Mines there could be some problems sometimes thanks to the steep edges.

https://github.com/Try/OpenGothic/issues/120

thokkat avatar Sep 21 '22 05:09 thokkat

Hi, @thokkat and thanks for PR!

I have had a quick look at the code, one thing that is suspicious:

- void Interactive::nextState(Npc& npc)

Why this function is no longer needed? What about other interactive objects?

PS: will look more closely at the end of the week

Try avatar Sep 21 '22 19:09 Try

It was only used in the processLadder function.

thokkat avatar Sep 22 '22 00:09 thokkat

Testing right now(Jarkentar only): can't climb down - ladder is not interactive. Can be unrelated issue when holding UpKey, upon climbing, there is a point when key-repeat stops working, at begin at climb

Try avatar Sep 25 '22 20:09 Try

Yes non-interactive ladder upstairs was already the case. After some tries there's sometimes an interactive object found but not at the correct place, The climbing animation is played but the character doesn't move.

thokkat avatar Sep 26 '22 00:09 thokkat

When you climb up, reach the end of the ladder and press the action key after the climbing animation ends, you are now again attached to the ladder but a bit shifted. For most ladders i tested that point looks like the vanilla endpoint after climbing is finished, but could also be coincidental.

thokkat avatar Sep 29 '22 18:09 thokkat

I tried the original nextState like this

const int prev = state;
reverseState=reverse;
if(!setAnim(&npc,Anim::In))
  return;
if (reverse)
  setState(std::max(0,state-1));
else
  setState(std::min(stateNum,state+1));
loopState = (prev==state);

but it shows micro stuttering because the animation for the next state is only started after a key press triggers it. Stuttering was also happening before but less noticeable. Also removed the marvin stuff. Like you said it's artificial. Got a bit tricked by memory but vanilla shows it's a smooth process.

thokkat avatar Sep 30 '22 14:09 thokkat

Hi, @thokkat ! Sorry, for late response, bit to much code review in flight :) for debugging, you can use F9/F10, to have frame-by-frame debugging: F9 - pause F10 - next frame

Setting MAX_FPS to low values in gothic.ini file can also be useful.

Try avatar Oct 03 '22 21:10 Try

@Try, everything works so far, i think you can review. Vanilla G2 crashes for me when entering Jharkendar so i don't know if G2 behavior is replicated correctly.

Still to do but i don't know how:

  • Stuttering issue. At the end of an animation the character is lifted for like 2 frames and then moved back. This results in mini stuttering, less noticeable if fps are high and causes a bit of camera shaking sometimes after climbing upstairs is finished.
  • AI

thokkat avatar Oct 13 '22 18:10 thokkat

Some footage so you know what i mean with tilted ladders.

https://user-images.githubusercontent.com/100468436/196058888-7322be56-b4a3-44c4-9f90-22f1c0900549.mp4

https://user-images.githubusercontent.com/100468436/196058889-ef350bce-50c7-4850-b7e7-9f0c1d4cfbc1.mp4

https://user-images.githubusercontent.com/100468436/196058957-8b7a87f7-e868-42f1-a1c2-f9fff06d2cd2.mp4

thokkat avatar Oct 16 '22 21:10 thokkat

I made the aforementioned changes. Tell me if there*s more to do.

thokkat avatar Oct 19 '22 16:10 thokkat

@Try, reminder for review, now that phoenix has been merged ;) . G2 works as expected. In G1 there's now a general bug so animations aren't played.

thokkat avatar Nov 07 '22 17:11 thokkat

@Try, I cleaned up the abs stuff. Vec3(c,0,s) moves the character leftwards and i only found it in camera.cpp. Vec3(s,0,-c) is copied from marvinF8/K routines,

thokkat avatar Nov 09 '22 20:11 thokkat

Merged, thanks!

Try avatar Nov 09 '22 23:11 Try