0
\$\begingroup\$

I'm trying to figure out how to accurately capture the state of the web app by a URL, similar to something like https://jsfiddle.net/, where they create https://jsfiddle.net/foobar123 a custom ID for the code you load, and you can share that with anyone and they can run the code. However, it's not a live, interactive thing, so it makes sense to do it that way.

But I'm wondering what games do. I don't really play games so I am not aware how browser-based games use the URL. I'm interested to know if, when you want to start back your game (I'm imagining WoW, though I've never played it), you just go to wow.com and click "start" or "join", and there is no URL involved at all. Or perhaps instead of that, you go to wow.com/123foobar to go to your last saved state, and it loads up the environment as it last was.

I'm not wondering for WoW specifically, just generally any game, if they use the URL to persist state, and if so, how (roughly speaking). Some simpler games like agar.io don't seem to use the URL; if you refresh, you lose your spot and have to start over.

I'm not really sure how a game could save the dynamically evolving state in a URL, which is why I'm interested to see if any of them do.

Another related example is a Collaborative Markdown Editor. I don't know if they dynamically change the URL though to reflect the state, I doubt it.

\$\endgroup\$
  • \$\begingroup\$ I'm quite confused; WoW doesn't run in a browser and navigating to a URL doesn't "restore last saved state", actually there is no state to restore and no "last save" at all in WoW. \$\endgroup\$ – tkausl Mar 2 at 6:37
  • \$\begingroup\$ I just made a guess, sorry. \$\endgroup\$ – Lance Pollard Mar 2 at 6:43
  • 1
    \$\begingroup\$ For future reference, the best way to ask questions on this particular exchange is to talk about a project that you yourself are making, and a problem you're trying to solve. We can answer those types of questions much better than general curiosity about how particular shipped games work under the hood, since those details are often not public. \$\endgroup\$ – DMGregory Mar 2 at 13:39
1
\$\begingroup\$

There are generally two ways to refer through the URL to a specific state

  1. The state itself is stored in the URL. The State will be serialized and then encoded to a string of valid URL-Characters. Either Hexadecimal, or base 64 or something else
  2. The state is stored in a database and only the unique state-id is appended to a url.

Note though, that not many games use those approaches, for multiple reasons:

  • There is no reason to "share" state in games
  • They don't allow you to save and restore, usually. If you die, or loose some item, or whatever, its gone for good. No way to "load a save" to get it back
  • Games like WoW don't run in a browser.
  • State can be bound to your account, which means providing your login data to the game allows the server to find your state
  • Other data, configuration state for example, might be stored beside your game state in the providers databases or in cookies in your browser, no url-parameters required.
  • Some games don't need state at all. Think of Counter-Strike for example. You join a server, play a few rounds and then leave. There is no "health" or "items" to save.

Above points generally apply to multiplayer games. Browser-based Singleplayer games might be different if they want to provide some sort of "checkpoint" or "save" without actually storing the values in your browser. Non-browser-based Singleplayer games store their state in files on your computer.

Text-Sharing websites and similar sites do store either the full text or the ID to a row in their database in the URL to allow you to share the text, image, blog-entry, ... easily, since this is usually the purpose of the website. (Most) Games don't need or want you to share the state.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.