Coding a power distributor like Elite Dangerous

I would like to code something similar to the power distributor in Elite Dangerous where you have three columns with a total amount of points/power. you can press a button to add a point to a column while maintaining the same amount of available points. For some reason, I can’t seem to think of a way to add a point and remove a point from one of the other 2 columns. Does anyone have an idea I could try?
At the moment I have a 3x3 grid of check boxes. I have maximum 3 points to “Spend”. Pressing left would move a point from the right column and put it into the left column. Pressing Up would take from the highest column and add it to the middle column. It’s making my brain hurt now.
If anyone more experienced in programming can give me a nudge in the right direction, I would appreciate it. Thanks.

Me too!

Is what you are talking about essentially a fixed amount of resources that can be moved between some number of buckets? Like maybe three coffee beans, and three cups to put them in. Is that the analogy?

visuals?

Think of them as percent. So you have a finite amount of resources (100%). You increase one (a) and it reduce other (b,c). So basically it’s the ratio of a vs b+c.

  1. You increase a and deduce the same amount to the SUM of the rest.
  2. You scale each element of the sum by the ratio of which sum has been reduced.
1 Like

Yes. That’s an adequate analogy!

I like this approach. I think I’ll rework my UI design a bit to incorporate this. Thanks.

Think of the three Systems (lets call them ‘thrust’, ‘weapons’, and ‘shields’) as the corners of an equilateral triangle. Your current ‘mix’ will always reside within that triangle, and defines (via simplified braycentric Interpolation - measure the distance to each corner, and make the distribution as a percentage of how close (the inverse of how distanct) the point lies to each corner measured by the sum of all distances) how much percent each system of the total receives. Whenever you change your Setting, you’ll choose one specific system, and move the mix point directly towars that corner. As long as you ensure that the mix point remains inside the triangle, you automatically have the correct values for the other two systems.