Data-Driven Dungeon (JSON Level Loading) - Json#713
Data-Driven Dungeon (JSON Level Loading) - Json#713222448082Ashen wants to merge 3 commits intothoth-tech:mainfrom
Conversation
Add a set of data-driven dungeon usage examples demonstrating JSON-driven level loading and rendering across multiple languages (C#, top-level C#, C++, Python). Includes example source files, a sample level_data.json describing spawn points and loot, a preview PNG, and a short README text. These examples show how to read JSON with SplashKit, draw entities (player, enemies, loot), and perform proper JSON cleanup.
Update scripts/json-files/api.json: enrich the existing data_driven_dungeon entry with parameters, return info, attributes, and language signatures; and add a new celestial_mechanics function entry under the physics group with metadata (parameters, return, attributes, and signatures). These changes expose example metadata for language bindings and documentation generation.
✅ Deploy Preview for splashkit ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Well done on putting the Data-Driven Dungeon and Celestial Mechanics concepts into practice; this is a powerful and organised contribution.
Here are some ideas for enhancements:
Overall, this is a valuable and advanced contribution. Nice work! |
jankiluitel
left a comment
There was a problem hiding this comment.
This is a strong and advanced contribution — the data-driven approach using JSON and the inclusion of multiple languages (C++, C#, Python) are very valuable for demonstrating real-world usage.
I especially liked:
- Clear use of JSON for structured level data (spawn points, loot, metadata)
- Consistent implementation across multiple languages
- Inclusion of a visual output (PNG), which improves usability
Some suggestions and potential issues to consider:
-
Path handling inconsistency (C++):
The C++ example uses:
json_from_file("public/usage-examples/json/level_data.json");
and then falls back to "level_data.json".
This could cause confusion depending on execution context. It might be better to standardise a single relative path consistent with other examples. -
API consistency across languages:
Python and C# load JSON using simpler paths, while C++ includes fallback logic. Aligning behaviour across languages would improve consistency for learners. -
Python refresh function:
refresh_screen(60) is used, but in SplashKit Python the preferred function is refresh_screen_with_target_fps(). This may cause runtime inconsistencies. -
api.json modifications:
Changes to api.json are quite extensive and tightly coupled to build scripts. It would be good to confirm:
- No unintended impact on existing API pages
- All required fields follow the expected schema strictly
- PR size:
This PR combines multiple concerns (new examples + api.json fixes + physics examples). Splitting into smaller PRs would improve reviewability and reduce risk.
Overall, this is a high-quality and complex contribution, but addressing the above points would improve maintainability and consistency across the project.
Add VS Code C/C++ runner settings and tidy usage examples; simplify JSON loading in C++ example (use level_data.json directly), rename local variable to entity_type, and use refresh_screen_with_target_fps in the Python example. Normalize guide group casing in guides-groups.json and extensively update scripts/json-files/usage-example-references.json: add new example entries, adjust many example titles/URLs to use consistent "-functions" anchors (and append carriage returns where present), and add new categories (json, windows, color, geometry, graphics entries). Enhance scripts/usage-example-scraping.cjs to read ./scripts/json-files/api.json and compute canonical example URLs via getApiJsonData and getUsageExampleApiUrl, replacing the prior naive anchor construction. These changes align example metadata and scraper logic with the API index for correct anchor generation and improve local dev editor settings.
|
Thank you so much for the thoughtful and detailed review, and for the encouraging feedback. I really appreciate it. Your points are very fair, and I agree with the direction:
Thanks again for the high-quality review. It helped improve both maintainability and consistency, and I will keep the next updates smaller and more focused. |
Description
This PR implements Data-Driven Dungeon (JSON Level Loading). It provides comprehensive usage examples across C++, C#, and Python, while also fixing a critical build failure in the API documentation generation script caused by incomplete metadata.
Type of change
TypeErrorin api-pages-script.cjs due to missing JSON fields)How Has This Been Tested?
node scripts/api-pages-script.cjsmanually to confirm theTypeErroris resolved and all MDX files generate successfully.node scripts/usage-examples-testing-script.cjsfor bothcelestial_mechanics-1-exampleanddata_driven_dungeon-1-exampleto verify the 6-file requirement.g++against the SplashKit SDK.Testing Checklist
Checklist
If involving code
Folders and Files Added/Modified
level_data.json)Additional Notes
The api-pages-script.cjs was failing because it expects
parametersandsignaturesobjects for all functions in api.json. These have been explicitly added for the new examples to restore the Netlify build pipeline.