Get Config Data from Server

Hello,

I am trying to build a system where at runtime the configuration of variables can be updated. Here’s a use-case to help explain this better:

Attack Damage is a global constant variable configured in some sort of data that can be loaded at runtime. The game is live and online so that players connect to a server to play against each other. Suddenly, we decide that we want to change Attack Damage, but we don’t want to roll out an entirely new version/update for this, so we just modify the value server-side and next time a player logs in to our server it updates their constants.

I was wondering if UE4 had any system for this. As I understand it, there are effectively 3 ways to store global constants. One is by making the variables “Config” variables, which doesn’t make them global so much as it makes their default values initialize from EditorConfig.ini. The next is by using Data Tables, although that is less for specific variables and more for defining a set of variables in a struct in multiple rows. Thus, the only real option for doing global constants is to add them to the GameInstance. I don’t like this idea as it seems weird that I would need to do it that way, but more importantly I don’t see how I could modify this at run-time server-side.

Essentially, I want players to login to the server, and have it check to see what version of the constants they are using, and if they are out of date have them update their constants to match what the server has. (Please note, that by server it could mean a custom server that just handles login and matchmaking, or it could mean a dedicated UE4 server, doesn’t really matter to me.)

Is this something that can be done using any part of UE4, or does the entire system need to be custom built in C++?

If you aks me config is way to go server side

Config does not save in EditorConfig.ini, but Game.ini, you have information about it in tooltip when you hover over “config variable” checkbox. Config system will also load up defaults from DefaultGame.ini from Config directory of project file. They are global.

Thats what you can do at most on blueprint in terms of ini files, you got a heck more options in C++, you can specify Config file in UCLASS specifier of class, you can control save and load with LoadConfig() and SaveConfig(). You can go deeper and manually edit ini files from GConfig object, this still acknowledge the default inis

And don’t think doing something C++ of it like making “entire new system”, all you need to do is base class with configuration (can be GameInstance or GameMode), do some blueprint callable functions reparent your blueprints to new C++ class and control on blueprint. The reason why Epic not let you do this in Blueprint only, as i heard in AnwserHub they try to avoid implementing any file and networking manipulation in blueprint for security reasons (there always potential risk of injecting evil code in to blueprint VM).

All this should be server-side only (by that i mean UE4 server, once that keeps game state) client should not have authority over things like damage and such as it gonna be easily hacked next day you release the game using simple memory spoof. Even if you let user host the game, it still be issue as people would cheat on there server. It straight up security flaw, most basic one in multiplayer game. Server always should be a jurge of the match and count player stats and points, count time etc. and client should only sync that up and show to the player. If you make config like that in client it will be child easy to modify that (im not joking, doing this kind of thing was my thing with UE1 ;p).

This information is useful, but I think you misunderstood a bit.

I’m well aware of the fact that certain things should be controlled server-side, but I’m more describing a system where the server can inform the client of config variables at runtime. A client still has to have a copy of most variables. An example would be a character select screen that showed character stats. If we wanted to update a character’s stats without pushing out a new client build, this system would allow the server to tell the client at runtime what the updated stats are to display in the UI.

And yeah, I mispoke when I said EditorConfig.ini.