Databases?

Just started to learn from LUA(fivem) → C# and was wondering if anyone already did some work on databases syncs for multi-core servers or anything and if i should start working on it ?

Edit: Btw still very very new to C#, just started learning it for S&Box so this might seems dumb because im ignorant.

I’m not sure to understand why we should do some work for multi-core servers. Standard database engines already implement shared resources mecanism.

Do you mean work on some libraries to handle the connection between your code and the DB?

2 Likes

Yes, and would support for multicore… ?

Pretty sure most engines in C# can do this natively

1 Like

your database server handles the load, you just send the requests via your chosen library;
your need to search for databases utilizing multiple cores and not a library

i could also totally not get what you mean idk

3 Likes

If you wonder S&Box would be a multi-core based game, the answer is yes and no:

If you want to know some database drivers: MYSQL: Support - #16 by WYVERN

2 Likes

Exactly what i was asking thanks for the precise answer :+1:

1 Like

Similar to source 1, source 2 is already multithreaded. People assume that source 1 isn’t multithreaded, because lua addons in gmod are all in the same thread.

Unlike gmod, s&box allows us to run async tasks in C#, so we can multithread our addons if we want.

1 Like

So i guess MySqlAsync will be a thing and it will be pretty easy to use ?

AFAIK the answer is yes on the server, and likely no on the client.

1 Like

Assuming you’re going to do databases on the server and not the client (which should always be the case), you’ll be able to use w/e lib you want.

1 Like

Cant see why i would host a DB client side when they can inject in it…

1 Like

More important, how can you synchro / store your data with a client-side db? I don’t think P2P is planned

1 Like

I would assume single player games will be a thing.

if you start a local game it will still start a local server afaik
so that your client acts as the server where your friends are normal clients

only difference to gmod should be that it can also work over steam’s network to hide your ip (and to use steamid instead)

1 Like

Don’t think database support will be native in s&box, however C# is a widely used language so finding a library for it shouldn’t be hard when the time comes.

From the S&Box FAQ:

Q: Is the game going to ship with some kind of database adapter for MySQL or the like?

A: 2021-04-07_00-27-21

There have been talks about including some embedded database similar to how Garry’s Mod features SQLite but nothing concrete. For external databases you’ll want to set up a web API instead.

1 Like

Just use EFCore on the server if you need to, or make an API if it’s gonna be necessary.

1 Like