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

Map generation #28

Closed
oskarrough opened this issue Mar 1, 2020 · 4 comments · Fixed by #133 or #139
Closed

Map generation #28

oskarrough opened this issue Mar 1, 2020 · 4 comments · Fixed by #133 or #139
Labels
feature New feature or request

Comments

@oskarrough
Copy link
Owner

oskarrough commented Mar 1, 2020

from https://www.reddit.com/r/gamedev/comments/8852z3/slay_the_spire_path_generation/

Since the number of encounters per level is fixed, and all paths have the same number of encounters, that simplifies things quite a bit.

  1. Start with a random number of paths from 3-5 of length 1 (encounter).
  2. Then for each row of encounters, pick a random number of encounters for that row.
  3. Connect each previous path to an encounter in this new row. The left path goes to the left-most encounter, and so on sequentially until all paths are connected. If there differing numbers of paths/new encounters, then merge adjacent or split existing paths to make sure all encounters are connected to a path.

Do this until you reach the boss, where you merge all paths.

Now you have a basic graph, and you just have to render it. This can be just a simple matter of spacing all rows evenly across the y axis and then offsetting each encounter's y position slightly from its row. For the x axis, for each row, you can just start on the left side and pick a random value from 0 to n for the first encounter, and then from n to m for the next encounter, etc.

https://i.imgur.com/oAofMa0.jpg

@oskarrough oskarrough added the feature New feature or request label Mar 7, 2020
@oskarrough
Copy link
Owner Author

oskarrough commented Apr 27, 2020

EPXRXgM
MZcjsma

@oskarrough
Copy link
Owner Author

See

a327ex/blog#1
a327ex/blog#47

@oskarrough
Copy link
Owner Author

Thanks to some feedback from a friend I realized this is more important than I thought. It gives the player a much clearer perspective of the game, you know where you are going, you can feel the progress.

@oskarrough
Copy link
Owner Author

Got something working on https://codepen.io/0skar/pen/bGwrQYO

@oskarrough oskarrough mentioned this issue Dec 26, 2020
6 tasks
@oskarrough oskarrough linked a pull request Feb 13, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant