Save/Load - Username/Password - MythStrott

Hello!

I am developing a role-playing game for myself. Understand this, I’m not going around asking for people to make scripts for me. I have been making this myself and I don’t mind that. Tutorials and explanations are good. Do-it-for-me is bad.

So, how can I implement the ability to create an account in a browser game? I know how to script a GUI. You can see the inventory/chat/etc that I already made in my game. What I don’t know is how to save variables in a file and then read them later.

How do I have the game write a file?
How do I have the game read a file?
Should the file be in the website’s directory, or on the users’ computers?

I know, this has been asked again and again. People usually answer with “Player Prefs”. But, they don’t explain how to use Player Prefs.

Help is appreciated.

Here is the updated game:
http://www.mythstrott.webs.com/mythstrott.html

What r u useing to save the other aspects of your game? If you look in search you will find that there are a few topics with examples on saving player.Prefs.
Its rather basic stuff though most make a function for saving and one for loading then you just compare you string names to a player prefs string and save it under a custom key.

It isn’t possible to save any yet in the game.

afaik, you want to save it in the browser because a web game cannot save to the users PC. Security precautions I’m sure you understand.

In this case, I would use WWW call to a script (type of your choice, for me it’d be php) that does what you’re looking for.

I have no examples of code, but I’m sure if you search WWW with unity you’ll find some examples of how WWW works.

Ezzerland,

So you’re saying that I would need to use PHP (or similar language) to take care of the post/get of variables?

I could possibly do this, but I would have to upgrade my hosting package to support PHP.

Still looking for options.

Well, you would need to use a server side script for this, yes. Not necessarily php, there are many options. Javascript, ASP, .NET, etc… PHP is just what I would personally choose, because it’s a language I’m rather familiar with.

Being that you mentioned this is a web-bsaed game, I’d wager this is actually your only option.

Good luck.

My current website host doesn’t support free server-side scripting. I would have to upgrade to a plan that costs about $12/month. That isn’t terrible, but I would like to keep this free if possible.

May I ask who hosts your PHP?

Thanks

I’d find a new host then if I were you. THere are many that will do this for free. A quick google search should suffice.

off the top of my head BlackAppleHost or 110mb are two examples of hosts you could use.

I have heard of 110mb many times. They seem to have a good reputation. I have successfully transferred my website over to their free hosting. At the moment, they only will store generic filetypes (HTML, JS, CSS, JPG, PNG, etc) so I couldn’t upload the .unity3d file. I left that file with my old host and linked back to it. No problems. Soon I’ll set up the PHP, ASP, JavaScripts, or whatever I choose.

Thank you very much for your help.

If you know of any good server-side scripting tutorials, feel free to share. Otherwise, I’m sure a good search on Google will yield plenty of information.

Thanks again.