jakubg1 / OpenSMCE

Game engine which allows creating a broad range of marble popper games.
MIT License
14 stars 11 forks source link

Extract all JSON structures to their own classes #70

Open jakubg1 opened 1 year ago

jakubg1 commented 1 year ago

All JSON structures that exist should be given their own classes. This will greatly improve code clarity and will make development easier.

Some insights:

jakubg1 commented 1 year ago
We need to consider migrating some classes, too. Here's a list of the more important resource types used in the engine: Name Extension Located in Stored as Class name Loaded by Notes
Image *.png /images Class Essentials/Image ResourceManager
Sprite *.json /sprites Class Essentials/Sprite ResourceManager
Sound *.wav/ogg/... /sounds Class Essentials/Sound ResourceManager
Sound Event *.json /sound_events Class Essentials/SoundEvent ResourceManager
Music *.wav/ogg/... /music Class Essentials/Music ResourceManager
Font *.json /fonts Class Essentials/Font ResourceManager
Font File *.ttf /font_files LOVE2D Object (none) Font This is an example of very bad implementation!
Particle *.json /particles Table (none) ResourceManager
Color Palette *.png --- Class Essentials/ColorPalette ResourceManager Stored and loaded in Load List
Sphere *.json /config/spheres Table (none) ConfigManager
Sphere Effect *.json /config/sphere_effects Table (none) ConfigManager
Collectible *.json /config/collectibles Table (none) ConfigManager
Collectible Generator *.json /config/collectible_generators Class CollectibleGenerator/Entry CollectibleGeneratorManager
Color Generator *.json /config/color_generators Table (none) ConfigManager
Level *.json /config/levels Table (none) ConfigManager
Map *.json /maps/<map name>/config.json Table (none) ConfigManager Load list defined by Levels

Some insights I can see from the table:

Ideally, either:

Also:

jakubg1 commented 1 year ago

Additional key benefits by introducing this change:

jakubg1 commented 1 year ago

An example involving the shooter data structure has been added in commit https://github.com/jakubg1/OpenSMCE/commit/77cf19b2e0519ae3f01f9fdaea05ab7d9a4cb7fa. A few notable observations one can see in my approach:

jakubg1 commented 8 months ago

API draft for the new Resource Manager:

Notes:

jakubg1 commented 1 month ago

A few Config Classes have been added which follow the most recent style: