Opened 3 years ago

Closed 3 weeks ago

#13177 closed defect (fixed)

TWINE: Tank is stuck

Reported by: vvs- Owned by: mgerhardy
Priority: normal Component: Engine: TwinE
Version: Keywords: collision-detection
Cc: Game: Little Big Adventure

Description

In Hamalayi Range scene 63 after capturing tank it can't leave this scene and become stuck. This makes it impossible to continue without cheating.

You can use the same savegame as in #13168

Attachments (3)

scummvm-lba-cd-00000.png (312.4 KB ) - added by vvs- 3 years ago.
script1.2.log (74.7 KB ) - added by mgerhardy 3 years ago.
added script dump for actor 1 (the tank)
Bildschirmfoto vom 2022-05-29 16-03-49.png (50.6 KB ) - added by mgerhardy 2 years ago.

Download all attachments as: .zip

Change History (32)

by vvs-, 3 years ago

Attachment: scummvm-lba-cd-00000.png added

comment:1 by mgerhardy, 3 years ago

Priority: normalhigh

by mgerhardy, 3 years ago

Attachment: script1.2.log added

added script dump for actor 1 (the tank)

comment:2 by mgerhardy, 3 years ago

Priority: highblocker

comment:3 by mgerhardy, 3 years ago

error must be here: Animations::processActorAnimations the if block with actor->_staticFlags.bComputeCollisionWithBricks

comment:4 by mgerhardy, 3 years ago

The problem is in the lines:

checkActorCollisionWithBricks(actor->_boudingBox.mins.x, actor->_boudingBox.mins.y, actor->_boudingBox.mins.z, 1);
checkActorCollisionWithBricks(actor->_boudingBox.maxs.x, actor->_boudingBox.mins.y, actor->_boudingBox.mins.z, 2);
checkActorCollisionWithBricks(actor->_boudingBox.maxs.x, actor->_boudingBox.mins.y, actor->_boudingBox.maxs.z, 4);
checkActorCollisionWithBricks(actor->_boudingBox.mins.x, actor->_boudingBox.mins.y, actor->_boudingBox.maxs.z, 8);

comment:5 by mgerhardy, 3 years ago

should be fixed in master with 3d5d5317a88b8e96b220ad65b0d930c93dd024bb

comment:6 by mgerhardy, 3 years ago

Owner: set to mgerhardy
Resolution: fixed
Status: newclosed

comment:7 by mgerhardy, 2 years ago

Resolution: fixed
Status: closednew

This fix introduced another issue in collision in e.g. scene 35 (the sokoban scene) - you can now move crates into the walls

comment:8 by mgerhardy, 2 years ago

Script of the tank (actor 1)

COMPORTMENT main 
  IF FLAG_GAME 78 == 1 
    SUICIDE 
  ELSE 
    SET_COMPORTMENT 1 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  ONEIF HIT_BY == 7 
    SET_TRACK 1 
    SET_COMPORTMENT_OBJ 8 2 
  ENDIF 
END_COMPORTMENT 
END

Script of the hero (actor 0)

COMPORTMENT main 
  IF FLAG_GAME 74 == 1 
    SET_COMPORTMENT 1 
  ELSE 
    SET_COMPORTMENT 3 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  ONEIF LIFE_POINT_OBJ 7 == 0 
    IF FLAG_GAME 78 == 0 
      SET_FLAG_GAME 73 0 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 0 
      SET_FLAG_GAME 75 1 
    ENDIF 
  ENDIF 
  IF COL == 1 
    IF CURRENT_TRACK_OBJ 7 == 107 
      SET_DIRMODE NO_MOVE 
      INVISIBLE 1 
      ANIM 0 
      SET_BEHAVIOUR NORMAL 
      SET_TRACK 0 
      CAM_FOLLOW 1 
      SET_TRACK_OBJ 1 0 
      SET_COMPORTMENT 2 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 2 
  IF CURRENT_TRACK_OBJ 1 == 100 
    SET_FLAG_GAME 78 1 
    IF FLAG_GAME 6 == 1 
      BODY 0 
    ELSE 
      BODY 1 
    ENDIF 
    POS_POINT 15 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 3 
END_COMPORTMENT 
END

Script of the helper (actor 7)

COMPORTMENT main 
  OR_IF FLAG_GAME 77 == 1 
  OR_IF FLAG_GAME 89 == 0 
  IF FLAG_GAME 74 == 0 
    SUICIDE 
  ELSE 
    SET_COMPORTMENT 1 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 1 
  IF ZONE_OBJ 0 == 0 
    IF ZONE == 0 
      SET_FLAG_GAME 73 1 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 0 
    ENDIF 
  ELSE 
    IF ZONE_OBJ 0 == 1 
      IF ZONE == 1 
        SET_FLAG_GAME 73 0 
        SET_FLAG_GAME 72 0 
        SET_FLAG_GAME 74 0 
      ENDIF 
    ELSE 
      SET_FLAG_GAME 73 0 
      SET_FLAG_GAME 72 0 
      SET_FLAG_GAME 74 1 
    ENDIF 
  ENDIF 
  SWIF DISTANCE 0 > 2500 
    SET_DIRMODE FOLLOW 0 
    ANIM 27 
  ENDIF 
  SWIF DISTANCE 0 < 2000 
    IF DISTANCE 4 < 6000 
      SET_DIRMODE FOLLOW 4 
      ANIM 144 
      SET_COMPORTMENT 2 
    ELSE 
      ANIM 0 
    ENDIF 
  ENDIF 
  IF FLAG_GAME 71 == 1 
    IF LIFE_POINT_OBJ 7 < 50 
      SET_LIFE_POINT_OBJ 7 50 
    ENDIF 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 4 == 0 
    SET_DIRMODE NO_MOVE 
    IF LIFE_POINT_OBJ 2 > 0 
      IF ZONE == 0 
        SET_TRACK 10 
      ELSE 
        SET_TRACK 0 
      ENDIF 
    ENDIF 
    SET_COMPORTMENT 3 
  ENDIF 
  ONEIF ZONE == 3 
    IF FLAG_GAME 78 == 0 
      SET_DIRMODE NO_MOVE 
      IF LIFE_POINT_OBJ 5 > 0 
        SET_TRACK 3 
      ELSE 
        IF LIFE_POINT_OBJ 6 > 0 
          SET_TRACK 4 
        ENDIF 
      ENDIF 
      SET_COMPORTMENT 4 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 2 
  OR_IF DISTANCE 0 > 3000 
  IF LIFE_POINT_OBJ 4 == 0 
    SET_DIRMODE FOLLOW 0 
    ANIM 27 
    SET_COMPORTMENT 1 
  ENDIF 
  IF FLAG_GAME 71 == 1 
    IF LIFE_POINT_OBJ 7 < 50 
      SET_LIFE_POINT_OBJ 7 50 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 3 
  ONEIF CURRENT_TRACK == 100 
    SET_DIRMODE FOLLOW 2 
  ENDIF 
  ONEIF CURRENT_TRACK == 101 
    SET_DIRMODE FOLLOW 3 
  ENDIF 
  ONEIF CURRENT_TRACK == 110 
    SET_TRACK 0 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 2 == 0 
    IF LIFE_POINT_OBJ 3 > 0 
      SET_DIRMODE NO_MOVE 
      SET_TRACK 1 
    ENDIF 
  ENDIF 
  IF LIFE_POINT_OBJ 2 == 0 
    IF LIFE_POINT_OBJ 3 == 0 
      SET_DIRMODE FOLLOW 0 
      SET_TRACK 2 
      SET_COMPORTMENT 1 
    ENDIF 
  ENDIF 
END_COMPORTMENT 
COMPORTMENT 4 
  ONEIF CURRENT_TRACK == 103 
    SET_DIRMODE FOLLOW 5 
  ENDIF 
  ONEIF CURRENT_TRACK == 104 
    SET_DIRMODE FOLLOW 6 
  ENDIF 
  ONEIF CURRENT_TRACK == 105 
    SET_TRACK_OBJ 1 2 
    MESSAGE 2 
    SET_DIRMODE FOLLOW 1 
  ENDIF 
  ONEIF CURRENT_TRACK == 108 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
    EXPLODE_OBJ 1 
  ENDIF 
  ONEIF LIFE_POINT_OBJ 5 == 0 
    SET_DIRMODE NO_MOVE 
    IF LIFE_POINT_OBJ 6 > 0 
      SET_TRACK 4 
    ENDIF 
  ENDIF 
  IF LIFE_POINT_OBJ 5 == 0 
    ONEIF LIFE_POINT_OBJ 6 == 0 
      SET_DIRMODE NO_MOVE 
      SET_TRACK 5 
    ENDIF 
  ENDIF 
  ONEIF CURRENT_TRACK == 106 
    SET_DIRMODE NO_MOVE 
  ENDIF 
  ONEIF CURRENT_TRACK == 107 
    SET_DIRMODE FOLLOW 1 
  ENDIF 
  ONEIF COL == 1 
    SUICIDE 
  ENDIF 
