intergrations to new folder structure done
now we need to fix perfomance in physics before merging / syncing / pushing anything to master
This commit is contained in:
parent
b22f417c42
commit
64e45910a2
17
main.py
17
main.py
@ -1 +1,16 @@
|
|||||||
from core.loaders.particle_loader import ParticleLoader
|
from src.config.settings import cProfile, pstats
|
||||||
|
from src.sandpypi import main
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Profile the application
|
||||||
|
profiler = cProfile.Profile()
|
||||||
|
profiler.enable()
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
profiler.disable()
|
||||||
|
# Write profiling results to file
|
||||||
|
with open('profile_results.log', 'w') as f:
|
||||||
|
stats = pstats.Stats(profiler, stream=f)
|
||||||
|
stats.sort_stats('cumulative')
|
||||||
|
stats.print_stats()
|
||||||
|
|||||||
@ -40,34 +40,30 @@ particles_path = os.path.join(os.path.dirname(__file__), '..', 'part', 'particle
|
|||||||
|
|
||||||
# Load particle properties from JSON file
|
# Load particle properties from JSON file
|
||||||
def load_particle_properties():
|
def load_particle_properties():
|
||||||
# Load core particles
|
|
||||||
particle_data = {}
|
particle_data = {}
|
||||||
print(f"Loading particles from {particles_path}")
|
parts_path = os.path.join(os.path.dirname(__file__), '..', 'part')
|
||||||
# Core particles
|
|
||||||
try:
|
|
||||||
with open(particles_path, 'r') as f:
|
|
||||||
particle_data.update(json.load(f))
|
|
||||||
print(f"Loaded {len(particle_data)} core particles")
|
|
||||||
except (FileNotFoundError, json.JSONDecodeError) as e:
|
|
||||||
print(f"Error loading core particles: {e}")
|
|
||||||
|
|
||||||
# Load mods from mods directory
|
def scan_directory(directory):
|
||||||
mods_path = os.path.join(os.path.dirname(__file__), '..', 'part', 'mods')
|
for root, dirs, files in os.walk(directory):
|
||||||
if os.path.exists(mods_path):
|
for file in files:
|
||||||
for filename in os.listdir(mods_path):
|
if file.endswith('.json'):
|
||||||
if filename.endswith('.json'):
|
file_path = os.path.join(root, file)
|
||||||
mod_file = os.path.join(mods_path, filename)
|
|
||||||
try:
|
try:
|
||||||
with open(mod_file, 'r') as f:
|
with open(file_path, 'r') as f:
|
||||||
mod_data = json.load(f)
|
mod_data = json.load(f)
|
||||||
print(f"Loading mod: {filename}")
|
relative_path = os.path.relpath(file_path, parts_path)
|
||||||
|
print(f"Loading particles from: {relative_path}")
|
||||||
particle_data.update(mod_data)
|
particle_data.update(mod_data)
|
||||||
print(f"Loaded {len(mod_data)} particles from {filename}")
|
print(f"Loaded {len(mod_data)} particles from {relative_path}")
|
||||||
except (FileNotFoundError, json.JSONDecodeError) as e:
|
except (FileNotFoundError, json.JSONDecodeError) as e:
|
||||||
print(f"Error loading mod {filename}: {e}")
|
print(f"Error loading {file_path}: {e}")
|
||||||
|
|
||||||
|
if os.path.exists(parts_path):
|
||||||
|
scan_directory(parts_path)
|
||||||
|
else:
|
||||||
|
print(f"Parts directory not found at {parts_path}")
|
||||||
|
|
||||||
return particle_data
|
return particle_data
|
||||||
|
|
||||||
# Load particle properties once when module is imported
|
# Load particle properties once when module is imported
|
||||||
particle_properties = load_particle_properties()
|
particle_properties = load_particle_properties()
|
||||||
__all__ = ['pygame', 'np', 'random', 'time', 'engine_settings', 'particle_properties', 'cProfile', 'pstats', 'sys', 'os']
|
__all__ = ['pygame', 'np', 'random', 'time', 'engine_settings', 'particle_properties', 'cProfile', 'pstats', 'sys', 'os']
|
||||||
|
|||||||
@ -1,476 +0,0 @@
|
|||||||
{
|
|
||||||
"sand": {
|
|
||||||
"name": "Sand",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.5,
|
|
||||||
"color": [255, 255, 0, 255],
|
|
||||||
"velocity": 0.5,
|
|
||||||
"wind": 1,
|
|
||||||
"mass": 0.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"flamability": 0.8,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0,
|
|
||||||
"pressure": 0,
|
|
||||||
"melt": "molten-glass",
|
|
||||||
"melt_temperature": 1700,
|
|
||||||
"conductive": false,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"water": {
|
|
||||||
"name": "Water",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.3,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [0, 0, 255, 255],
|
|
||||||
"mass": 1,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 22,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 1,
|
|
||||||
"viscosity": 1,
|
|
||||||
"pressure": 0.5,
|
|
||||||
"evaporate": "steam",
|
|
||||||
"evaporate_temperature": 100,
|
|
||||||
"freeze": "ice",
|
|
||||||
"freeze_temperature": 0,
|
|
||||||
"conductive": true,
|
|
||||||
"liquid": true,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"steam": {
|
|
||||||
"name": "Steam",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.0,
|
|
||||||
"velocity": 0.3,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 255, 255, 255],
|
|
||||||
"mass": 0.01,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 100,
|
|
||||||
"solidify_temperature": 98,
|
|
||||||
"solidify": "water",
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": true,
|
|
||||||
"conductive": false
|
|
||||||
},
|
|
||||||
"ice": {
|
|
||||||
"name": "Ice",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 1000,
|
|
||||||
"velocity": 0.0,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 0,
|
|
||||||
"color": [75, 75, 170, 255],
|
|
||||||
"mass": 1,
|
|
||||||
"flamability": 0.0,
|
|
||||||
"temperature": 0,
|
|
||||||
"melt": "water",
|
|
||||||
"melt_temperature": 0.05,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 1,
|
|
||||||
"viscosity": 1,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"mud": {
|
|
||||||
"name": "Mud",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.4,
|
|
||||||
"velocity": 0.5,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [139, 69, 19, 255],
|
|
||||||
"mass": 0.5,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 1,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"fire": {
|
|
||||||
"name": "Fire",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.1,
|
|
||||||
"velocity": 0.1,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 0, 0, 255],
|
|
||||||
"mass": 0.1,
|
|
||||||
"flamability": 1,
|
|
||||||
"temperature": 800,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.1,
|
|
||||||
"viscosity": 0.1,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": true
|
|
||||||
},
|
|
||||||
"smoke": {
|
|
||||||
"name": "Smoke",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.1,
|
|
||||||
"velocity": 0.07,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [115, 113, 95, 255],
|
|
||||||
"mass": 0.01,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 85,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.4,
|
|
||||||
"viscosity": 0.1,
|
|
||||||
"lifetime": 90,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": true
|
|
||||||
},
|
|
||||||
"wall": {
|
|
||||||
"name": "Wall",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 1000,
|
|
||||||
"velocity": 0.0,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 0,
|
|
||||||
"color": [75, 75, 75, 255],
|
|
||||||
"mass": 1,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 1,
|
|
||||||
"viscosity": 1,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"dirt": {
|
|
||||||
"name": "Dirt",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.5,
|
|
||||||
"velocity": 0.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [139, 69, 19, 255],
|
|
||||||
"mass": 0.5,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"stone": {
|
|
||||||
"name": "Stone",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.7,
|
|
||||||
"velocity": 1.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 0,
|
|
||||||
"color": [128, 128, 128, 220],
|
|
||||||
"mass": 1,
|
|
||||||
"flamability": 0,
|
|
||||||
"melt": "molten-Stone",
|
|
||||||
"melt_temperature": 800,
|
|
||||||
"solidify": "stone",
|
|
||||||
"solidify_temperature": 799,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"snow": {
|
|
||||||
"name": "Snow",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.1,
|
|
||||||
"velocity": 0.2,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 255, 255, 255],
|
|
||||||
"mass": 0.01,
|
|
||||||
"flamability": 0,
|
|
||||||
"melt": "water",
|
|
||||||
"melt_temperature": 1,
|
|
||||||
"temperature": 0,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.1,
|
|
||||||
"viscosity": 0.01,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"wood": {
|
|
||||||
"name": "Wood",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.5,
|
|
||||||
"velocity": 0.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [139, 69, 19, 255],
|
|
||||||
"mass": 0.5,
|
|
||||||
"flamability": 0.8,
|
|
||||||
"burning_temperature": 250,
|
|
||||||
"burning_rate": 0.01,
|
|
||||||
"burning_color": [255, 69, 19, 255],
|
|
||||||
"burning": false,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"burning-wood": {
|
|
||||||
"name": "Burning Wood",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.5,
|
|
||||||
"velocity": 0.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 69, 19, 255],
|
|
||||||
"mass": 0.5,
|
|
||||||
"flamability": 0.8,
|
|
||||||
"temperature": 251,
|
|
||||||
"burning": true,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"air": {
|
|
||||||
"name": "Air",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.0,
|
|
||||||
"velocity": 0.0,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 255, 255, 25],
|
|
||||||
"mass": 0.0,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 0,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.0,
|
|
||||||
"viscosity": 0.0,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": true
|
|
||||||
},
|
|
||||||
"lava": {
|
|
||||||
"name": "Lava",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.5,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 45, 60, 255],
|
|
||||||
"mass": 0.3,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 1400,
|
|
||||||
"solidify": "molten-rock",
|
|
||||||
"solidify_temperature": 799,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.8,
|
|
||||||
"viscosity": 0.8,
|
|
||||||
"liquid": true,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"rock": {
|
|
||||||
"name": "Rock",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.3,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [128, 128, 128, 255],
|
|
||||||
"mass": 0.8,
|
|
||||||
"flamability": 0,
|
|
||||||
"melt": "molten-rock",
|
|
||||||
"melt_temperature": 600,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.5,
|
|
||||||
"viscosity": 0.5,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false
|
|
||||||
},
|
|
||||||
"molten-rock": {
|
|
||||||
"name": "Molten Rock",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.3,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 140, 0, 255],
|
|
||||||
"mass": 0.8,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 600,
|
|
||||||
"melt": "lava",
|
|
||||||
"melt_temperature": 1300,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0,0,0],
|
|
||||||
"friction": 0.8,
|
|
||||||
"viscosity": 0.8,
|
|
||||||
"liquid": true,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": false,
|
|
||||||
"solidify": "rock",
|
|
||||||
"solidify_temperature": 200
|
|
||||||
},
|
|
||||||
"molten_stone": {
|
|
||||||
"name": "Molten Stone",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.3,
|
|
||||||
"conductivity": 1,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 140, 0, 255],
|
|
||||||
"mass": 0.8,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 1200,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.8,
|
|
||||||
"viscosity": 0.8,
|
|
||||||
"liquid": true,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": false,
|
|
||||||
"solidify": "stone",
|
|
||||||
"solidify_temperature": 800
|
|
||||||
},
|
|
||||||
"molten_glass": {
|
|
||||||
"name": "Molten Glass",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.4,
|
|
||||||
"conductivity": 0.8,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 200, 150, 200],
|
|
||||||
"mass": 0.6,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 600,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.7,
|
|
||||||
"viscosity": 0.9,
|
|
||||||
"liquid": true,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": false,
|
|
||||||
"solidify": "glass",
|
|
||||||
"solidify_temperature": 599
|
|
||||||
},
|
|
||||||
"glass": {
|
|
||||||
"name": "Glass",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.2,
|
|
||||||
"velocity": 0.4,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [50, 45, 255, 100],
|
|
||||||
"mass": 0.6,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 20,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.7,
|
|
||||||
"viscosity": 0.9,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": true,
|
|
||||||
"is_gas": false,
|
|
||||||
"melt": "molten-glass",
|
|
||||||
"melt_temperature": 600
|
|
||||||
},
|
|
||||||
"plasma": {
|
|
||||||
"name": "Plasma",
|
|
||||||
"size": 1,
|
|
||||||
"hardness": 0.0,
|
|
||||||
"velocity": 0.0,
|
|
||||||
"conductivity": 0,
|
|
||||||
"heat_capacity": 1,
|
|
||||||
"color": [255, 100, 200, 255],
|
|
||||||
"mass": 0.0,
|
|
||||||
"flamability": 0,
|
|
||||||
"temperature": 3600,
|
|
||||||
"explosive": false,
|
|
||||||
"explosion_radius": 0,
|
|
||||||
"explosion_color": [0, 0, 0],
|
|
||||||
"friction": 0.0,
|
|
||||||
"viscosity": 0.0,
|
|
||||||
"liquid": false,
|
|
||||||
"solid": false,
|
|
||||||
"is_gas": true
|
|
||||||
},
|
|
||||||
"wind": {
|
|
||||||
"name": "Wind",
|
|
||||||
"color": [200, 200, 255, 128],
|
|
||||||
"mass": 0.01,
|
|
||||||
"is_wind": true,
|
|
||||||
"wind_strength": 2.0,
|
|
||||||
"wind_direction": [1, 0],
|
|
||||||
"radius": 50,
|
|
||||||
"special": true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -19,10 +19,8 @@ Key Components:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#Load the imports.
|
#Load the imports.
|
||||||
from config.settings import random, time, particle_properties
|
from src.config.settings import random, time, particle_properties
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import math
|
|
||||||
|
|
||||||
# Load particle properties from json so we know what particles we got and how they should be simulated.
|
# Load particle properties from json so we know what particles we got and how they should be simulated.
|
||||||
class Particle:
|
class Particle:
|
||||||
|
|||||||
@ -22,9 +22,8 @@ The `clear_screen` function is used to reset the simulation grid and clear the d
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from config.settings import pygame, random, particle_properties, engine_settings
|
from src.config.settings import pygame, random, particle_properties, engine_settings
|
||||||
from typing import List, Dict
|
|
||||||
import colorsys
|
|
||||||
|
|
||||||
class Rendering:
|
class Rendering:
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,10 @@ The main loop runs at a target frame rate of 60 FPS (this fps varies on my mood
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Import Require files for the Engine.
|
# Import Require files for the Engine.
|
||||||
from config.settings import pygame, cProfile, pstats, engine_settings
|
from src.config.settings import pygame, engine_settings
|
||||||
|
|
||||||
from rendering.rendering import Rendering
|
from src.rendering.rendering import Rendering
|
||||||
from physics.sim import Simulation
|
from src.physics.sim import Simulation
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This is for the future physics engine until i figure out a better method used for testing right now.
|
This is for the future physics engine until i figure out a better method used for testing right now.
|
||||||
@ -320,18 +320,3 @@ def main():
|
|||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# Profile the application
|
|
||||||
profiler = cProfile.Profile()
|
|
||||||
profiler.enable()
|
|
||||||
|
|
||||||
main()
|
|
||||||
|
|
||||||
profiler.disable()
|
|
||||||
# Write profiling results to file
|
|
||||||
with open('profile_results.log', 'w') as f:
|
|
||||||
stats = pstats.Stats(profiler, stream=f)
|
|
||||||
stats.sort_stats('cumulative')
|
|
||||||
stats.print_stats()
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user