AMP icon indicating copy to clipboard operation
AMP copied to clipboard

Allow relative port mapping in generic

Open Greelan opened this issue 3 years ago • 10 comments

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

Feature Information:

A number of games (eg Arma, Unturned and Pavlov) configure ports that are relative to the first server port that is set. So Arma say starts on port 2302, and then it assigns or reserves the next four ports above that as well. Unturned assigns the next port after the first port. Pavlov assigns the port that is 400 ports above the first port.

In these cases normally the first port only is able to be set expressly for the server. The server doesn't need to have the other ports set in the config because it assigns them automatically.

This can cause issues with AMP's port allocation in generic. While the default template ports may be set in the kvp correctly, those ports are not necessarily assigned to a server when it is created, depending on other ports already assigned by AMP to other servers. So the relativity of the ports might be broken, and AMP's config not reflect the actual server port assignment.

It would help in these scenarios if the template ports could be assigned relatively - eg App.ApplicationPort2={{$ApplicationPort1}}+1. And then AMP's logic would work so that it finds the first available set of ports that meet the criteria.

I confirm:

  • [x] that I have searched for an existing feature request matching the description.

Greelan avatar Jan 27 '22 09:01 Greelan

So, part of this is already in AMP and you can start adjusting your configurations.

If you use the new 'ports' system - each PortRequirement object has a ChildPorts field, which contains more PortRequirement objects.

{
	"Protocol": "TCP",
	"Port": 25565,
	"Name": "Main Port",
	...
	ChildPorts: [
		{
			"Protocol", "UDP",
			"Port": 25565,
			"Offset": 100,
			"Name": "Query Port",
			"Description": "Always 100 higher than Main Port",
		}
	],
}

PhonicUK avatar Dec 05 '22 19:12 PhonicUK

@IceOfWraith @Greelan ^

PhonicUK avatar Dec 05 '22 19:12 PhonicUK

I don't even want to know how long that's been available but undocumented. Lol

Thanks for providing that!

Note to myself: Empyrion needs added to this list.

IceOfWraith avatar Dec 05 '22 19:12 IceOfWraith

That's just messed up

Greelan avatar Dec 05 '22 19:12 Greelan

Given I am clearly a masochist, I tried this. Didn't work. In the form described, the child port is not assigned at all. I thought maybe it needed the Ref as well - no difference. So I thought maybe it still needs the port as a primary entry, as well as listed as a child port - the port is then assigned, but the relative allocation does not happen.

Greelan avatar Dec 06 '22 08:12 Greelan

The actual functionality isn't implemented - AMP just has the ability to understand that data structure. Hence saying that "Part of this" is in AMP, but not all of it xD

PhonicUK avatar Dec 06 '22 11:12 PhonicUK

I'd rather not implement stuff on my end that isn't implemented on yours. It sounds like a recipe for trouble.

IceOfWraith avatar Dec 06 '22 12:12 IceOfWraith

I agree. Testing is an important step of the process.

Greelan avatar Dec 06 '22 19:12 Greelan

I'm bumping this from LTS for now because it needs to be de-prioritised to allow for more important bug fixes to take those time slots.

PhonicUK avatar Dec 13 '22 18:12 PhonicUK

This is addressed in the coming release. I'm going to keep this open as a tracker so we can get the games all updated listed above.

IceOfWraith avatar Aug 04 '24 01:08 IceOfWraith