Skip to content

#782 Faster has_line_of_sight function with shapely #782

@akapkotel

Description

@akapkotel

Enhancement request:

Replace current arcade has_line_of_sight implementation with shapely library for faster visibility-checking.

What should be added/changed:

1. shapely library in the requirements.txt

2. shapely imports in arcade.paths.py

shapely-imports

3. paths.has_line_of_sight function would look like this:

shapely-function

What would it help with?

Checking visibility between Sprites would be much faster. Shapely is extremely efficient in finding intersections between geometries.

What documentation needs to change?

Docts for has_line_of_sight method of arcade.paths

What is wrong with it? How can it be improved?

Current has_line_of_sight function works, but it is not so efficient. With just 25 sprites and 25 obstacles if each sprite try to find line of sight to each other, it takes roughly 7 seconds for frame to update! With Shapely it is just 0.18 second: 35 times faster! With 1 player-sprite checking line of sight against 1156 enemies and 25 obstacles, it currently takes about 16 seconds per frame, whereas shapely does the job within 0.09 second

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions