sandpypi/settings.py
Stan44 b2187693d7 major UI improvements the UI doesn't tank FPS.
there has been a lot of changes and fixes
currently refactoring the code base and optimizing

- Added UI optimizations to improve performance and reduce FPS impact
- Implemented various bug fixes and improvements
- Started code refactoring for better maintainability
- Updated particle system configuration in particles.json
- Modified rendering pipeline for better efficiency
- Updated simulation core logic in sim.py
- Adjusted settings and configuration parameters
- Updated gitignore rules
- Fixed initialization code in __init__.py
2024-12-28 13:29:37 -06:00

48 lines
1.5 KiB
Python

"""
#File Name: settings.py
Global settings and imports for the project.
This module defines various settings for the game engine, such as enabling or disabling the cursor, glow effect, gas effect, debug mode, and FPS display. It also provides a function to load particle properties from a JSON file.
The `engine_settings` dictionary contains the configurable settings for the game engine. These settings can be used to customize the behavior of the game.
The `load_particle_properties()` function attempts to load particle properties from a 'particles.json' file. If the file is not found or the JSON data is invalid, it returns an empty dictionary.
The `particle_properties` variable is initialized by calling `load_particle_properties()` when the module is imported.
"""
import pygame
import json
import random
import time
import numpy as np
engine_settings = {
'pause_sim': True,
'enable_cursor': True,
'enable_glow': False,
'enable_gas_effect': True,
'enable_debug': False,
'enable_fps': True,
'enable_WVisuals': False,
'enable_PVisuals': False,
'enable_TempVisuals': False,
'outerwall': True,
# 'settings': True/False
}
# Load particle properties from JSON file
def load_particle_properties():
try:
with open('particles.json') as f:
return json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
print("Error loading particles.json")
return {}
# Load particle properties once when module is imported
particle_properties = load_particle_properties()