From 7692acfdf7d8e32b20f0e6ffdb0eb5862139c1ae Mon Sep 17 00:00:00 2001 From: Jacob Schmidt Date: Sat, 28 Dec 2024 16:54:21 -0600 Subject: [PATCH] Directory Structure & Particle Organization --- .vscode/settings.json | 3 + main.py | 1 + requirements.txt | 2 + src/config/particles/elements/basic.json | 67 +++++++++++++++++++ src/config/particles/elements/gases.json | 53 +++++++++++++++ src/config/particles/elements/liquids.json | 42 ++++++++++++ src/config/particles/elements/solids.json | 76 ++++++++++++++++++++++ src/config/particles/special/effects.json | 56 ++++++++++++++++ src/config/particles/special/forces.json | 39 +++++++++++ src/config/particles/states/burning.json | 59 +++++++++++++++++ src/config/particles/states/frozen.json | 38 +++++++++++ src/config/particles/states/molten.json | 58 +++++++++++++++++ src/core/loaders/__init__.py | 0 src/core/loaders/particle_loader.py | 35 ++++++++++ 14 files changed, 529 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 main.py create mode 100644 requirements.txt create mode 100644 src/config/particles/elements/basic.json create mode 100644 src/config/particles/elements/gases.json create mode 100644 src/config/particles/elements/liquids.json create mode 100644 src/config/particles/elements/solids.json create mode 100644 src/config/particles/special/effects.json create mode 100644 src/config/particles/special/forces.json create mode 100644 src/config/particles/states/burning.json create mode 100644 src/config/particles/states/frozen.json create mode 100644 src/config/particles/states/molten.json create mode 100644 src/core/loaders/__init__.py create mode 100644 src/core/loaders/particle_loader.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..461b413 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cody.agentic.context.experimentalShell": true +} diff --git a/main.py b/main.py new file mode 100644 index 0000000..d154e68 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +from core.loaders.particle_loader import ParticleLoader \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e5b394d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +numpy +pygame \ No newline at end of file diff --git a/src/config/particles/elements/basic.json b/src/config/particles/elements/basic.json new file mode 100644 index 0000000..d2c5716 --- /dev/null +++ b/src/config/particles/elements/basic.json @@ -0,0 +1,67 @@ +{ + "sand": { + "name": "Sand", + "size": 1, + "hardness": 0.5, + "color": [255, 255, 0, 255], + "velocity": 0.5, + "mass": 0.5, + "temperature": 20, + "melt": "molten-Glass", + "melt_temperature": 1700, + "friction": 0.5, + "liquid": false, + "solid": true, + "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 + }, + "dirt": { + "name": "Dirt", + "size": 1, + "hardness": 0.5, + "color": [139, 69, 19, 255], + "velocity": 0.5, + "mass": 0.5, + "temperature": 20, + "friction": 0.5, + "liquid": false, + "solid": true, + "is_gas": false + }, + "stone": { + "name": "Stone", + "size": 1, + "hardness": 0.7, + "velocity": 1.5, + "color": [128, 128, 128, 220], + "mass": 1, + "temperature": 20, + "melt": "molten-Stone", + "melt_temperature": 800, + "friction": 0.5, + "liquid": false, + "solid": true, + "is_gas": false + } +} \ No newline at end of file diff --git a/src/config/particles/elements/gases.json b/src/config/particles/elements/gases.json new file mode 100644 index 0000000..3c13456 --- /dev/null +++ b/src/config/particles/elements/gases.json @@ -0,0 +1,53 @@ +{ + "steam": { + "name": "Steam", + "size": 1, + "hardness": 0.0, + "velocity": 0.3, + "conductivity": 1, + "heat_capacity": 1, + "color": [255, 255, 255, 255], + "mass": 0.01, + "temperature": 100, + "solidify_temperature": 98, + "solidify": "water", + "friction": 0.5, + "viscosity": 0.5, + "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, + "temperature": 85, + "friction": 0.4, + "viscosity": 0.1, + "lifetime": 90, + "liquid": false, + "solid": false, + "is_gas": true + }, + "air": { + "name": "Air", + "size": 1, + "hardness": 0.0, + "velocity": 0.0, + "conductivity": 0, + "heat_capacity": 1, + "color": [255, 255, 255, 25], + "mass": 0.0, + "temperature": 0, + "friction": 0.0, + "viscosity": 0.0, + "liquid": false, + "solid": false, + "is_gas": true + } +} \ No newline at end of file diff --git a/src/config/particles/elements/liquids.json b/src/config/particles/elements/liquids.json new file mode 100644 index 0000000..e1c31b5 --- /dev/null +++ b/src/config/particles/elements/liquids.json @@ -0,0 +1,42 @@ +{ + "water": { + "name": "Water", + "size": 1, + "hardness": 0.2, + "velocity": 0.3, + "conductivity": 1, + "heat_capacity": 1, + "color": [0, 0, 255, 255], + "mass": 1, + "temperature": 22, + "evaporate": "steam", + "evaporate_temperature": 100, + "freeze": "ice", + "freeze_temperature": 0, + "friction": 1, + "viscosity": 1, + "pressure": 0.5, + "conductive": true, + "liquid": true, + "solid": false, + "is_gas": false + }, + "lava": { + "name": "Lava", + "size": 1, + "hardness": 0.2, + "velocity": 0.5, + "conductivity": 0, + "heat_capacity": 1, + "color": [255, 45, 60, 255], + "mass": 0.3, + "temperature": 1400, + "solidify": "molten-rock", + "solidify_temperature": 799, + "friction": 0.8, + "viscosity": 0.8, + "liquid": true, + "solid": false, + "is_gas": false + } +} \ No newline at end of file diff --git a/src/config/particles/elements/solids.json b/src/config/particles/elements/solids.json new file mode 100644 index 0000000..2849fac --- /dev/null +++ b/src/config/particles/elements/solids.json @@ -0,0 +1,76 @@ +{ + "wall": { + "name": "Wall", + "size": 1, + "hardness": 1000, + "velocity": 0.0, + "conductivity": 0, + "heat_capacity": 0, + "color": [75, 75, 75, 255], + "mass": 1, + "temperature": 20, + "friction": 1, + "viscosity": 1, + "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], + "temperature": 20, + "friction": 0.5, + "viscosity": 0.5, + "liquid": false, + "solid": true, + "is_gas": false + }, + "glass": { + "name": "Glass", + "size": 1, + "hardness": 0.2, + "velocity": 0.4, + "conductivity": 0, + "heat_capacity": 1, + "color": [50, 45, 255, 100], + "mass": 0.6, + "temperature": 20, + "melt": "molten-glass", + "melt_temperature": 600, + "friction": 0.7, + "viscosity": 0.9, + "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 + } +} \ No newline at end of file diff --git a/src/config/particles/special/effects.json b/src/config/particles/special/effects.json new file mode 100644 index 0000000..9c0e3c7 --- /dev/null +++ b/src/config/particles/special/effects.json @@ -0,0 +1,56 @@ +{ + "plasma": { + "name": "Plasma", + "size": 1, + "hardness": 0.0, + "velocity": 0.0, + "conductivity": 0, + "heat_capacity": 1, + "color": [255, 100, 200, 255], + "mass": 0.0, + "temperature": 3600, + "friction": 0.0, + "viscosity": 0.0, + "liquid": false, + "solid": false, + "is_gas": true, + "glow_radius": 5, + "glow_intensity": 0.8, + "glow_color": [255, 150, 220, 180] + }, + "spark": { + "name": "Spark", + "size": 1, + "hardness": 0.1, + "velocity": 0.8, + "conductivity": 1, + "color": [255, 255, 0, 255], + "mass": 0.01, + "temperature": 900, + "lifetime": 30, + "glow_radius": 3, + "glow_intensity": 1.0, + "glow_color": [255, 200, 0, 200], + "produces_on_death": "smoke", + "liquid": false, + "solid": false, + "is_gas": true + }, + "energy": { + "name": "Energy", + "size": 1, + "hardness": 0.0, + "velocity": 0.5, + "conductivity": 1, + "color": [0, 255, 255, 180], + "mass": 0.0, + "temperature": 1000, + "glow_radius": 4, + "glow_intensity": 0.9, + "glow_color": [50, 255, 255, 150], + "liquid": false, + "solid": false, + "is_gas": true, + "energy_transfer": 50 + } +} \ No newline at end of file diff --git a/src/config/particles/special/forces.json b/src/config/particles/special/forces.json new file mode 100644 index 0000000..55c2c99 --- /dev/null +++ b/src/config/particles/special/forces.json @@ -0,0 +1,39 @@ +{ + "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, + "affects": ["sand", "smoke", "steam", "snow"], + "force_falloff": 0.1, + "turbulence": 0.2 + }, + "gravity_well": { + "name": "Gravity Well", + "color": [100, 0, 100, 180], + "mass": 100, + "is_gravity": true, + "gravity_strength": 5.0, + "radius": 100, + "special": true, + "affects": ["all"], + "force_falloff": 0.05, + "pull_direction": "center" + }, + "repulsor": { + "name": "Repulsor", + "color": [0, 255, 100, 180], + "mass": 1, + "is_repulsor": true, + "repulsion_strength": 3.0, + "radius": 75, + "special": true, + "affects": ["solid", "liquid"], + "force_falloff": 0.08, + "push_direction": "outward" + } +} \ No newline at end of file diff --git a/src/config/particles/states/burning.json b/src/config/particles/states/burning.json new file mode 100644 index 0000000..2797627 --- /dev/null +++ b/src/config/particles/states/burning.json @@ -0,0 +1,59 @@ +{ + "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, + "friction": 0.1, + "viscosity": 0.1, + "liquid": false, + "solid": false, + "is_gas": true + }, + "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, + "friction": 0.5, + "viscosity": 0.5, + "liquid": false, + "solid": true, + "is_gas": false, + "produces": "smoke", + "burn_rate": 0.05, + "heat_emission": 50 + }, + "ember": { + "name": "Ember", + "size": 1, + "hardness": 0.3, + "velocity": 0.2, + "conductivity": 1, + "heat_capacity": 1, + "color": [255, 140, 0, 200], + "mass": 0.3, + "temperature": 500, + "lifetime": 60, + "heat_emission": 30, + "produces": "smoke", + "friction": 0.3, + "viscosity": 0.3, + "liquid": false, + "solid": true, + "is_gas": false + } +} \ No newline at end of file diff --git a/src/config/particles/states/frozen.json b/src/config/particles/states/frozen.json new file mode 100644 index 0000000..1bb830f --- /dev/null +++ b/src/config/particles/states/frozen.json @@ -0,0 +1,38 @@ +{ + "ice": { + "name": "Ice", + "size": 1, + "hardness": 1000, + "velocity": 0.0, + "conductivity": 0, + "heat_capacity": 0, + "color": [75, 75, 170, 255], + "mass": 1, + "temperature": 0, + "melt": "water", + "melt_temperature": 0.05, + "friction": 1, + "viscosity": 1, + "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, + "melt": "water", + "melt_temperature": 1, + "temperature": 0, + "friction": 0.1, + "viscosity": 0.01, + "liquid": false, + "solid": true, + "is_gas": false + } +} \ No newline at end of file diff --git a/src/config/particles/states/molten.json b/src/config/particles/states/molten.json new file mode 100644 index 0000000..9e07431 --- /dev/null +++ b/src/config/particles/states/molten.json @@ -0,0 +1,58 @@ +{ + "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, + "temperature": 1200, + "solidify": "stone", + "solidify_temperature": 800, + "friction": 0.8, + "viscosity": 0.8, + "liquid": true, + "solid": false, + "is_gas": false + }, + "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, + "temperature": 600, + "solidify": "glass", + "solidify_temperature": 599, + "friction": 0.7, + "viscosity": 0.9, + "liquid": true, + "solid": false, + "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, + "temperature": 600, + "melt": "lava", + "melt_temperature": 1300, + "solidify": "rock", + "solidify_temperature": 200, + "friction": 0.8, + "viscosity": 0.8, + "liquid": true, + "solid": false, + "is_gas": false + } +} \ No newline at end of file diff --git a/src/core/loaders/__init__.py b/src/core/loaders/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/core/loaders/particle_loader.py b/src/core/loaders/particle_loader.py new file mode 100644 index 0000000..73debe3 --- /dev/null +++ b/src/core/loaders/particle_loader.py @@ -0,0 +1,35 @@ +import os +import json +from typing import Dict, Any + + +class ParticleLoader: + def __init__(self): + self.base_path = "config/particles" + self.categories = { + "elements": ["basic", "liquids", "gases", "solids"], + "states": ["frozen", "molten", "burning"], + "special": ["effects", "forces"], + } + + def load_all_particles(self) -> Dict[str, Any]: + """Load and merge all particle configurations""" + all_particles = {} + + for category, subcategories in self.categories.items(): + category_path = os.path.join(self.base_path, category) + for subcat in subcategories: + file_path = os.path.join(category_path, f"{subcat}.json") + particles = self._load_json_file(file_path) + all_particles.update(particles) + + return all_particles + + def _load_json_file(self, file_path: str) -> Dict[str, Any]: + """Load a single JSON configuration file""" + try: + with open(file_path, "r") as f: + return json.load(f) + except FileNotFoundError: + print(f"Warning: Configuration file not found: {file_path}") + return {}