Skip to content

Conversation

@08Solly
Copy link

@08Solly 08Solly commented Jul 24, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants