Aurora 4x

C# Aurora => C# Mechanics => Topic started by: roug on February 19, 2021, 06:56:53 AM

Title: Tuggin
Post by: roug on February 19, 2021, 06:56:53 AM
Hi.

I am just wondering, when i use tugs, only one of my tugs move the structure that i want to move? why does not the whole fleet of tugs move it together?
Title: Re: Tuggin
Post by: SpaceMarine on February 19, 2021, 07:00:22 AM
Hi.

I am just wondering, when i use tugs, only one of my tugs move the structure that i want to move? why does not the whole fleet of tugs move it together?

Because you can only tug 1 thing at once, thats not a feature for a group of tugs to tug 1 thing
Title: Re: Tuggin
Post by: Droll on February 19, 2021, 08:25:39 AM
Tugging is a one-to-one relationship.
Title: Re: Tuggin
Post by: TMaekler on February 19, 2021, 10:38:05 AM
Maybe (for minimizing micromanagement) we could consider a rework of the tugging system. Since the fleet system is already there, why not having the game seeing a fleet automatically as a tugging group? If there are one or more ships with a tractor beam in a fleet and an equal or less amount of ships without an engine the fleet is seen by the game as a tugging group.

a) The speed of the group could then be determined by the total engine number of tugs divided by the total weight
b) You could tug a very huge installation with say 10 tugs and be faster
c) or you could tractor 10 installations on one go with 10 tugs in that fleet

This system also could be extended into a ship having more than one tractor beam and thereby be able to tug the same amount of installations at once.

How about this?!?
Title: Re: Tuggin
Post by: TheTalkingMeowth on February 19, 2021, 10:43:28 AM
Maybe (for minimizing micromanagement) we could consider a rework of the tugging system. Since the fleet system is already there, why not having the game seeing a fleet automatically as a tugging group? If there are one or more ships with a tractor beam in a fleet and an equal or less amount of ships without an engine the fleet is seen by the game as a tugging group.

a) The speed of the group could then be determined by the total engine number of tugs divided by the total weight
b) You could tug a very huge installation with say 10 tugs and be faster
c) or you could tractor 10 installations on one go with 10 tugs in that fleet

This system also could be extended into a ship having more than one tractor beam and thereby be able to tug the same amount of installations at once.

How about this?!?

You end up needing to solve a linear system. While not terribly difficult, that may be more math than Steve wants to implement. I don't know how well C# supports linear algebra.
Title: Re: Tuggin
Post by: Droll on February 19, 2021, 11:51:45 AM
I don't know how well C# supports linear algebra.

I'm pretty sure every modern programming language has good support for linear algebra.

Steve would have to do some thinking to formulate the actual linear system but it could be done. There are already some very good algorithms like the 2-stage simplex that are very good at optimizing linear systems.

The only issue I see is that this would probably be an integer linear program (linear program == linear system), as you cant have half a tug tugging 20% of an installation - IIRC integer linear programs are NP-complete if you want to find the absolute optimal speed. I guess you could just round the answer you find and call that good enough though, people would probably not mind that too much.
Title: Re: Tuggin
Post by: TheTalkingMeowth on February 19, 2021, 12:15:38 PM
I don't know how well C# supports linear algebra.

I'm pretty sure every modern programming language has good support for linear algebra.

Steve would have to do some thinking to formulate the actual linear system but it could be done. There are already some very good algorithms like the 2-stage simplex that are very good at optimizing linear systems.

The only issue I see is that this would probably be an integer linear program (linear program == linear system), as you cant have half a tug tugging 20% of an installation - IIRC integer linear programs are NP-complete if you want to find the absolute optimal speed. I guess you could just round the answer you find and call that good enough though, people would probably not mind that too much.

I worked it out in some detail a while back but never posted it. IIRC it doesn't end up being an integer program, just regular linear. Variables are the amount of engine power being transferred by a given tractor beam, which would even let you do things like impose tractor beam strength limits to add some design decisions to the tractor modules.

It wouldn't actually be hard, but it's still more mathematical sophistication than 99% of the rest of the game I suspect, so he may not want to bother/not know how to use that part of C#.
Title: Re: Tuggin
Post by: Droll on February 19, 2021, 12:27:35 PM
I don't know how well C# supports linear algebra.

I'm pretty sure every modern programming language has good support for linear algebra.

Steve would have to do some thinking to formulate the actual linear system but it could be done. There are already some very good algorithms like the 2-stage simplex that are very good at optimizing linear systems.

The only issue I see is that this would probably be an integer linear program (linear program == linear system), as you cant have half a tug tugging 20% of an installation - IIRC integer linear programs are NP-complete if you want to find the absolute optimal speed. I guess you could just round the answer you find and call that good enough though, people would probably not mind that too much.

I worked it out in some detail a while back but never posted it. IIRC it doesn't end up being an integer program, just regular linear. Variables are the amount of engine power being transferred by a given tractor beam, which would even let you do things like impose tractor beam strength limits to add some design decisions to the tractor modules.

It wouldn't actually be hard, but it's still more mathematical sophistication than 99% of the rest of the game I suspect, so he may not want to bother/not know how to use that part of C#.

That's why I used probably because I was just using basic intuition and hadn't really mathed it out and wasn't sure whether or not you could directly incorporate EP. That makes a lot of sense though since fractional EP isn't a non-sensical thing like half a tug would be.

The constraints would be there to ensure that each tractor beam / tug is only applied to one other craft and to encode the total number of available tractor beams into the problem.
The fact that all the variables are non-negative also is a massive help since you don't need to deal with variable bounds either.

So if Steve ever feels the simplicity of tractor beams tugging at him it would not be too time consuming to try something like this. But yeah the simplex algorithm although widely studied, isn't the simplex algorithm out there I would say.
Title: Re: Tuggin
Post by: nuclearslurpee on February 19, 2021, 12:33:20 PM
It wouldn't actually be hard, but it's still more mathematical sophistication than 99% of the rest of the game I suspect, so he may not want to bother/not know how to use that part of C#.

I think more so than not wanting to bother with it, Steve may not want to introduce that degree of mathematical complexity into the game on pure game design grounds. A lot of the strength in Aurora's design is that it is built not on having a lot of incredibly complicated systems, but rather a lot of relatively simple systems (at least mathematically and conceptually) which interact with each other in complex ways to create interesting decisions and gameplay.

Probably the most complicated part of the game mathematically right now is missile design, and even that is just an extension of the engine design mechanics interacting with manoeuvre rating - the actual mechanics are not too complicated, the hard part is optimization which is true for many parts of the game.

Often it is the case that the optimization in pure mathematical terms is easy, but in practice the decision-making is dominated by interaction with other mechanics. For propulsion design, for example, while most who have played for a while know about the optimal 3:1 engine-to-fuel ratio many people will not use that ratio due to other factors beyond the simple mathematics, e.g. fuel consumption or RP conservation.

The point being, introducing a mechanic which requires the relative complexity of a linear algebra solver to work out is not necessarily in keeping with the apparent design philosophy of Aurora's mechanics. That may be a bigger concern for Steve than linear algebra being a little bit hard to program.  ;)
Title: Re: Tuggin
Post by: xenoscepter on February 19, 2021, 01:05:08 PM
 - Why not just add up the total mass and EP of the tugs, then do the calculation as normal?
Title: Re: Tuggin
Post by: Jorgen_CAB on February 19, 2021, 01:28:04 PM
Why not just make it VERY simple... don't require one tractor beam to tractor one ship... just make the tractor beam a requirement to tractor stuff. It could be one or a thousand small pods or just one large thing and several tugs.

Then you can apply modifiers based on a few parameters such as one tug tugging 10 ships get a penalty and you add some weight to the tugged ships thus you end up consuming more fuel and taking more time.

The same can also be true if you use more tugs than the thing you tug, add a penalty to the weight as well.

This means one tug and one item is the optimal way but you don't need to do this as it is logistically more difficult.

