sandpypi/physics/REORGANIZATION.md
Stan44 c225632aac laid out and done like most of the ground work
to reorganize the Physics Engine
so that it'll be friendly to others to read.
2024-12-31 01:50:07 -06:00

1.3 KiB

Physics Module Reorganization Plan

1. particle.py

Contains core particle functionality:

  • Full Particle class definition
  • particle_properties handling
  • create_particle()
  • create_particle_circle()
  • transform_particle()
  • get_particle_state()

2. forces.py

Physics and movement systems:

  • calculate_forces()
  • _apply_neighbor_forces()
  • apply_gravity()
  • apply_physics()
  • add_wind_zone()
  • handle_gas_movement()

3. interactions.py

Particle interaction handling:

  • handle_particle_interactions()
  • process_interaction()
  • mix_liquids()
  • create_mud()
  • handle_particle_damage()
  • _get_quick_neighbors()

4. temperature.py

Temperature and state management:

  • handle_temperature()
  • handle_phase_transitions()
  • burning()
  • spread_fire()
  • ignite_particle()
  • handle_special_particles()

5. grid.py

Spatial management systems:

  • update_spatial_grid()
  • get_cell_key()
  • add_to_spatial_grid()
  • remove_from_spatial_grid()
  • _get_neighbors_from_grid()
  • _wake_neighbors()
  • clear_particles_circle()

6. simulation.py

Core simulation coordination:

  • Simulation class (main orchestrator)
  • simulate_step()
  • track_tps()
  • reset_particle_count()
  • get_accurate_particle_count()

Migration Steps

  1. Create new files
  2. Move related code sections
  3. Update imports
  4. Test each component
  5. Update main simulation.py references