nodebox / seed

Procedural Content Generator
https://seed.emrg.be/
MIT License
22 stars 8 forks source link

Make the seed an optional query string in the URL #10

Closed stebanos closed 6 years ago

stebanos commented 6 years ago

Currently, when a sketch is loaded it takes the value of the saved seed version. However, this way different variations of the same sketch can't be easily bookmarked, without saving a new version first, even if nothing in the code changes. A better way is to add an optional query string, for example ?seed=IJX in the URL.

The application should use this seed if present, and otherwise use the saved seed value as is now the case (if it was saved in the first place). Furthermore, if the seed value changes, the URL should reflect the newly set seed, so that it can be bookmarked by the user. This needs to be done in a careful way though, because setting the URL through javascript causes the page to reload, and we don't want that. However, apparently we can manipulate the URL through window.history.pushState(), which doesn't trigger a page load so this might be the better way to go.

I think this is a better way of handling the issue described in #8

kunal-mohta commented 6 years ago

So you want that the URL should be changed as an when the user changes the seed, without the need of saving it right?

kunal-mohta commented 6 years ago

In any case, this can be done in two ways:-

  1. Repeatedly storing variations of sketches with different seeds in the firebase databse.
  2. Just checking the URL as entered by the user and generating the sketch in the Editor accordingly.

I think the 2nd option is much more efficient than the first one. What do you think?

TanviKumar commented 6 years ago

11 has the manipulation of the URL covered. Yet to add to database.

kunal-mohta commented 6 years ago

I don't think there is a need to add to the database You could just check the URL when the page loads and generate the sketch according to the seed mentioned in the URL.

Also, it would be nice if there was some sort of "claiming an issue" procedure. Because I too had started to work on the issue. 😅 @stebanos What do you think?

stebanos commented 6 years ago

To avoid confusion, right now, when you press 'Save', the sketch is already stored with the seed that is the current seed. The URL that appears will load the same sketch with -that- seed every time. For example the sketch -L4uLB99JzFHMPcVoiTm will always be loaded with the seed GKA. This is good, because it allows to present you with an example output that you are happy with.

So, this issue is not about saving, but more about being able to bookmark different variations of the same sketch that you like, without the need to push more data to the database.

Regarding GSOC, Frederik is abroad this week, but we will talk about it soon.

kunal-mohta commented 6 years ago

@stebanos Okay. Got it. 👍

@TanviKumar So you are proceeding with this issue futher, right?

TanviKumar commented 6 years ago

@kunal-mohta yes, I am.