How to save progress in an html game

后端 未结 3 1856
渐次进展
渐次进展 2020-12-29 17:21

I want to know how I can save the progress a player has made in a game that I am making. Could I do this through cookies or how else can I save to the players computer? Than

3条回答
  •  轮回少年
    2020-12-29 18:11

    It really depends on what your looking for. Cookies are a great way to store data but can be edited by the client and some browsers have cookies turned of.

    Web storage has its goods and bads too. If your game has to write masses of data and has lots of players it will quickly use up your bandwidth and may also take time to transfer depending on the clients connection. The upside is that it is fully controllable by you. Once the data has been sent, it can not be edited by the client.

    Javascript has some great file I/O utils to help you on the way. Here is a great tutorial: https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O

    If you decide to go with cookies it can be harder or easier depending on your skill. Again, here is a great tutorial: http://www.w3schools.com/js/js_cookies.asp.

    Hope this helps!!!

    Edit--- When I mentioned client I was really meaning to say player :D

提交回复
热议问题