Skip to content

Conversation

@Hugo-RM
Copy link
Owner

@Hugo-RM Hugo-RM commented Sep 6, 2025

Summary

Main Fixes

  • Fixed ownership of textures as this would quickly degrade the game after the first gameplay session is done. End screen and retry attempts would randomly lose or move assets around
  • Added tests to ensure most assets are loaded in properly at their proper state in the game.
  • Ensured both Debug and Release builds work properly

Other changes:

  • Changed the end screen menu behavior so that pressing Escape now quits the game instead of returning to the main menu.
  • Removed the obsolete old_game_loop.md file.

Changes

  • Feature added
  • Bug fix
  • Refactored code

Testing

I ran the tests, played the game multiple times with both types of builds.

- **ResourceManager**: Fixed double ownership issue causing silent texture failures
    - Add texture validation with isTextureValid() method
    - Implement cache validation to detect and recover from invalid cached textures
    - Add clearCache() method for state resets without destroying textures
    - Enhanced error logging throughout loading pipeline
    - Fix Release build texture validation to prevent cache invalidation

- **Entity**: Fixed texture ownership model to prevent double destruction
    - Add dual texture support (owned SharedSDLTexture vs non-owned raw pointer)
    - Update constructors to handle ResourceManager-owned textures safely
    - Prevent premature texture destruction when ResourceManager caches textures

- **Tests**: Added AssetLoadingTest suite for CI/CD validation
    - Test all game image assets with validation and caching verification
    - Test font loading across all game font sizes with text texture creation
    - Test UI text generation for all in-game text elements and colors
    - Test ResourceManager caching behavior and edge cases
    - Add smart working directory detection for CTest compatibility
    - 6 test cases covering complete asset loading pipeline

- **CI/CD**: Added Release build testing to GitHub Actions workflow
    - Test both Debug and Release configurations
    - Ensure asset loading works correctly in optimized builds

- **MenuSystem**: Changed end screen escape behavior (GoToMainMenu → QuitGame)

- **Cleanup**: Remove old_game_loop.md and added TEST_RUNNERS.md file

Fixes game-breaking asset loading failures that occurred after first gameplay
session, where textures would fail to load silently and worsen with retries.
Not sure what I was thinking in changing the windows path. MacOS worked
so now just Ubuntu.
I removed the fixed SDL_Delay(75) calls and replaced them with a more
dynamic frame limiting approach based on the actual frame time.

The rendering issues are far from fixed but at least this means things
should theoretically be more consistent across hardware.

This will likely be my last commit for a while as I focus on other
projects and entering open source. I will come back to Meowstro
@Hugo-RM Hugo-RM merged commit 431dcab into main Sep 7, 2025
6 checks passed
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.

2 participants