- Home /
Saving login credentials and some data to server?
Hi all,
Unity newbie here!
So I am making a simple lightweight 2D mobile game where the player mainly play offline. Now I want to add a new feature so that once the player enters the game for the first time, I will assigne a unique ID to them. By providing the ID on another device, the player can retrieve the data saved on the old device.
My question is: do I need a server for that?
(I will likely have a "backup" button ingame, and once that's clicked, I send the user's .bin file, the savedata, to the server through http)
If so, can I use my own website as a server? If not, what are the other options?
I have my own personal blog setted up using wordpress, I tried putting some picutres in the root folder and I can request them in game. I am also thinking about creating some assetbundles and put them there for the user to download for the first time.
If website method works, ideally I want to build another website for this. I have some experience building a simple website using .Net core's razor pages, with MongoDb if it's needed(or i can just save stuff in server's file system).
I don't know if the above methods I metioned would work, can anyone share some ideas?
Thank you!
Answer by highpockets · Apr 28, 2020 at 09:45 PM
You need a backend for this.
I’m not familiar with Wordpress, but I think it uses MySQL and if you are coding the back-end of your wordpress site, you should be able to save And retrieve your data in the database with post/get requests.
Yes, you can also use MongoDB for this, I’m using MongoDB right now with Node and Express and things are working fine at the moment.
It seems that you just need a simple setup. With MongoDB, You could setup a User schema with the fields you need and a simple login on your backend. I’m using express-passport for user sessions which is great.
Another viable option for you is to use the firebase sdk and take advantage of their user Authentication and also their Firestore NoSQL database.
Hope something in their helps
Hi @highpockets,
Thank you for your answer, this helps a lot!
I just checked out firebase and I think it really is awesome.
Just as a follow-up question: If I want to build the beckend so that I can send items/rewards to a specific player by knowing their credentials, would I be able to do that as well? I wonder how can my game realize "Oh there is something just sent to me". Should I implement some listener in game that listens to the request sent by my backend?
I saw in some other games where they have a sort of "ingame email" system. When the user receive an item from the server it shows up there. I don't know if that's the way to go or...?
Best,
Hey, well if Firebase is going to be your go to, you can take a look at their cloud messaging feature:
https://firebase.google.com/docs/cloud-messaging/unity/client
This would be a way to setup notifications, you might also be interested in Google Cloud Functions which is what they call their event-driven serverless compute platform. It sounds like you might be able to utilize this and perhaps couple it with the cloud messaging to send event-driven notifications for example.
As you add more back-end features, you might want to also look at Chilli Connect. This is a BAAS (backend as a service) which Unity now owns or Playfab. See a comparison here:
Although the original poster seems to be leaning towards Playfab, my thoughts are that Chilli Connect is “going to be” the better option for Unity users. I recently spoke with Chilli Connect and although they have stopped adding new features to their existing platform (which is quite feature rich already) they are in the middle of creating a new platform which integrates with tons of Unity features.. All that said, Chilli gives a 1 month free trial and then you pay in the ballpark of $50 USD/month for the basic plan, but depending on your goals and setup with Playfab, you could get started for free..
Wow great stuff, definately a lot to read here.
I think I will start with firebase for now and checkout ChilliConnect and Playfab later.
Thank you!
Your answer
Follow this Question
Related Questions
Multiplayer server choosing requirements VPS is this enough? 0 Answers
master server on hired host 1 Answer
save / load xml file on a web server 1 Answer
save and load json score to web/server 1 Answer
Unet server setup 0 Answers