AMP
AMP copied to clipboard
FR: Ability to set Upper and Lower limits for number-based settings within instance
This is not for requesting support for new games/applications
To do this you should go to https://github.com/CubeCoders/AMPTemplates and first attempt to build a configuration yourself - otherwise you can request a template from this repo.
Feature Request
Ability to set Upper and Lower limits for number-based settings
Feature Information:
Utilising Squad as an example.
App.MaxUsers is the setting within GenericModule.kvp that specifies (and allows a user to change) the MAXPLAYERS setting within the server. The game is hard coded to allow 1-100 player slots in the config. Currently a user may set above 100 player slots. This obviously doesn't work, but from a UI perspective is flawed. There should be the ability to set an upper and lower limit to any setting that contains a number.
In addition, these upper and lower limits should be able to be referenced via a provisioning flag. ie. App.MaxUsersUpper and App.MaxUsersLower or however it's set. I believe in Squad it is set in the manifest as opposed to the kvp.
I confirm:
- [x] that I have searched for an existing feature request matching the description.
Chatting about this in discord, minValue and maxValue being an attribute of a setting is a thing, however given these are in the manifests and not in the kvp itself, you cannot set it via a provisioning flag.
What we almost need is like
App.MaxUsers App.MaxUsers.maxValue App.MaxUsers.minValue
For example for Squad:
App.MaxUsers=20 App.MaxUsers.maxValue=100 App.MaxUsers.minValue=1
Would also require user feedback on the UI if this was exceeded.
If it's a hardcoded limit for Squad, don't you just simply update the generic template for that server to specify MinValue
and MaxValue
for the users setting? The template would have been created before those were a thing in Generic. Newer templates have them as relevant (assuming the template creator has bothered to include them).
Submit a PR.
We discussed in Discord that the lower limit is handled by MinValue but the max is the issue. You can't set a limit on deployment templates or limit your customers from going over a player count limit while still allowing them to edit it lower than that.
MaxValue
in configmanifest.json will achieve exactly what is needed for Squad. If the GitHub template is updated to include it, then it will apply to all instances, no need for any provisioning flag.
That's fine for setting it static-ly, however it is unable to be set with a provisioning flag for enterprise customers who sell upper slot limits, like myself.
I was commenting specifically on the Squad issue as described, not other use cases.
Just a note, so it doesn't get overlooked... This applies to every instance type, not just generic.
Setting up a UI to specify this might be hella tricky, because I'd actually do something like:
Module.Setting.Name::[Range:0,20] //A permission denoting an acceptable range of 0-20 for a given setting.
So one of the changes I may also have to make is a 'custom nodes' option at the bottom of the permissions UI to allow things like this to be set.
Based on the discussion I think only the upper limit needs enforced for player count based hosters. The lower limit would be handled by MinValue in generic at least.
Doing it just for Player Count is not too hard at all, but has to be implemented on a per-module basis. The Minecraft module has this already as a holdover from MCMA2.
I would prefer though a more general purpose way of letting admins say "Users can set this value to between X and Y" for other reasons. You don't necessarily want users setting things like tick rates too high or too low.
Maybe it's time to port some settings over to a UniversalSettings module. Lol
@PhonicUK so long as it's accessible in the GenericModule.kvp (and thereby accessible to a WHMCS provisioning flag) that will work a treat. The main thing is here 2-fold:
- Admins can, at this point in time, set a variable to a number that the server will not recognise (for example, setting the player count too high, or to a negative number)
- Enterprise users can, at this point in time, go above the MaxPlayers/MaxUsers setting that originally gets provisioned for their instance (for example, a user can buy a package utilising the Generic Module for 50 slots, but after the fact can set their slot count to anything they want, even if its above the 50 slot maximum that they purchased)
Having the MaxPlayers exposed as a variable they can change, but the MinValue and MaxValue be in the kvp would work a treat.
To clarify, the MinValue is in the config.json file for generic. And as you saw, is implemented across the board for all generics now. So only the MaxValue needs addressed as a separate limit. Then it needs to be limited by the MaxValue in the config.json AND provisioned by WHMCS.
This is right @IceOfWraith which is awesome that it's in there - just at present the config.json is not provision-able by WHMCS as far as I'm aware. Hence why I suggested it be in the KVP.
So I've got a prototype implementation for now, but it's a bit limited in some ways, but I suspect this will suffice for 90% of use cases?
There's two new settings - NumericValueNodeUpperLimits and NumericValueNodeLowerLimits that are part of AMPs core configuration. They're dictionaries of Node:Value - for example you could set:
Limits.NumericValueNodeUpperLimits={"GenericModule.App.MaxUsers": 10}
The reason for doing it this way is it requires no special implementation on individual modules, it'll work for any module regardless of the type of configuration used - hard coded or meta.
There's also a separate special permission to bypass these limits. The limiting factor is there's no way to say "This group has these limits, this group has these limits" - it's all or nothing.
I invite comments.
Trying to wrap my head around this one. It sounds useful in the sense it will be setting agnostic. But how would it look for a deployment? (AKA Arc's use-case) Would he need to set it to a different value depending on the module type? I believe we have MaxUsers properly set across all generic instances, but trying to determine what's the full picture.
Yes, it'd be module specific. I could also add the setting to Generic separately so people have the choice given that most apps are moving over to Generic as a rule.
What I want to do in the future (with very few exceptions such as Minecraft) is remove game specific modules altogether and have game-specific coded functions be plugins.
The main thing Ice would be getting at with my use case is the ability to set it as a provisioning flag. Can that be done with this implementation?
Yes, it's just another setting - all settings can have their value set via provisioning flags.
This was tested as working in a WHMCS deployment.
Core.Limits.NumericValueNodeLowerLimits.$Meta.GenericModule.$MaxUsers