Open DreadKnight opened 6 years ago
@DreadKnight i don't know about links, but i've seen other games use "seeds" and have a text field where you can input them. for this game, one of the tabs on the matchmaking ui could be "load from seed", which is just a text field where you input the seed and then hit "go".
there is the issue that the seed grows larger over time, but that's an optimization for another time.
The data is put directly into a JS object, so we don't have to worry about the hash getting too long really, it is never actually submitted through a form or anything. (Not that post would ever hit such a limit easily, but just to be clear)
@russon77 Seen seeds being used to restore cryptocurrency wallets, very handy feature for that stuff, but not in our use case.
@ktiedt I know, just thought it would be nicer to just deal with a little link, no more need for special markup or scrolling around when trying to copy it, it would greatly simplify the way we deal with game logs overall.
a seed is just some data, in our case that data correlates to the game state at time of save, for a minecraft world it could be an RNG seed. same concept: it's a short string to share with your friends.
@ktiedt i agree with @DreadKnight - the seed shouldn't be huuuuge, it becomes cumbersome. did base64 encoding it decrease the size? do we need to keep the history or can we just keep the current state?
@russon77 We can negate the need to select the code... that can be overcome with JS in most browsers. As for base64, it simplified it because it was previously JSON only so you had
G.gamelog.play([{"action":"ability","target":{"type":"hex","x":4,"y":4},"id":3,"args":{"1":{"creature":"A3","cost":5}}},{"action":"skip"},{"action":"ability","target":{"type":"hex","x":11,"y":4},"id":3,"args":{"1":{"creature":"A3","cost":5}}},{"action":"skip"},{"action":"move","target":{"x":6,"y":5}},{"action":"skip"},{"action":"move","target":{"x":9,"y":4}},{"action":"skip"},{"action":"skip"},{"action":"skip"},{"action":"move","target":{"x":8,"y":5}},{"action":"skip"},{"action":"move","target":{"x":7,"y":4}},{"action":"ability","target":{"type":"creature","crea":3},"id":1,"args":{"1":{}}},{"action":"skip"},{"action":"ability","target":{"type":"hex","x":4,"y":3},"id":3,"args":{"1":{"creature":"L3","cost":6}}},{"action":"skip"},{"action":"skip"},{"action":"ability","target":{"type":"creature","crea":4},"id":1,"args":{"1":{}}},{"action":"skip"},{"action":"move","target":{"x":5,"y":4}},{"action":"skip"},{"action":"skip"},{"action":"skip"},{"action":"move","target":{"x":6,"y":3}},{"action":"ability","target":{"type":"array","array":[{"x":2,"y":1},{"x":2,"y":2},{"x":1,"y":2},{"x":4,"y":3},{"x":3,"y":3},{"x":2,"y":3},{"x":2,"y":4},{"x":1,"y":4},{"x":2,"y":5}]},"id":2,"args":{"1":{"direction":-1,"hex":{"x":3,"y":3},"choiceIndex":1}}},{"action":"skip"},{"action":"move","target":{"x":10,"y":5}},{"action":"skip"},{"action":"move","target":{"x":3,"y":4}},{"action":"ability","target":{"type":"creature","crea":5},"id":1,"args":{"1":{}}},{"action":"skip"},{"action":"skip"},{"action":"skip"},{"action":"move","target":{"x":6,"y":4}},{"action":"ability","target":{"type":"array","array":[{"x":3,"y":4},{"x":2,"y":4}]},"id":3,"args":{"1":{"direction":4,"hex":{"x":3,"y":4},"choiceIndex":1}}}])
For example...
There is no reason we couldnt setup a pastebin (or even github (gists)) API and query the data from them using XHR, using a btoa of the URL or something as the hash
Game logs should be saveable and replayable from pastebin type of links (might need a service with an API), though this should be another
type
. We would have to pick a nice service provided for this though.