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

Feat/map3 #139

Merged
merged 14 commits into from
Feb 13, 2021
Merged

Feat/map3 #139

merged 14 commits into from
Feb 13, 2021

Conversation

oskarrough
Copy link
Owner

@oskarrough oskarrough commented Feb 12, 2021

Playing around with a different structure so it's easier to understand. I didn't change a lot of code, but I did move it around.

  • merged game/map.js into game/dungeon.js (same for testsI)
  • moved the rooms out into game/dungeon-rooms.js
  • drawing, but not finding, paths now happens in ui/map.js

This should make it easier to find things in the code.

Also:

  • you no longer need to run generateGraph yourself when creating a dungeon. Example: dungeon = Dungeon({rows: 20})
  • the option to customize which paths are created is now called customPaths

Still want to clarify the terminology. What is

  • dungeon
  • map
  • node
  • room vs encounter
  • row/col vs width/height
  • floor vs level vs y vs row

Closes #138

@oskarrough oskarrough linked an issue Feb 13, 2021 that may be closed by this pull request
@oskarrough
Copy link
Owner Author

OK, updated and renamed a lot of things.

There is a dungeon. A dungeon has height floors. On each floor there are width nodes. Control how many of the nodes in each floor have an actual room with minRooms and maxRooms. The type of node is randomly selected from roomTypes.

One remaining confusing thing is that while dungeon.graph[1] is floor, dungeon.graph[1][0] is NOT a room, but a node. The room is at dungeon.graph[1][0].room. Maybe it's ok? Would be clearer if there would only be floors and rooms. Can we get rid of the filler nodes?

Recap:

  • rows/columns --> height/width
  • row/level --> floor
  • encounters --> rooms
  • A state.dungeon now has a graph and paths

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.

Refactor map Map generation
1 participant