- Home /
Which Database Should i use?,How i can use database?
Hello guys, i made a idle clicker game. But i dont know which database should i use. Actually i want to use Firebase. But i cant figure out how i can use firebase. I need the learn how to insert, update values to firebase. And i need the make a playgames login to game for database. Can you guys help me? This is my ingame photo;
What exactly is the question? If is fine to use firebase?
Answer by Duckocide · Jan 04, 2021 at 02:26 PM
This feels like one of those $64k dollar questions. It's difficult to understand what you are trying to achieve with a database, but I'm guessing it's something to do with recording actions and outcomes.
If your using C# to script this game, you might want to consider using object query language via LinQ. You can use easy OQL (Qbject Query language) expressions to read (database like query) from List<> types. Code along the lines...
List<Thingy> subsetOfThings = allThingies.Where(thing => thing.name == "foobah").ToList();
Insertion is easy via the List<> Add method.
allThingies.Add(new Thingy { name = "foobah", price = 10.5f });
There are a lot of LinQ operations that take Lamda expressions (like the "thing => ..." above). I use them a lot outside of game development for business applications. They work well in games although I'd avoid massive datasets floating around in game memory on mobile if you can.
You can serialise these object list (object graphs) out to local storage (plenty of unity tutorials on this) as an when you want to save things.
Word to the wise though, I'd try and do LinQ in coroutines if you know how (plenty of advice on coroutines in Unity docs) to avoid bogging down the game loop (i.e. via Update). So, when you want to change an object graph or perhaps calculate some summary, launch a coroutine to do it.
Anyway, not sure if this helps but this is how I generally hold and manipulate complex object data graphs if needed in a game.
The question is not well formated but by "And i need the make a playgames login to game for database" I imagine he wants some sort of user/password login so he would need a server or some sort of service ike firebase