Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: PathFinding freezes or the character does not move #512

Open
nyuntaka opened this issue May 7, 2024 · 2 comments
Open

[Bug]: PathFinding freezes or the character does not move #512

nyuntaka opened this issue May 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@nyuntaka
Copy link

nyuntaka commented May 7, 2024

What happened?

When creating a slightly complex map, PathFinding freezes or the character does not move.

Freeze example:
https://github.com/RafaelBarbosatec/bonfire/assets/14065274/e8e4b9aa-262e-4896-a62a-d48d8d37d9b7

Example of not moving:
https://github.com/RafaelBarbosatec/bonfire/assets/14065274/10b2d269-12d1-4d81-8226-e9713e51f095

Steps to reproduce?

class HumanPathFinding extends HumanPlayer with PathFinding, TapGesture {
  HumanPathFinding({required Vector2 position}) : super(position: position) {
    // setupPathFinding(pathLineStrokeWidth: 2);
    setupPathFinding(
      // linePathEnabled: true,
      // pathLineColor: Colors.lightBlueAccent.withOpacity(0.5),
      // barriersCalculatedColor: Colors.blue.withOpacity(0.5),
      // pathLineStrokeWidth: 4,
      showBarriersCalculated:
          true, // uses this to debug. This enable show in the map the tiles considered collision by algorithm.
      useOnlyVisibleBarriers: false,

      // If `false` the algorithm use map tile size with base of the grid. if true this use collision size of the component.
      gridSizeIsCollisionSize: true,
      // factorInflateFindArea: 2,
    );
  }

  @override
  void onTap() {}

  @override
  void onTapDownScreen(GestureEvent event) {
    // moveToPositionWithPathFinding(event.worldPosition);
    var path = getPathToPosition(event.worldPosition);
    debugPrint("240507 path=$path");
    moveAlongThePath(path);
    super.onTapDownScreen(event);
  }
}

What did you expect to happen?

I don't want it to freeze.
If there is nothing blocking it, please move correctly.

Bonfire version

3.8.5

Relevant log output

When freezing: No response

When not moving:
240507 path=[[56,56], [56,120]]
240507 path=[[56,120], [104,120], [104,152], [88,152]]
240507 path=[[88,152], [72,152]]
240507 path=[]
240507 path=[]
240507 path=[]
240507 path=[]
@nyuntaka nyuntaka added the bug Something isn't working label May 7, 2024
@RafaelBarbosatec
Copy link
Owner

Hi @nyuntaka !
I will analyze this vídeos and try reproduce then.
It seems a stress test ☺️.
Maybe some problem in create the matrix of possible collision.

@nyuntaka
Copy link
Author

nyuntaka commented May 7, 2024

I look forward to resolving this issue. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants