Arcanorum/rogueworld

Leave dungeon button

Closed this issue · 10 comments

Task description

As per #147 a way for a player to leave a dungeon they are in at any point without having to reach the exit portal should be added.

This would be a button on the GUI that when pressed, would open a modal/panel for the player to choose to leave the dungeon.

Leaving the dungeon in this way should incur no penalty, so their current items/glory/stats etc. should be unchanged.

References/notes

Leave dungeon button icon:
image

Leave dungeon button position:
leave-dungeon-button-gui
Replaces the map icon, as the map panel is useless in dungeons as it only shows anything when on the overworld map.

Leave dungeon confirmation panel:
leave-dungeon-confirmation

Acceptance criteria

  • When a player enter a dungeon instance (story or random) then the map button should be replaced with a button to leave the dungeon.
  • When the leave dungeon button is pressed, a confirmation panel should be shown with options to either stay in the dungeon (closes the panel), or to leave the dungeon.
  • When the leave button is pressed the player should be returned to the same exit location as if they had used the exit portal of the dungeon.

Hii! I was trying to work on this issue.

But when I run npm i, it gets gets stuck and gives error. For that I am unable to run the project an see my changes at work.
On doing npm i,
Things start installing fine but gets stuck at the installation of the phasers module. At first I had got the error that Microsoft.Cpp.Default.props was not found; I searched the internet and added an environment variable to the Visual Studio Build Tools path and it fixed that but got another error instead :

error MSB4062: The "SetEnv" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\MyWorks\CODING\Open_Source_Coding\dungeonz\client\node_modules\node-sass\build\src\libsass.vcxproj]

I have already tried reinstalling visual studio, deleting the folder and cloning again, installed windows-build-tools@4.0.0 (by npm install —global windows-build-tools@4.0.0), all to no avail.

Can I please get some help fixing this issue?

Can I please get some help fixing this issue?

Hi. I haven't seen that problem before, though I'm usually on Ubuntu. I can have a look on Windows.
What NodeJS & NPM version are you using?
I don't think any extra IDE specific tools or settings should need to be changed for the setup to work.

npm version 7.6.0
node version 15.11.0

Could you please try running npm i on windows and check if you get the same error?
Also I'm attaching here the entire message displayed in my terminal:
ErrorLog.txt

The modules under server and the main project get installed fine. While installing the modules under client; its failing. I think it is failing at the phaser@3.55.2 module, as that's where the installations gets stuck on my device and this error message shows up after a while.

Just tried on Windows with the same node version as you and I think I am getting the exact same problem as you.
I created a new issue to continue this discussion as it doesn't relate to this specific task: #164

Ok, thanks for confirming.

Hello, has any progress been made on this? I am looking over the code and trying to figure out the best (simplest/most sense) way to implement the exiting dungeon portion of the acceptance criteria:

When the leave button is pressed the player should be returned to the same exit location as if they had used the exit portal of the dungeon.

Currently, to get to a dungeon using the GUI (via DungeonPanel.jsx):

So to create the exit via GUI:

  • .sendEvent("exit_dungeon", {...}) whose response would be defined in WebSocketEvents.js, which would call an

If that makes sense, the next step would then implementing a valid Player.changeBoard(fromBoard, toBoard, toRow, toCol) within DungeonManager.js

Let me know if that path makes sense to take

@brendan-c So I have had a look at the required areas for this task.

You were on the right track, though perhaps I added a misleading detail about the exit portal, as there can be several exit portals in a dungeon, so it won't know which one to use when exiting via this new GUI button.
Luckily the dungeon instance itself has a reference to the board (.evictionBoard) and entrance (.evictionEntrance) bounds that it will evict players to by default (i.e. when the time runs out in the dungeon).

Something like this works ok:

  • Press GUI button -> Sends "exit_dungeon" event.
  • "exit_dungeon" event received on server. Each player entity has access to the board they are on, and each board has access to the dungeon that it is for (if it is for a dungeon at all).
  • Can add an evictPlayer(<Player>) method to the Dungeon class that looks like this:
evictPlayer(player) {
    // Reposition them to somewhere within the entrance bounds.
    const position = this.evictionEntrance.getRandomPosition();

    // Move them out of this dungeon board.
    player.changeBoard(this.board, this.evictionBoard, position.row, position.col);
    
    // Other logic is already done to handle removing the player from the dungeon/dungeon manager/party/whatever when they change board from a dungeon.
}
  • Then call that in the "exit_dungeon" event handler. i.e clientSocket.entity.board.dungeon.evictPlayer(clientSocket.entity);

Hello, I am interested in tackling this issue.

Sure. I don't think it is being worked on atm as I can't find an existing branch for it.

Will submit the PR soon!