Forum BigDB Best way to create objects in DB?

Discussion and help relating to the PlayerIO database solution, BigDB.

Best way to create objects in DB?

Postby Lexx98 » October 30th, 2017, 8:23 am

Hello. What is the best way to create large amount of objects in DB? Each object contain more than 1 field. Hands - too lazy...
This objects should be created before game release, but opportunity of creation of new objects will be also after release (but will have some price in resources for players).
Embed to creation mechanics freeware for admin-player? It will be anyway, but as first method of world creation it's quite long.
Right now as best method i see calling create-functions just in server-side code (in UserJoined, if user is admin), according to plan, if they aren't exist yet.
Lexx98
 
Posts: 1
Joined: September 22nd, 2017, 7:21 am

Re: Best way to create objects in DB?

Postby Henrik » October 30th, 2017, 7:19 pm

We generally recommend that you create objects lazily as needed instead of creating all objects upfront.

By using the LoadCreate method you'll always get a valid BigDB object back, and then you can do a simple check to see if the object you got back is empty, and if it is, you can quickly initialize it with whatever defaults you need.

If you have this pattern in place, it's also super easy to "upgrade" BigDB objects if you change your object layout in later versions of the game.
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm


Return to BigDB



cron