This commit is contained in:
Stan44 2024-12-28 21:08:15 -06:00
commit 7a262c1cb9
14 changed files with 529 additions and 0 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"cody.agentic.context.experimentalShell": true
}

1
main.py Normal file
View File

@ -0,0 +1 @@
from core.loaders.particle_loader import ParticleLoader

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
numpy
pygame

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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"
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

View File

@ -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 {}