Closed StefanSchade closed 6 months ago
direction
and narration
fields to the Passage
struct in passage.rs
PassageRepository
Traitfind_passage_by_direction_and_location
in InMemoryPassageRepository
NavigationService
Commit 51e002c46dae0db5a44acc50ddfdb03300d6af84
Currently the helper function used to populate the repositories with test data has its own implementation of the data structures representing the test data. By referencing the domain strucs instead we make this more robust, but we assume that the test data always reflects the domain objects.
This way, you only need to maintain the domain object definitions and the JSON structure, without changing the deserialization logic in data_loader.rs.
Commit acdfd46105b9189f38ab8440f5d6c5c59f40c30d
This approach relies on the JSON structure matching your Rust structs. When adding or modifying fields in your domain objects, we have to update the corresponding JSON files accordingly.
Commit 01b37bae991dec6ecc36d2c5531a8543e6598b84 fixes compile issue linked to field access
Our navigate
function in the navigation_service
returns a (Location, String)
-tuple rather than a Location
Commit eca2b0ec7951524d9dd3f80b21ed8eb740a959b7 fixes compile issue linked to Size
trait
The errors related to dyn LocationRepository
and dyn PassageRepository
not implementing the Sized
trait are because your load_data_from_json
function is expecting sized types, but you're passing it trait objects. Trait objects are unsized, so you need to adjust your function signature to allow for unsized trait objects, typically by specifying the trait bounds with ?Sized
. This change tells Rust that R and P might not be sized, allowing you to pass Arc
Additional explanation added to knowledge base in commit cdafe665b5d44eaf2c931fd6d8bb3bbf3c750fe4
I just removed the acceptance criteria unit testing because we do not yet have a single test in the project and will adress this shortly. compare #8
As we have "Players receive descriptive narrative feedback" in our acceptance criteria I see it in scope to wire up the controller which is currently just sending a fixed dummy response.
Commit c90875a83dc3cac421aaf3ed1af08f91553c67d5
The first step is to make the use case move_player.rs
available to the player_controller
via the AppState
When compiling I received an error relating to a missuse of await in the player_controller which I fixed as the execution is not meant to return a future.
Commit c90875a83dc3cac421aaf3ed1af08f91553c67d5 and 419126a6b14d66aa0aab1f5d5e3bbb67471314e8
We include the narrative to the response, so in the future the player receives a descripition of the acutal process of moving from one place to the other in text and make some adjustments to ensure a clear separation between the application layer and the web layer.
Note that we still can not implement complete logic here because there is no player identity yet, so there is no way we can track the current place of the user. However completing this we now traversed all our architectural layers and abstractions and went "full circle" in the backend.
Objective
Improve the gameplay experience and provide a more immersive environment for players by enhancing the
NavigationService
. Introduce directional navigation capabilities and associated narrative descriptions to allow players to navigate the game world using compass directions and receive contextual descriptions of their movements.Requirements
Directional Navigation:
direction
in thePassage
struct to represent the compass direction (e.g., "north", "south") of the passage relative to the current location.NavigationService
to enable navigation between locations based on these directions.Narrative Descriptions:
narration
field to thePassage
struct for storing textual descriptions provided to the player upon using the passage (e.g., "You climb up the hill to the north.").NavigationService
should assemble these texts to generate narrative descriptions of the player's movements, enhancing the storytelling aspect of the game.Repository Enhancements:
PassageRepository
trait to include the methodfind_passage_by_direction_and_location
, which retrieves a passage based on the current location and direction input.Service Implementation:
NavigationService
uses thefind_passage_by_direction_and_location
method to determine the correct passage based on the player's current location and requested direction.Temporary Player State Handling:
Out of Scope
Acceptance Criteria
NavigationService
accurately navigates between locations based on directional input, utilizing the newly introduceddirection
andnarration
fields in thePassage
struct.