StefanSchade / TaleForge

Text Adventure Logic Engine - A plattform to create immersive games without coding
0 stars 0 forks source link

Enhance NavigationService with Directional Navigation and Narration #10

Closed StefanSchade closed 6 months ago

StefanSchade commented 6 months ago

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:

Narrative Descriptions:

Repository Enhancements:

Service Implementation:

Temporary Player State Handling:

Out of Scope

Acceptance Criteria

StefanSchade commented 6 months ago

Steps in commit e7c3c3a1e1e301ff948923e06b7acb6a1df088eb

  1. Add the direction and narration fields to the Passage struct in passage.rs
  2. Update PassageRepository Trait
  3. Implement find_passage_by_direction_and_location in InMemoryPassageRepository
  4. Implement Navigation Logic in NavigationService
StefanSchade commented 6 months ago

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.

StefanSchade commented 6 months ago

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.

StefanSchade commented 6 months ago

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

StefanSchade commented 6 months ago

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 objects.

Additional explanation added to knowledge base in commit cdafe665b5d44eaf2c931fd6d8bb3bbf3c750fe4

StefanSchade commented 6 months ago

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

StefanSchade commented 6 months ago

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.

StefanSchade commented 6 months ago

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.

StefanSchade commented 6 months ago

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.