Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enter/exit room bug #107

Merged
merged 3 commits into from
Nov 1, 2024
Merged

Fix enter/exit room bug #107

merged 3 commits into from
Nov 1, 2024

Conversation

ak-pvasudev
Copy link
Collaborator

@ak-pvasudev ak-pvasudev commented Oct 8, 2024

Hi Alessandro,

This is the fix for the enter/exit room bug. Prior to this fix, sound would drop out as we changed rooms because after the player entered the new room, it would call _on_area_exited() on the old room, which would set the player's room ID to INVALID_ROOM_ID.

To fix this problems we make two substantive code changes:

  1. When the player enters a new room, have the method _on_area_entered() set the player's room ID to the room they are in. If a player goes outside, then _on_area_entered() is not called because outdoors is not a room.
  2. When the player exits a room compare the room the player is in with that they're exiting. If they are the same (because the player has not entered another room) it means the player is going outside and we set the room ID to INVALID_ROOM_ID.

I've left a detailed comment in _on_area_exited() explaining this.

All tests pass locally; ideally we would have an automated test in a game environment simulating the transition between two rooms, but I'm not sure if that is something we have right now.

Thanks!

@ak-pvasudev ak-pvasudev self-assigned this Oct 8, 2024
@alessandrofama alessandrofama merged commit e93b953 into main Nov 1, 2024
6 checks passed
@alessandrofama alessandrofama deleted the pv_fix_enter_exit_room_bug branch November 1, 2024 15:54
@alessandrofama
Copy link
Owner

Thanks!

ideally we would have an automated test in a game environment simulating the transition between two rooms, but I'm not sure if that is something we have right now.

We should definitely add spatial audio gyms with tests in the future.

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