[games] Create dedicated Twine game player with iframe rendering and play buttons #1542
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.
This PR implements a complete Twine game player system that allows users to play uploaded Twine games directly within the site using an iframe interface, similar to our embedded games functionality. Previously, Twine games only opened in new tabs which provided an inconsistent user experience - this update creates a dedicated player with proper controls and navigation. What is added in this PR specifically is:
Created dedicated Twine game template twine_game.html with iframe rendering, game header info, and control buttons
Added play_twine_game view function with proper validation, error handling, and debug information
Added new URL route /games//play-twine/ for accessing the Twine player interface
Updated game detail template to conditionally show "Play Story" buttons for Twine games with book icons
Added fullscreen support, new tab option, and responsive design that matches existing UI
Added future-ready message listening for potential progress tracking integration
To easily test this PR:
First, run the command python manage.py test_user_uploads to create sample Twine games. Then, visit any Twine game detail page (URLs provided by the command output) and click the "Play Story" button to see the new iframe player interface. Test the fullscreen mode and new tab options to verify all controls work properly.
The files changed in this PR are mainly the new twine_game.html template, views.py for the new play_twine_game function, urls.py for the new route, and game_detail.html for the conditional play button logic. The implementation provides a consistent gaming experience across all game types while maintaining the unique storytelling feel appropriate for interactive fiction.
Please note that the tests do not include embedded games for now, since those have not been merged into dev yet.