Emerge-Lab / gpudrive

GPU-acceleration of Nocturne via Madrona
https://arxiv.org/abs/2408.01584
MIT License
232 stars 20 forks source link

Code refactor #264

Closed aaravpandya closed 1 month ago

aaravpandya commented 1 month ago

I am making some changes in the code to improve readability and prepare for landing the "change files in runtime" PR. This PR does not change any functionality and is purely aimed at reducing code duplication, removing unwanted/unused code and formatting the code to make it easier to read.

The changes of this PR are -

  1. Improved readability by removing unused variables, functions, parameters, changed types to fix warnings etc.
  2. Factor out common code like setting position, rotation etc for road objects in a helper function to reduce code redundancy. This helps to focus on the logic of creating these road objects.
  3. Factor out setting zero actions in a different functions.
  4. Move computing the "other agents" from reset() to create() as we only need to fill this array once. We dont destroy entities during episodes so, there is no need to do this every reset.
  5. Fixed headless to correctly read from the new "data/examples" folder.
  6. Factored out the custom rules like isAgentStatic, shouldAgentBeControllable etc. into new functions. This makes it easier to find the custom rules we have made.
  7. Applied formatting to types.hpp