sandpypi/settings.py
Stan44 986750c722 Massive changes to the repository have been made.
feat: Performance optimizations and UI improvements

- Added dormant state tracking for static particles
- Fixed settings menu particle spawn overlap
- Optimized particle batch processing
- Added brush cursor visualization
- Improved UI interaction zones
- Enhanced gas particle effects
- Added glow toggle functionality disabled by default due to performance impact
- Fixed particle rendering issues
- Debug Overlay Disabled by default
- FPS counter added semi seperate from Debug Overlay, Turn this one off when using Debug Overlay
- Improved particle rendering performance

Performance improvements focus on reducing unnecessary calculations for static particles while maintaining core simulation mechanics. UI changes prevent unwanted particle spawning during menu interactions.
2024-12-27 07:39:31 -06:00

42 lines
1.4 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 numpy as np
engine_settings = {
'enable_cursor': True,
'enable_glow': False,
'enable_gas_effect': True,
'enable_debug': False,
'enable_fps': 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()