Map-It-engine#13
Open
08Solly wants to merge 23 commits into
Open
Conversation
…to generate_custom_map
…to generate_custom_map
… from the new location.
…-game-engine into generate_custom_map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This pull request introduces a new feature that allows the Rose game engine to load custom obstacle maps from an external CSV file (custom_map.csv). This enables easier level design, testing, and content customization without modifying the core codebase.
Features Implemented:
✅ custom_map.csv support in the Track class.
✅ Automatic fallback to random map generation if CSV is missing or invalid.
✅ Robust validation of obstacles using the check_obstacle() method.
✅ Controlled cycling through custom map rows using custom_index.
✅ Safe parsing of CSV content into obstacle types via getattr(...).
✅ Full documentation and inline comments for maintainability.
How it works:
When custom_map.csv exists and is valid, the engine reads it and injects its contents row by row into the game state.
The map resets to the first row when reaching the end, allowing infinite looping.
The CSV content is validated to ensure it only contains known obstacle names.
If the CSV is not found or disabled, the engine falls back to default procedural generation.
Why it's needed:
Enables flexible and configurable track design.
Allows educators or players to prototype levels easily.
Decouples game logic from level design.
Next Steps / Future Enhancements:
Support multiple maps or directories.
Add hot-reload of CSV without restarting the game.
Validate CSV headers and formats.
Allow dynamic switching between map types at runtime.
Testing:
Tested fallback to random map when CSV not present.
Verified obstacle mapping from CSV matches expected behavior.
Checked boundary handling and invalid data safety.
Confirmed proper looping and index reset at end of file.