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

Vectorize map to rgb #143

Open
eugenevinitsky opened this issue Mar 26, 2019 · 1 comment
Open

Vectorize map to rgb #143

eugenevinitsky opened this issue Mar 26, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@eugenevinitsky
Copy link
Owner

The current map to rgb is two nested for loops; this can totally be vectorized.

@eugenevinitsky eugenevinitsky added the enhancement New feature or request label Mar 26, 2019
@eugenevinitsky eugenevinitsky self-assigned this Mar 26, 2019
@internetcoffeephone
Copy link
Contributor

Made redundant in #179.

Instead of calling map to rgb all the time, a zero-padded graphical map (MapEnv.world_map_color) is maintained next to the logical map (MapEnv.world_map). To make updates to the world map, you must now go through a function that also updates the color map.

As updates to the graphical map are thus made whenever necessary, we no longer need a full re-render on every single frame. This saves a lot of computational power, but is more change-error-prone, mainly due to special case handling like beams overlaying agents.

To generate observations, appropriately rotated and bounded numpy slices/views are taken from world_map_color. This is very fast because the observations aren't copied in memory, each observation is just a few pointers to the world map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants