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

Issue: Air vs ground grid cost values in non ground pathable areas #81

Closed
raspersc2 opened this issue Sep 15, 2020 · 1 comment
Closed

Comments

@raspersc2
Copy link
Contributor

raspersc2 commented Sep 15, 2020

self.get_air_vs_ground_grid() creates a grid where by default, the ground pathable tiles have a cost of 100 and non pathable of 1. Pretend we add cost to the grid because we see a marine:

air_vs_ground_grid = self.get_air_vs_ground_grid()
pos = marine.position
air_vs_ground_grid = self.add_cost(
            position=(int(pos.x), int(pos.y)),
            radius=marine.range,
            grid=air_vs_ground_grid,
            weight=10,
        )

Then the cost values over ground pathable tiles will correctly update to 110 and non pathable will now be 11

Everything works as it should, but the problem with this, is that units will favour the non pathable tile with a value of 11 (which is now dangerous) over a perfectly safe ground tile that has a default value of 100

My suggestion is that when cost is added over a non pathable area because the radius spans over a non pathable area, the default value for the ground pathable tiles is also added.

Highlighted in red on the picture is an example of what the air vs ground grid thinks is safe, but really it's a dangerous area (in this picture the default weight for pathable areas was set to 50).

grid

@eladyaniv01
Copy link
Owner

That is a very interesting issue, and very relevant to this grid, since the grid should be used vs ground units that shoot up

My suggestion is that when cost is added over a non pathable area because the radius spans over a non pathable area, the default value for the ground pathable tiles is also added.

Sounds like this is a solution, i will play around with that idea

eladyaniv01 added a commit that referenced this issue Sep 21, 2020
… use case is for air_vs_ground grid )

Closes #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants