Jump to content
bull_a

Server persistence using namespaces

Recommended Posts

uiNamespace is a great way to save variables. As far as I understand, it doesn't reset until after the game is closed down, and can be used across multiple missions. Can someone confirm this to me?

 

This leads me onto profileNamespace, you can add variables to this at anytime and save them, so why are people using systems like iniDB2 and extDB? I am not saying that these are pointless, I firmly believe that they are fantastic extensions and I am myself writing similar ones for my own modifications. What are the benefits of using an extension like ini/extDB compared to just writing the variables into the persistent profileNamespace?

 

The way I was thinking of doing this is by have one namespace with a tree like structure (please bear with me, when I'm trying to explain this :) )

 

profileNamespace - database:

/*
	Structure:

	"ArmaDB" - database name
	|_ "UsersTable" - a table
	  |_ Record - a record stored as an array
	  |_ bRecord - another record
	|_ "SomeTable" - another table
        |_ .......

*/

// To set another record in Users
_record = [1,something,somethingElse];

// Gets the database - i.e. opens a connection
_database = profileNamespace getVariable ["ArmaDB",[]];
if (count _database <= 0) exitWith {false;};

// Inserts a new record
_userRecords = _database select 0;
_userRecords pushBack _record;
_database set [0,_userRecords];

// Commits the update
profileNamespace setVariable ["ArmaDB",_database];
saveProfileNamespace;
   

Bull

Share this post


Link to post
Share on other sites

Yeah, huge difference when your storage gets big. Database is optimised for speed and storage and it also has many many fast and useful inbuilt functions.

Share this post


Link to post
Share on other sites
Guest

Not only.

There is kinda rule in the game info exanges witch is never trust client info.

Simply because you can modify / hack the information located on your computer because it is local to your computer and you have all the tools to change them (see KOTH money/exp hacks with local servers).

And also because the server admins may need to have access to the stored information and if the client is not connected they basicaly can't.

Share this post


Link to post
Share on other sites

And also because the server admins may need to have access to the stored information and if the client is not connected they basicaly can't.

Technically this isn't true. If all the data is written into the server's profileNamespace if you save the player id and name then you can pull data for that person off the server. I've done it with a little set of scripts I made. Only problem is you need to be ingame to access any of that data.

  • Like 1

Share this post


Link to post
Share on other sites
Guest

Technically this isn't true. If all the data is written into the server's profileNamespace if you save the player id and name then you can pull data for that person off the server. I've done it with a little set of scripts I made. Only problem is you need to be ingame to access any of that data.

Thanks for correcting me as I'm talking about the client namespace ;)

Share this post


Link to post
Share on other sites

Not only.

There is kinda rule in the game info exanges witch is never trust client info.

Simply because you can modify / hack the information located on your computer because it is local to your computer and you have all the tools to change them (see KOTH money/exp hacks with local servers).

And also because the server admins may need to have access to the stored information and if the client is not connected they basicaly can't.

 

 

Technically this isn't true. If all the data is written into the server's profileNamespace if you save the player id and name then you can pull data for that person off the server. I've done it with a little set of scripts I made. Only problem is you need to be ingame to access any of that data.

 

 

Thanks for correcting me as I'm talking about the client namespace ;)

 

Sorry if I did not make this clear :) The information would be saved into the profileNamespace on the server machine. Too be brutally honest, I am not in the slightest bit concerned with hacking/clients running scripts because it happens, and I have wasted too many hours coming up with prevention's that do not work because of the limitations in the scripting engine :) I don't worry myself with the actions of a few script kiddies, that job lies with the server administrators :)

 

Yeah, huge difference when your storage gets big. Database is optimised for speed and storage and it also has many many fast and useful inbuilt functions.

 

True, but I can't imagine a single server (in Arma) would have enough information stored on it where this would make a missive difference?!

Share this post


Link to post
Share on other sites

 

 

 

True, but I can't imagine a single server (in Arma) would have enough information stored on it where this would make a missive difference?!

 

Of course it will depend on what you are storing. If you have 1 boolean for every player joining the server it can last centuries, especially if you have only 3 regular players playing on this server at all times. But if you have busy server with many different new players every day and you are storing player inventory and other things, this will get huge very quickly.

Share this post


Link to post
Share on other sites

Simple persistence = profile namespace is fine, and simpler to set up than external db.

 

Complex persistence = external db is the way to go

Share this post


Link to post
Share on other sites

I'm using the server's profile in H&M (https://forums.bistudio.com/topic/165948-btc-hearts-and-minds/).

I think the number of access is important too, the mission loads the data at the beginning and save only when an admin wants to save.

Probably i'm gonna switch to a proper database sooner or later, but at the moment it works great!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×