Quantum-Game / quantum-game-2

LEGACY open-source version of Quantum Game 2 (Sept 2019 - Oct 2020)
https://quantumgame.io
MIT License
65 stars 16 forks source link

Level loading #194

Closed JStrebeyko closed 4 years ago

JStrebeyko commented 4 years ago

The PR makes it possible to: 1) level saving to Firestore using a button on GameControls; 2) level loading from Firebase by URL;

It required turning userStore into a Vuex store module rather than having it entirely decoupled. An additional field appeared there, to cover for an asynchronously loaded level data. In the future, this logic should be probably moved into a dedicated module, but as it was only one function, I kept it where the rest of our db fetching level is, so the userStore module.

There are some steps that should be tackled next, like styling the login page, linking to /savedlevels page, ensuring that game does not throw on level being loaded, ConsistentErrorHandling, LoadingIndication.

stared commented 4 years ago

It works for my private saves.

image

However,

Maybe later we can evolve that into username/UryMi5vJmmv3ldf6TjOJ so it is more descriptive. It is JSFiddle style, see https://jsfiddle.net/stared/1Lbuoxte/.

@KlemKlem - what do you think about good UI of level sharing?

JStrebeyko commented 4 years ago

Thanks for the feedback.

changes

extras:

considerations

side-notes

As of CSS linting change that took place in the meantime, merging it made me implement linting work by hand on numerous files, which was very tiresome (the --fix option listed warnings, but did not fix them). The linting rules should be tweaked; we want the App component to be free of the "scoped" attribute.

stared commented 4 years ago

I tried to load it, but get errors:

image

JStrebeyko commented 4 years ago

Unfortunately, these errors make it hard to pin point the source of the problem, the last one stems out of a typo already fixed.

What's even worse, downloading the repo, checking out onto PR branch (as described here), dealing with credentials and serving, results in a webserver with the app properly saving and loading levels on my end.

Let me know what does Vuex inspection bring around (an error, level Object consoled out?), or perhaps if you have any other ideas about possible source of the discrepancy.

edit: the image above shows the last publicly shared level record in the old format. Please try loading any other level.

stared commented 4 years ago

@JStrebeyko I tested it again, and it works.

A few remarks:

For now, we don't need t care about backward compatibility. Not many things saved, and the level schema will change at some point.

KlemKlem commented 4 years ago

@stared re UI of level sharing - do you mean a public page where all the levels created by users are available? I would definitely go for something like a thumbnail of the whole board, maybe some hashtags / categories to choose that would describe the levels? Otherwise, it'll be impossible to browse.

stared commented 4 years ago

Right now, when we start things, "public by default" makes the most sense. We just won't list some. (So just filtering 'public' when showing.)

In the long run - I think something similar to https://jsfiddle.net/, with username/short_id, and thumbnails (and name, tags, and ability to create whole campaigns). For now, let's start with a simple list.