This way you can also add and remove tugged items at any time during a trip, the weight of the the total ship tugged are adjusted, the same goes if you add or remove tugs. The tugs stay in their own fleets and the tugged fleet stay in their fleet, there just is a connection between them and they move as one unit.

This would make thing rather simple and logical all at the same time... there still is a reason to build both smaller and larger tugs for efficiency sake. But you can combine tugs to tractor fleets or large stations in one go with little logistical headaches.
Title: Re: Tuggin
Post by: QuakeIV on February 19, 2021, 01:45:12 PM
Thats not solving a linear equation, the proposed solution was to literally just add up all of the EP in the group and then use that to calculate the speed of the group based off of its total mass.

You are adding up two different sets of numbers, and then those numbers are plugged into the equation that calculates speed from EP and mass.  That is not solving a linear equation, that is arithmetic.
Title: Re: Tuggin
Post by: Jorgen_CAB on February 19, 2021, 02:57:29 PM
Thats not solving a linear equation, the proposed solution was to literally just add up all of the EP in the group and then use that to calculate the speed of the group based off of its total mass.

You are adding up two different sets of numbers, and then those numbers are plugged into the equation that calculates speed from EP and mass.  That is not solving a linear equation, that is arithmetic.

I was not trying to solve that question at all... I was presenting a good solution for making tugs easier to use in the game that is simple.

Just add upp all the engine power of the tugs and then the total mass of both the fleet they tug and the tugs themselves... add some negative penalties if number of tugs are not equal to the number of ships/stations you are tugging based on some equation... VERY simple math.
Title: Re: Tuggin
Post by: serger on February 19, 2021, 05:35:20 PM
I don't think that such hordes of tugs and tugged objects - that it will be good. That's not even a convoy system.
Title: Re: Tuggin
Post by: TheTalkingMeowth on February 19, 2021, 05:57:35 PM
Thats not solving a linear equation, the proposed solution was to literally just add up all of the EP in the group and then use that to calculate the speed of the group based off of its total mass.

You are adding up two different sets of numbers, and then those numbers are plugged into the equation that calculates speed from EP and mass.  That is not solving a linear equation, that is arithmetic.

Yes, the linear system only appears if you need to enforce "at least 1"-tractor beam per tugged entity and want to figure out the best possible fleet speed.
Title: Re: Tuggin
Post by: xenoscepter on February 20, 2021, 01:23:17 AM
No, what I'm saying is:

 - Currently, we can only have one ship be tugged by one tug. So make it that one ship can be tugged by one fleet of tugs. Then, add up the EP and Mass of the tug fleet, and plug it into the existing formula for the one tug per ship model. I see no reason to have more than one ship per tug, but I see every reason to have a few tugs per ship.
Title: Re: Tuggin
Post by: TMaekler on February 20, 2021, 01:42:15 AM
I didn't want to complicate tugging; my idea was to make it simpler (and possibly handle it a bit simpler from the programming side). So let me quickly re-explain what I meant:

Step A) You create a fleet of three tug ships and order it to move to an existing mining operation fleet
Step B) Give it the order to "tug any ship in that fleet". The game checks for three tugs (with one tractor beam each) and picks three mining stations from that original fleet
Step C) Move the tugging fleet to the target destination and release all tractored ships
Step D) The Game creates a new fleet at the target destination with all mining ships

The Speed calculation would be the same as if I would move three different fleets with one tugged ship each. They would just move as one fleet, not three.

So what happens if there are only one or two mining ships left to tug? Well, we could either sum up all engine power and divide by total tonnage - which would mean that three tugs would tug two mining ships a bit quicker - or we could say that the fleet moves at the slowest calculated individual speed. Each tug is caclulated against one of the tractored ships and each is given its speed. Then the slowest speed is taken for the fleet and all ships are moved at that speed.

Thinking of this, the latter would make more sense because if you tug ships of differerent sizes the fleet can only stay together if they choose the speed of the slowest ship. As it is already so in Aurora... .