END_COMPORTMENT 
END 
Last edited 2 years ago by mgerhardy (previous) (diff)

comment:9 by mgerhardy, 2 years ago

get the helper with debug commands

set_game_flag 77 0
set_game_flag 89 1
set_game_flag 74 1
change_scene 63
toggle_god_mode

force the track 2 for actor 1 (the tank) to start without playing the scene

change_scene 63
scene_actor 1
toggle_free_camera
set_track_obj 1 2
Last edited 2 years ago by mgerhardy (previous) (diff)

comment:10 by mgerhardy, 2 years ago

found a revision that worked for both test cases: 0a4460ba343fb394f2385559bab90b404140dd25

Last edited 2 years ago by mgerhardy (previous) (diff)

comment:12 by mgerhardy, 2 years ago

comment:13 by lotharsm, 2 years ago

Priority: blockerhigh

comment:14 by mgerhardy, 2 years ago

The tank is hanging on brickShape ShapeType::kStairsBottomLeft

comment:15 by vvs-, 2 years ago

Hmm... Now that you've said this, I remember that there is a bug where Twinsen would get stuck in a corners (doors, bricks). That happens quite often.

comment:16 by mgerhardy, 2 years ago

a report from a user that might also be related to this collision bug:

  • you can also sometimes go behind tiles, or get stuck near a door that's opening

comment:17 by mgerhardy, 2 years ago

94e339a382f7f417ca369602c882d4f3c5b8e0ce reduced the hack to the tank scene. this makes the sokoban scene work again.

comment:18 by mgerhardy, 2 years ago

Priority: highnormal

Changed prio to normal because a hack is in place.

comment:19 by mgerhardy, 21 months ago

https://github.com/mgerhardy/lba1-classic-community/tree/debug contains a version with a few debug options compiled in

comment:20 by xesf, 18 months ago

I wonder if this issue has to do with Bounding Boxes not rotating when doing the collision check?

The truck doesn't have a squared bounding box, so when it turns, if the Bounding Box has the same orientation it can leave to collision issues.

comment:21 by mgerhardy, 18 months ago

Maybe - I am unsure. I wasn't able to tackle the issue yet. If you maybe still remember those parts... any help would be more than welcome.

comment:22 by xesf, 18 months ago

Sure, I can have a look.

comment:23 by xesf, 18 months ago

It worked fine. I wonder this has been fixed before.

comment:24 by mgerhardy, 15 months ago

Keywords: collision-detection added

comment:25 by mgerhardy, 3 weeks ago

I've found the cause of the problem - the BodyData instances are shared across several actors - this is wrong. The new loading that was introduced in 8c76c1fac7c9f97fe45a074035ee0ce9e3a31597 removed the BodyData instance in the bodyData array per entity/model - but instead shared the BodyData entry for each model with the same hqr index.

comment:26 by mgerhardy, 3 weeks ago

The BodyData member should maybe be part of the EntityBody struct - so each EntityBody has its own BodyData member.

comment:27 by xesf, 3 weeks ago

Is this issue from the TwinEngine? or something introduced in ScummVM?

comment:28 by mgerhardy, 3 weeks ago

In af35f3f1:

TWINE: removed hack from issue #13177

https://bugs.scummvm.org/ticket/13177

get the helper with debug commands

set_game_flag 77 0
set_game_flag 89 1
set_game_flag 74 1
change_scene 63
toggle_god_mode
force the track 2 for actor 1 (the tank) to start without playing the scene

change_scene 63
scene_actor 1
toggle_free_camera
set_track_obj 1 2

comment:29 by mgerhardy, 3 weeks ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.