Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Rappaport
Oct 2, 2013



e: Massive Fred effortpost on the previous page!

Rappaport fucked around with this message at 20:36 on Aug 18, 2021

Adbot
ADBOT LOVES YOU

berryjon
May 30, 2011

I have an invasion to go to.
Yep, this LP is definitely the most informative one I've ever seen. Actually cracking code to figure things out.

And here I am, just playing the game like a normal person.

Decoy Badger
May 16, 2009
Every number of importance is stored as a 32-bit unsigned integer, so you can get ridiculously high values if you poke around. All mathematical operations are also done in 32-bit. For charge, in theory you could do FFFFFFFF = 4,294,967,295, but since the "Actual earnings" code divides by 100 and then 10 (to get the decimal place) you can't realistically exceed charging a measly 4,294,967. You can still exceed that amount of earnings by royally screwing up the pointers though!

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
I lied. Have more market analysis.

After a bit more rooting around, I found where player one's commerce settings are for the other starter activity modules. As I suspected (and as Decoy Badger said while I was preparing this update), they're stored as four-byte values in what looks like a whole block of four-byte values. I then started a new game with a one-with-everything station and generated a block of VSFs from it where all of those modules have a charge value set from 0.1 to 99.9, 999 in all.

I then started loading VSFs and recording module usages and market demands. After a dozen such points, I had enough information to know the default market movements, i.e., what the market would look like without any random dips or swells. With that information, I gathered additional information for each charge from 10 to 65 by fives until I had a 'clean' usage for each module, i.e. its usage without any such perturbations. (It took several tries for modules like Communications, which has three activities it's affected by.) With this done, I had data for each module on how, given certain market conditions, its charge would affect its usage. Here's a handy graph:



Some things to observe. First, Shuttle Port usage remains 100% throughout the data range. (I had to go up to something like 90 charge to get it to drop at all, given the market.) Second, I can ignore the slope of line segments touching either the top or bottom; as I determined in the previous test, charge versus usage is a linear function, and I'm seeing distortion from the caps. Fourth, there's no actual market data being shown; I don't need that yet, because I want to look at just slopes. Third, different modules have different charge-vs.-usage slopes. ...wait.

In order to develop a function to calculate the optimum charge for a given market condition, I want to find some way of expressing this data that has a constant slope across all module types. For that, I'm going to try something I tried previously: dividing the charge by the base charge for the module.



That doesn't seem to have worked. Actually, the data is a bit clouded by those 0 and 100 usages; let's omit them from the data set.



That's clearer.



And so is this. (Pardon my inconsistent labeling.) So how can we get those slopes to line up? Well, tilting my head and looking at the data set, I notice something; a lot of the slopes are the same already, or close enough that it could be chalked up to usage rounding. Sorting by increasingly negative slope, I get:
  • -3.45: Computer Lab module (31 base charge, 1 activity, 40.0 purchase cost, 4.0 operating cost, 4 size).
  • -5.2: Space Telescope module (27 base charge, 2 activities, 37.0 purchase cost, 4.0 operating cost, 4 size).
  • -7.1: Building Platform module (26 base charge, 1 activity, 34.0 purchase cost, 2.5 operating cost, 4 size).
  • -7.2: Communications module (16 base charge, 3 activities, 36.0 purchase cost, 2.5 operating cost, 4 size).
  • -7.8: Resource Platform module (10 base charge, 3 activities, 21.0 purchase cost, 1.5 operating cost, 2 size).
  • -10.8: Pharmaceutic Lab module (20 base charge, 2 activities, 32.0 purchase cost, 2.5 operating cost, 2 size).
  • -11.0: Weather Center module (10 base charge, 2 activities, 17.0 purchase cost, 1.5 operating cost, 1 size).
  • -11.0: Solar Collector module (20 base charge, 1 activity, 60.0 purchase cost, 2.0 operating cost, 8 size).
  • -12.4: Chemical Lab module (18 base charge, 2 activities, 26.0 purchase cost, 2.5 operating cost, 2 size).
(The Shuttle Port module's slope is meaningless because we don't have any useful data.) Hm. I had hoped that there would be a trend in some other property of the modules, like purchase cost or number of activities, but if there is, I'm not seeing it.

Is it possible that each module has a unique slope modifier? Well, it's possible. I hope not, though, because that makes modules deep down the research tree difficult to test. For now, I'm going to set this aside and consider another approach... which means gathering more data.

In case you see something I don't, here are the standard demands, i.e., the ones that apply to this data set:
  • Agriculture: 132.2
  • Biology: 274.5
  • Communications: 196.1
  • Construction: 215.6
  • Energy: 196.0
  • Entertainment: 248.7
  • Fabrication: 212.9
  • Forestry: 119.7
  • Information: 226.8
  • Materials: 192.2
  • Medical: 152.4
  • Pharmaceutics: 166.5
  • Physics: 192.2
  • Resources: 388.1
  • Sciences: 218.2
  • Transport: 235.2
And I'll work on getting more data points so I can refine my slope information.

Rappaport
Oct 2, 2013

Is there a Journal of Reverse Engineering Computer Games or something like that? You're getting close to having enough data for an article!

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

Rappaport posted:

Is there a Journal of Reverse Engineering Computer Games or something like that? You're getting close to having enough data for an article!

Heh. I've thought about reaching out to somebody I know who does this sort of thing on the regular, but really I just know him; he's not a friend or anything. I doubt I could get him to spend a bunch of time on this.

Anyway. How about an update?



Berryjon's construction goes as planned.



As does Decoy Badger's.

I've decided to stay the course on building only modules that will eventually contribute useful research; for now, that's the Shuttle Port, Solar Collector, and Building Platform modules. I can't afford a second Shuttle Port module right now (well, technically I can, but not its support requirements), so I'm looking at the latter two modules.



Unfortunately, I also can't afford both a Building Platform module and a Solar Collector module, and the Building Platform module by itself needs more power than my station can support, so I throw a Station Power module on. Taking a cue from Decoy Badger, I also slightly overcharge my modules: 23.8 for the Building Platform module, 19.0 for the Solar Collector module, and 82.5 for the Shuttle Port module. This is 5% more than I predicted 100% usage to be; we'll see how that turns out for me.

With that, it's turn 3! In module news:
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has an operating cost of 5.0.
  • The Station Power module now has a purchase cost of 11.6.
And in financial news:
  • Pharmaceutics: 664.2 (up 218.6)
  • Resources: 404.5 (up 37.2)
  • Forestry: 327.3 (up 49.4)
  • Transport: 212.4 (up 5.2)
  • Materials: 208.1 (up 3.9)
  • Biology: 204.1 (up 21.8)
  • Information: 188.1 (down 9.1)
  • Construction: 183.9 (up 1.0)
  • Energy: 180.5 (down 6.5)
  • Sciences: 180.5 (down 6.5)
  • Physics: 174.2 (down 6.4)
  • Fabrication: 169.0 (down 9.7)
  • Communications: 169.0 (down 9.7)
  • Medical: 133.5 (down 36.2)
  • Agriculture: 101.4 (down 25.6)
  • Entertainment: 86.7 (down 27.7)
Overall, the market rose 5.9%. I overestimated Medical by 21.3% and Resources by 9.3% and underestimated Construction by 5.2%; my overall prediction accuracy was 97.1%.



I had 89% usage on the Solar Collector module, 93% usage on the Shuttle Port module, and 100% usage on the Building Platform module. The 100% charges for those modules would be 18.0 (I predicted 18.1), 78.6 (I predicted 78.6), and 23.9 (I predicted 22.7). So if I'd charged my predicted prices, for the Shuttle Port module and Building Platform module at least (I overpredicted on the Solar Collector module), I'd have made 78.6 + 22.7 = 101.3 credits, when I actually made (82.5 * .93) + (23.8 * 1) = 100.5. Being a single credit off isn't bad, but this turn I'll try charging slightly less and see what comes of it.



Berryjon got 97% usage on his Solar Collector module and 100% usage on his Resource Platform modules.



And Decoy Badger got 87% usage on his Solar Collector module, 89% usage on his Resource Platform module, and 100% usage on his Pharmaceutic Lab modules. He is currently in the lead in both cash on hand and profit this quarter, and I'm starting to sweat. Maybe I should have bought some Pharmaceutic Labs after all...

berryjon
May 30, 2011

I have an invasion to go to.

FredMSloniker posted:

[*]The Solar Collector module now has a purchase cost of 70.5.
Oh, screw you too game. We all need that!

FredMSloniker posted:

Berryjon got 97% usage on his Solar Collector module and 100% usage on his Resource Platform modules.
Huh, so I over-charged for the RePlats, and still got 100% usage. Curious, that. Time to do some more math and figure out where I can cap usage.
Canadian Space Arm-and-Leg Agency - "Where you don't pay what we have to!
Turn 3 - Fall 1996

"Interesting fluctuations in the market. But that's within parameters. The huge jump in the price of the Solar collectors is going to hurt in the long run. One more Resource Platform will turn this into a Life Sciences Station. From there, we can accelerate our income appropriately. Just need to figure out which to invest in first..."



76.5 Credits on Hand. 0/50 in Loan.
1 Resource Platform (21 Credits)
50 Credits - Pay off Loan
5.5 Credits - Into the Bank

Solar Collector - Enhancement Research
Resource Plats - CHARGE 15 (My math suggests 13.9, but if I'm going to get higher usage due to being a Life Sciences Station, I want to see if that's over any reductions due to overcharging, or if it's just in comparison to other players.)

Decoy Badger
May 16, 2009
New modules


code:
13,319,322,221,229,259,161,167;141,164,195,136,75,15,169,167,228,250,20,73,100,104,109,145;2,2,2,0,3,-1,1,1,2,2,-1,2,0,0,0,1
Remaining cash pays down the loan.

Charges:
5x pharmaceutics: 36 (last turn: 32)
1x solar collector: 18 (last turn: 19)
1x resource platform: 15 (last turn: 15)

Eloi Wusk:
"Allegations that our profitability is sustained solely by reselling pharmaceutical research tax credits are totally false."

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.


Sticking to building modules that will be useful for research later has caused me to fall behind. It's time to follow the leader and grab a couple of Pharmaceutic Lab modules. I'm charging 33.2 for them, as well as 24.7 for the Building Platform module, 83.0 for the Shuttle Port module, and 17.9 for the Solar Collector module.



Berryjon only gets 1.8 credits into savings because he was overdrawn on his loan. My bad on not checking. Starting research so soon, giving up even the slight income from the Solar Collector, seems like a bad move to me, but we shall see.



Decoy Badger's construction proceeds without incident. On to turn 4! In market news:
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Jupiter Explorer module now has a purchase cost of 29.5.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has an operating cost of 5.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 11.6.
In financial news:
  • Pharmaceutics: 611.2 (down 53.0)
  • Resources: 445.3 (up 40.8)
  • Forestry: 385.3 (up 58.0)
  • Biology: 228.5 (up 24.4)
  • Transport: 217.6 (up 5.2)
  • Materials: 212.0 (up 3.9)
  • Construction: 186.5 (up 2.6)
  • Information: 179.0 (down 9.1)
  • Energy: 174.9 (down 5.6)
  • Sciences: 174.9 (down 5.6)
  • Physics: 169.0 (down 5.2)
  • Communications: 160.8 (down 8.2)
  • Fabrication: 159.9 (down 9.1)
  • Medical: 140.9 (up 7.4)
  • Agriculture: 81.1 (down 20.3)
  • Entertainment: 65.9 (down 20.8)
Overall, the market rose 0.2%. I overestimated Pharmaceutics by 38.3% and underestimated Medical by 25.5% and Construction by 0.9%; my overall prediction accuracy was 95.0%.

...well, poo poo. That's a one-two punch on the Pharmaceutic Lab module. That Medical market increase isn't great, and that Pharmaceutics market decrease is a hammer blow. To add insult to injury, its operating cost went up.



I got 96% usage on my Solar Collector module, 100% usage on my Pharmaceutic Lab modules - wait, what? Lemme do the math real quick...

...huh. Now this is interesting. As I've mentioned before, there are a couple of different ways to take averages. My module charge program has been taking a geometric average; with a predicted demand for Pharmaceutics of 990.0 and a predicted demand for Medical of 105.0, the geometric average demand is 322.4, leading (with the module's base charge of 20) to an 100% usage charge of 32.2, which I bumped up 3% to 33.2. The actual market demands were 611.2 and 140.9, giving a geometric average of 293.5 and an 100% usage charge of 23.3. However, the arithmetic average is 376.0, suggesting an 100% usage charge of 37.6! That pretty much confirmes that arithmetic averages are the way to go.

To continue, I got 96% usage on my Shuttle Port module and 96% usage on my Building Platform module. And +1 knowledge, which is always nice.



Berryjon got 100% usage all around. His Solar Collector module produced an enhancement, so he's on the board with Energy A03.



And Decoy Badger continues to lead the pack. He got 89% usage on the Solar Collector module, 96% usage on the Resource Platform module, and 100% usage on the Pharmaceutic Lab modules (and it looks like he's been using arithmetic averages all along, the sly dog!)

I'm not giving up yet, but I might need some luck to take the lead...

berryjon
May 30, 2011

I have an invasion to go to.
Canadian Space Arm-and-Leg Agency - "Where you don't pay what we have to!
Turn 4 - Winter 1996

"I will not mock people for failing to diversify. I will not mock people for failing to diversify. I will not mock people for failing to diversify. I will not mock people for failing to diversify. I will not mock people for failing to diversify. I will not mock people for failing to diversify. We still need to work on the energy research, and that means more Collectors. Also, Let's work at pushing up the income on the Resource Platforms. The market is pretty robust on that, as one poor hit doesn't affect everything else as badly."



83.9 Credits, 1.9 in Bank. 50/50 Loan

Short Connector (5 Credits)
Solar Collector (70.5 Credits)
8.4 Credits into the Bank.

Solar Collectors - Enhancement Research
Resource Platforms - CHARGE 17

Decoy Badger
May 16, 2009
New modules

I think there's enough money and loan for that. It should cost ~209.5 (didn't show the stats because I changed things after screenshotting)

code:
3,8,8,7,10,6,11,5,8,8,17,10,17,12,8,8,7,0,2,10,12,5,;312,313,321,248,282,286,280,256,313,319,193,165,322,222,221,160,165,229,259,159,171,346;141,164,195,136,75,15,169,167,228,250,130,135,20,19,73,74,106,100,104,209,17,288;2,2,2,0,3,-1,1,1,2,2,1,1,-1,3,2,2,0,0,0,1,-1,1
I am probably going to stop plonking down pharmaceutics modules after this. I think we're probably getting close to the limit for this scenario between Fred and myself. Now, resource platforms on the other hand...

Charges:
6x pharmaceutics: 35.5 (last turn: 36)
2x solar collector: 16.5 (last turn: 18)
2x resource platform: 16 (last turn: 15)
2x building platform: 24.6 (last turn: n/a)

Eloi Wusk:
"How dare they accuse me of doing math! The only square roots I touch are whatever ends up in my Soylent!"

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
As I've mentioned more than once, especially in this post, when it comes to growing my stations with commerce, I go with whatever module pays for itself the quickest. Up until now, however, I've been making a few simplifications that I should stop making. The first was only looking at widget costs (check that post if you don't remember what widgets are). A station is likely to have unused support that I've already paid for, so putting another module on will pay for itself faster if it can use that support. With that in mind, I'm switching to evaluating potential builds for how quickly they pay themselves off and looking at the fastest return on investment.

The second simplification I've been using is only looking at predicted demand for next turn when determining how profitable a module will be. I don't want to look too far into the future, but a few extra turns would help. In fact, I can go turn by turn on a build with my predicted market shifts and figure out how many turns it'll take that build to pay for itself. The greater the predicted number of turns, the less accurate it is, but I'm only going to be interested in builds that pay out quickly anyway.



Another Pharmaceutic Lab module will pay for itself quickly enough that I can take advantage of the market before it dies. As for the second Shuttle Port module, well, I've talked a lot about its strengths and weaknesses. This turn, I'm going to charge 17.4 for the Solar Collector module, 36.6 for the Pharmaceutic Lab modules, 85.0 for the Shuttle Port modules, and 25.3 for the Building Platform module.



I'm not sure what to make of berryjon's madness mantra. Yes, those Resource Platform modules cover three markets, and yes, two of them are performing well, but the module itself has a terrible base charge. And it's way too soon to be doing research and leaving money under the sofa. I hope he hasn't given up already.



Decoy Badger innovates in station design as always.

Turn 5! In module news:
  • The Biology Lab module now has an operating cost of 3.0.
  • The Command module now has a purchase cost of 27.7.
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Galley & Gym module now has an operating cost of 6.4.
  • The Jupiter Explorer module now has a purchase cost of 29.5.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has a purchase cost of 42.5 and an operating cost of 5.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 13.5.
And in financial news:
  • Pharmaceutics: 528.6 (down 82.6)
  • Resources: 495.0 (up 49.7)
  • Forestry: 453.5 (up 68.2)
  • Biology: 255.7 (up 27.2)
  • Transport: 222.8 (up 5.2)
  • Materials: 215.9 (up 3.9)
  • Construction: 190.0 (up 3.5)
  • Information: 184.3 (up 5.3)
  • Physics: 170.4 (up 1.4)
  • Energy: 169.7 (down 5.2)
  • Sciences: 169.7 (down 5.2)
  • Medical: 156.3 (up 15.4)
  • Communications: 153.0 (down 7.8)
  • Fabrication: 150.9 (down 9.0)
  • Agriculture: 64.9 (down 16.2)
  • Entertainment: 50.1 (down 15.8)
Overall, the market rose 1.1%. I overestimated Pharmaceutics by 6.0% and underestimated Information by 7.6% and Medical by 4.9%; my overall prediction accuracy was 98.4%.



I got 94% usage on the Solar Collector module, 87% on the Pharmaceutic Lab modules, 96% on the Shuttle Port modules, and 94% on the Building Platform module.



Berryjon got 100% usage on everything and two enhancements from his Solar Collector modules, putting him at Energy A09. Is he trying to get to A50 to unlock the Energy Platform module?



Decoy Badger got 95% Pharmaceutic Lab module usage, but his other modules all got 100% usage. And I've already made my plans for next turn, but I won't reveal them just yet...

berryjon
May 30, 2011

I have an invasion to go to.
Canadian Space Arm-and-Leg Agency - "Where you don't pay what we have to!
Turn 5 - Spring 1997

"Assuming all goes well, it will take 17 Collector-Quarters to research the Energy Module, which can then help pick up the slack. I have three so far, then four more this quarter, leaving me with ten to go. Two quarters at five should do it.

I'm still not sure about the relationship between consistent progress from Enhancements, and the randomness of Breakthroughs. I'm not going to risk it."

"At least the Agriculture market can't get much lower."



95.9 Credits, 11.0 in Bank. 50/50 Loan
Short Connector (5 Credits)
2 Solar Collector (141 Credits)

Solar Collectors - Enhancement Research
Resource Platforms - CHARGE 19

Decoy Badger
May 16, 2009
New modules


code:
3,8,8,7,10,6,11,5,8,8,18,10,17,10,10,17,12,8,8,12,17,6,7,7,7,7,12,0,2,7,5,5,;312,313,321,248,282,286,280,256,313,319,193,161,193,162,165,322,222,221,160,163,17,68,135,134,165,136,104,229,259,71,348,19;141,164,195,136,75,15,169,167,228,250,225,248,130,191,135,20,19,73,74,18,286,255,314,256,106,73,17,100,104,76,289,76;2,2,2,0,3,-1,1,1,2,2,-2,1,1,1,1,-1,3,2,2,-1,2,2,110,111,0,01,-1,0,0,0,1,2
Charges:
6x pharmaceutics: 31.5 (last turn: 35.5)
3x solar collector: 16.8 (last turn: 16.5)
3x resource platform: 18.5 (last turn: 16)
3x building platform: 25.5 (last turn: 24.6)
1x shuttle port: 86 (last turn: n/a)

Eloi Wusk:
"I'm happy to announce that our new docking port is designed to accept all arriving Wagon space capsules! Come be a space tourist today and receive a 50% discount on air!"

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.


Shuttle Port modules continue to be a good investment, so I continue to build them. The second Solar Collector is partly for later use and partly because it's easier to fit. I'm charging 17.0 for the Solar Collector modules, 32.4 for the Pharmaceutic Lab modules, 86.9 for the Shuttle Port modules, and 26.0 for the Building Platform modules.



Berryjon keeps doing what he's doing.



As does Decoy Badger. And with that, it's turn 6! In module news:
  • The Biology Lab module now has an operating cost of 3.0.
  • The Command module now has a purchase cost of 27.7.
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Galley & Gym module now has an operating cost of 6.4.
  • The Jupiter Explorer module now has a purchase cost of 29.5.
  • The Life A module now has an operating cost of 3.0.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has a purchase cost of 42.5 and an operating cost of 5.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 13.5.
And financial news:
  • Resources: 551.9 (up 56.9)
  • Forestry: 533.7 (up 80.2)
  • Pharmaceutics: 457.3 (down 71.3)
  • Biology: 286.1 (up 30.4)
  • Transport: 227.0 (up 4.2)
  • Materials: 219.8 (up 3.9)
  • Construction: 193.9 (up 3.9)
  • Information: 190.8 (up 6.5)
  • Medical: 173.5 (up 17.2)
  • Physics: 173.0 (up 2.6)
  • Energy: 164.5 (down 5.2)
  • Sciences: 164.5 (down 5.2)
  • Fabrication: 150.3 (down 0.6)
  • Communications: 146.4 (down 6.6)
  • Agriculture: 71.0 (up 6.1)
  • Entertainment: 38.4 (down 11.7)
Overall, the market rose 3.1%. I underestimated Agriculture by 26.9%, Fabrication by 5.3%, and Entertainment by 0.8%; my overall prediction accuracy was 97.5%.

The program that kicks out the financial news report shows my three largest mistakes. Having a mistake that's less than 1% in that top three is pretty nice! (Incidentally, is there anything I can use to make these updates nicer and/or more useful? I could stick in a graph of market activity or bold module changes instead of italicizing them or whatever you think would be helpful.)



I got 91% usage on the Solar Collector modules, 93% usage on the Pharmaceutic Lab modules, 93% usage on the Shuttle Port modules, and 89% usage on the Building Platform module.



Berryjon got 100% usage all around...



... and is now at Energy A16.



Decoy Badger also got 100% usage and continues to grow that lead. I can only do my best and hope it's enough. (On an aside note, if someone gets overdrawn on their loan again, I'll mention it; if you see a non-zero amount you can borrow, though, you're good!)

The next post will be an effortpost, so don't expect it for a few days.

berryjon
May 30, 2011

I have an invasion to go to.
Canadian Space Arm-and-Leg Agency - "Where you don't pay what we have to!
Turn 6 - Summer 1997

"Hrm, the lack of enhancements from the Collectors will set me back. But I can account for that. Seriously though. How much do I have to overcharge before I stop seeing full usage?!?"

104.5 Credits, 0 in Bank. 7/50 Loan
43 Credits to Loan.
61.5 Credits to Bank.

Solar Collectors - Enhancement Research
Resource Platforms - CHARGE 23

(Yeah, let's go with a 20% over-charge on the Resource Modules. See how that works out for me!)

Decoy Badger
May 16, 2009
New modules

Remainder pays off the loan and goes into the bank.

code:
3,8,8,7,10,6,11,5,8,8,18,10,17,10,10,17,12,8,8,12,17,18,6,7,10,7,17,2,7,7,12,0,2,7,5,7,5,5,5,1,;312,313,321,248,282,286,280,256,313,319,193,161,193,162,165,322,222,221,160,163,17,12,68,135,133,134,15,138,165,136,104,229,259,71,348,73,17,7,24,135;141,164,195,136,75,15,169,167,228,250,225,248,130,191,135,20,19,73,74,18,286,158,255,314,192,256,103,160,106,73,17,100,104,76,289,21,77,47,18,134;2,2,2,0,3,-1,1,1,2,2,-2,1,1,1,1,-1,3,2,2,-1,2,0,2,110,1,111,2,0,0,01,-1,0,0,0,1,1,2,2,2,1
Charges:
6x pharmaceutics: 31.5 (last turn: 31.5)
5x resource platform: 25 (last turn: 18.5)
4x solar collector: 17.5 (last turn: 16.8)
3x building platform: 27.5 (last turn: 25.5)
2x shuttle port: 87.5 (last turn: 86)
1x weather centre: 9 (last turn: n/a)

Eloi Wusk:
"If you thought 1/2-off air prices were great, we've made the sale even better: for a limited time only, 1/3rd off air!"

Decoy Badger fucked around with this message at 04:35 on Aug 31, 2021

Decoy Badger
May 16, 2009
Earth Orbit Stations from the ground up: Usage Cap part 2

Last time, we learned that a cap definitely exists, it is independent of the number of players, and it doesn't matter what you charge. This time, we are diving into the machine code to see what exactly makes it tick.

We were looking at 0xd0c4, which holds the "Revenue received" value. Thanks to the emulator, we can trace back from when it gets loaded.

When we trace this value, we can notice that it is updated from a very common part of the memory: 0xf4, 0xf8, and 0xfc. These are all part of the "zeropage" which is the part of memory that is immediately at hand and accessible with only a single byte - i.e. the addresses are in the form of 0x00nn, they're on the zeroth page.

This is important because the C64 processor is 8-bits => 1 byte, and it only processes one byte at a time. Referencing an address that's beyond the zeropage, and that would therefore require two bytes to describe, would take twice as long to process. That's a potential halving of speed just to keep your code pretty. So the program likes to pull values in from the outer areas of RAM and process them in the zeropage. Which kind of sucks for us, since now we have to figure out where it's pulling things in from.

This is where pointers come in, an address that lists another address like a directory. You can see them used here:



LDA ($E0),Y means LoaD the address listed at 0xE0 plus Y digits. 0xE0 is the pointer.

Stepping through the code, the first fragment does the following:
Look up the address at 0xE0, and copy it into 0xC1. The address is actually two bytes long (in the form 0xnnnn), so this happens twice.

The next code fragment zeroes out 0xF4-F7: load 00 into the accumulator (LDA), store (STA) it in F4+X = F4+3 = 0xF7, and repeat (BPL) by decreasing X (DEX) until X is negative.

The final code fragment loads the address stored in 0xC0 and stores it into 0xF4-F7.

We previously loaded C0 from the E0 pointer, so that means that to trace the usage calculations, we have to follow a pointer (0xE0) to a pointer (0xC0) to the actual value. There are two layers of abstraction going on here.

This is how the program (and all programs, really) work. To save program space, each subroutine/function accepts a variable input in the form of pointers. A higher-level routine manages what pointers get fed to those lower-level routines.

In this case, pointers define what values are being multiplied (e.g. 10*40=400), and the multiplication routine is itself set into action by pointers that insert subroutines into the processing queue.

In some cases, for really frequently used values (like 100) you could code a new multiplication subroutine that skips a pointer and uses only that value. This would save execution time (because pointers are slow) at the expense of taking up more memory. The tradeoff between size and speed is critical to these tiny 1980s systems, and is still true today. Though "speed" today means development time, since most modern software is comprised of bloated programs that run slower than they ought to.

The actual calculations
I found the multiplication and division subroutines, so I just need to trace them to see what's going on with the usage cap. Doing so reveals the address where the key values are stored. Long story short:

1) Player module usage is first determined from price charged (which we'll go into later, but in short is pretty much the exact model we derived earlier), which is anywhere from 0% to 100%.
2) Base usage cap is then found by dividing 100,000 by a market-specific factor, in this case 113. It's then truncated and rounded to 880.
3) The final usage cap is found by adding the base usage cap with total player module usage. So there is always at least one module demanded per player even if the cap is set to zero, not that this ever occurs in practice.
4) Everyone's modules are counted, and the research modules are subtracted to find the number of active commerce modules.
5) Everyone's individual usage starts at their module usage.
6) Each player's usage is then dropped one point at a time until the usage% * number of commerce modules < the final usage cap.

And there you have it. That's why everyone had slightly different usages despite charging the same price: since some stations give commerce usage bonuses, we were starting from different module usages. The incremental method to arrive at final usage preserves the differences in usage between players, while still making sure that the overall usage cap is roughly adhered to.

This also means that with the crazy amount of oversupply we had, a tiny difference in usage led to a much larger advantage in income. But I'm sure we're not dumb enough to repeat the same mistake twice...

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
Uh.

I've been doing a lot of behind-the-scenes stuff that isn't producing anything I can share - yet - so I decided to do an update. When it came time to process Decoy Badger's build, though...



You may note a certain similarity to what Decoy Badger's station looked like at the start of turn five. I don't know how I screwed this up - I've been backing up save states and corresponding disk states religiously - but somehow things got corrupted.

The good news is, since I've been saving a bunch, I still have the data from the end of turn five, and advancing a turn worked as intended. The bad news is, this means a do-over of the events starting turn six. Here are the revised news items:
  • The Biology Lab module now has an operating cost of 3.0.
  • The Command module now has a purchase cost of 27.7.
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Galley & Gym module now has an operating cost of 6.4.
  • The Jupiter Explorer module now has a purchase cost of 33.6.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has a purchase cost of 42.5 and an operating cost of 5.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 13.5.
  • Resources: 551.9 (up 56.9)
  • Forestry: 515.9 (up 62.4)
  • Pharmaceutics: 457.3 (down 71.3)
  • Biology: 286.1 (up 30.4)
  • Transport: 228.0 (up 5.2)
  • Materials: 219.8 (up 3.9)
  • Construction: 193.9 (up 3.9)
  • Information: 189.6 (up 5.3)
  • Medical: 173.5 (up 17.2)
  • Physics: 173.0 (up 2.6)
  • Energy: 164.5 (down 5.2)
  • Sciences: 164.5 (down 5.2)
  • Communications: 145.2 (down 7.8)
  • Fabrication: 143.1 (down 7.8)
  • Agriculture: 56.4 (down 8.5)
  • Entertainment: 38.4 (down 11.7)
Overall, the market rose 1.9%. I overestimated Forestry by 3.3% and underestimated Agriculture by 7.9% and Entertainment by 0.8%; my overall prediction accuracy was 99.1%.



I had 91% usage on my Solar Collector modules, 93% usage on my Pharmaceutic Lab modules, 94% usage on my Shuttle Port modules, and 89% usage on my Building Platform module.



Berryjon had 100% usage on his Resource Platform modules and three enhancements from his Solar Collector modules, putting him at Energy A16.



Decoy Badger had 100% usage on all of his modules.

If you want to just do what you did, just say; otherwise, give me a revised plan. Sorry for the inconvenience!

...and I see Decoy Badger made an effort post while I was doing this. Be sure to read it!

berryjon
May 30, 2011

I have an invasion to go to.
Weird how Resources moved exactly the same amount this turn as it did last turn. But you know what? I'm already over-charging, so I'm going to go steady and keep to the existing plan.

Decoy Badger
May 16, 2009
No changes for me. I haven't experienced the same level of corrupted saves, in fact I haven't had any issues at all except for when I deliberately corrupted things.

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
So! I went to apply your updates, but first I decided to make my move, only to find my station a turn out of date. Which I hadn't previously thought to check. I wonder now if I improperly labeled something or accidentally saved over a file or something.

On closer examination of the "Turn 05B End of Turn" data, I find that berryjon and I have both spent funds on construction, but that construction wasn't saved to disk. Decoy Badger's station is the one in memory, and it gets saved to disk when I go to look at a different one, so I can't say for sure, but I suspect his construction hasn't been saved either.

Stepping back to the "Turn 05A My Move" data, I see that it's my station that's in memory and that my construction is complete. Going to look at berryjon and Decoy Badger, though, shows them having their stations and their funds. From this, I conclude I may have accidentally swapped the save disk files. If so, that's an easy fix. I'm not sure how that would have happened in the first place, though; did I accidentally mount a backup?

So I use the 05B save state and (a copy of) the 05A disk data, and everything looks correct; I cycled through the stations to make sure everything was correctly saved to and loaded from disk, and the cash amounts are all correct. Unfortunately, that means having to re-run the news again:
  • The Biology Lab module now has an operating cost of 3.8.
  • The Command module now has a purchase cost of 27.7.
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Forestry Lab module now has an operating cost of 1.2.
  • The Galley & Gym module now has an operating cost of 6.4.
  • The Jupiter Explorer module now has a purchase cost of 29.5.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Resource Platform module now has a purchase cost of 25.1.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Short Connector module now has a purchase cost of 5.5.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Telescope module now has a purchase cost of 42.5 and an operating cost of 6.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 13.5.
  • Resources: 551.9 (up 56.9)
  • Forestry: 533.7 (up 80.2)
  • Pharmaceutics: 462.7 (down 65.9)
  • Biology: 286.1 (up 30.4)
  • Transport: 228.0 (up 5.2)
  • Materials: 219.8 (up 3.9)
  • Construction: 193.9 (up 3.9)
  • Information: 190.8 (up 6.5)
  • Medical: 173.5 (up 17.2)
  • Physics: 173.0 (up 2.6)
  • Energy: 164.5 (down 5.2)
  • Sciences: 161.6 (down 8.1)
  • Communications: 145.2 (down 7.8)
  • Fabrication: 143.1 (down 7.8)
  • Agriculture: 56.1 (down 8.8)
  • Entertainment: 38.4 (down 11.7)
Overall, the market rose 2.5%. I overestimated Sciences by 1.9% and underestimated Agriculture by 7.4% and Pharmaceutics by 1.2%; my overall prediction accuracy was 99.1%.



I had 91% usage on my Solar Collector modules, 95% usage on my Pharmaceutic Lab modules, 94% usage on my Shuttle Port modules, and 89% usage on my Building Platform module.



Berryjon had 100% usage on all modules and got three enhancements from his Solar Collector modules. More importantly, I've noticed that, despite the station shenaniganry, he had the same income on all three attempts at this turn. I suspect this means that the station information is stored in two forms, the form used for income calculations and the form used for station construction, and only the latter is erroneously saved to disk without an explicit 'save game'.



Decoy Badger had 100% usage.

I'm going to go ahead and process your turns as-is, as it looks like there aren't major discrepancies in the state of the market from attempt #2, but I can roll it back if there's an objection. At any rate, let's process the turn for real.



I pack my station full and decide to charge 15.9 for my Solar Collector modules, 30.6 for my new Computer Lab module, 21.5 for my new Resource Platform module, 29.9 for my improved Pharmaceutic Lab modules, 86.3 for my Shuttle Port modules, and 25.7 for my improved Building Platform modules.



Berryjon doesn't do much.



Decoy Badger is out of building space. And now, knock on particle board, we finally get to turn 7! In module news:
  • The Biology Lab module now has an operating cost of 3.8.
  • The Building Platform module now has an operating cost of 3.0.
  • The Chemical Lab module now has an operating cost of 3.1.
  • The Command module now has a purchase cost of 31.6.
  • The Fabrication Lab module now has a purchase cost of 45.7 and an operating cost of 5.1.
  • The Forestry Lab module now has an operating cost of 1.2.
  • The Galley & Gym module now has an operating cost of 6.4.
  • The Jupiter Explorer module now has a purchase cost of 29.5.
  • The Life A module now has an operating cost of 2.4.
  • The Life LH2 module now has a purchase cost of 14.1.
  • The Mass Driver module now has a purchase cost of 55.8.
  • The Pharmaceutic Lab module now has an operating cost of 3.2.
  • The Resource Platform module now has a purchase cost of 25.1.
  • The Settlement Power module now has a purchase cost of 17.0.
  • The Short Connector module now has a purchase cost of 5.5.
  • The Solar Collector module now has a purchase cost of 70.5.
  • The Space Colony module now has a purchase cost of 82.7.
  • The Space Telescope module now has a purchase cost of 42.5 and an operating cost of 6.0.
  • The Space Tug module now has a purchase cost of 27.4.
  • The Station Power module now has a purchase cost of 13.5.
And in market news:
  • Resources: 615.1 (up 63.2)
  • Forestry: 609.2 (up 75.5)
  • Pharmaceutics: 405.6 (down 57.1)
  • Biology: 320.0 (up 33.9)
  • Transport: 233.2 (up 5.2)
  • Materials: 223.7 (up 3.9)
  • Construction: 197.8 (up 3.9)
  • Information: 197.3 (up 6.5)
  • Physics: 166.0 (down 7.0)
  • Energy: 159.3 (down 5.2)
  • Medical: 158.7 (down 14.8)
  • Sciences: 153.4 (down 8.2)
  • Communications: 138.3 (down 6.9)
  • Fabrication: 135.3 (down 7.8)
  • Agriculture: 49.6 (down 6.5)
  • Entertainment: 29.5 (down 8.9)
Overall, the market rose 1.9%. I overestimated Medical by 17.6%, Physics by 5.5%, and Forestry by 3.0%; my overall prediction accuracy was 98.0%.



I got 100% usage on all of my modules but the Pharmaceutic Lab modules (90%, due to the Medical market reversal) and the Building Platform modules (98% usage). I'll have more than enough cash to start a second station; I just need to decide what sort.



Berryjon continues to fail his quest of charging too much for his Resource Platform modules. His Solar Collector modules only produce two enhancements, leaving him at Energy A21.



Decoy Badger gets enough different usages for me to break out a list:
  • Solar Collector modules (4): 82%
  • Weather Center module (1): 33%
  • Resource Platform modules (5): 89%
  • Pharmaceutic Lab modules (6): 86%
  • Shuttle Port modules (2): 100%
  • Building Platform modules (3): 94%
A quick pass to make sure everyone's stations are as represented, and it's time for me to plan my turn...

berryjon
May 30, 2011

I have an invasion to go to.
Three different rolls on the turn, and the Resources market moved the exact same way each time. I smell something fishy.

Canadian Space Arm-and-Leg Agency - "Where you don't pay what we have to!
Turn 7 - Fall 1997

"HOW?!?! How much can I over-charge!??! Also, science sucks, but I think I can start on the next station next turn. Or the turn after?"

132.5 Credits, 65.8 in Bank. 50/50 Loan
132.5 Credits to Bank.

Solar Collectors - Enhancement Research
Resource Platforms - CHARGE 27

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

berryjon posted:

Three different rolls on the turn, and the Resources market moved the exact same way each time. I smell something fishy.

No, what you smell is how the market works. There's a 'standard' market movement as of when you're ready to advance to the next turn. When you actually do, though, the game rolls some dice and randomly alters a few markets. That's part of how I've been gathering data about the market works: I've had to bundle charges, usages, and relevant market demands for each data point.

Decoy Badger
May 16, 2009
New station B


code:
17,17,12,7,12,7,7,12,3,7,12,10,10,6,11,;15,19,166,129,164,133,135,168,145,136,171,81,85,13,17;192,129,134,138,257,203,266,69,315,80,198,279,251,272,257;2,2,0,1,0,1,1,0,0,1,0,2,2,2,2
No changes to station A. I think I should have barely enough cash+loan to build this.

Charges:
6x pharmaceutics: 29 (last turn: 31.5)
5x resource platform: 26 (last turn: 25)
6x solar collector: 16 (last turn: 17.5)
7x building platform: 28 (last turn: 27.5)
2x shuttle port: 93 (last turn: 87.5)
1x weather centre: 6 (last turn: 9)

Eloi Wusk:
"The Newest Wesla Space Gigafactory: Void for all research purposes!"

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
Because I need a break from this LP sometimes, I've started recruiting for another game. This makes perfect sense. :pseudo:

Adbot
ADBOT LOVES YOU

Decoy Badger
May 16, 2009
Earth Orbit Stations from the ground up: RNG and the News

So I think I've found the RNG for this game.

Modern computers with operating systems typically have a source of randomness that every program can easily pull from, like /dev/urandom in Linux systems. No such thing in the C64, you have to roll your own.

Luckily, for something like a game where true randomness isn't critical, there are lots of ways to do this. You could do something as simple as pulling random places from memory and mashing them together, but you might not end up with the full range of random numbers that you want.

Instead, the game seems to use a shift register based pseudo-RNG.

A shift register is a fairly old chip that shifts bits in one direction:


In the C64, it's pretty easy to manipulate a byte this way using the ROL (rotate left) or ROR (rotate right) command. These commands stick the "dropped" bit into the processor carry flag which allows bits to roll over to adjacent ones.

This is pretty useful for making things like scrolling marquee signs or scanning keyboard arrays. In binary, shifting a bit over can double or halve the overall byte value too - so with a shift register it is pretty easy to cover the whole range of random numbers. But simply taking one or two bits and rotating them around like this isn't any good, since you would only effectively have 4 possible values in the example above (compared to 16 possible total states).

So to increase the number of values expressed, you can feed back part of the shift register into its own input. The example below inverts the second bit and feeds it back into the first:


You can see that even though it starts with one bit high (or even no bits), it quickly settles into a regular pattern. However, there are still only 4 values once the loop is stabilized.

The solution here is to vary what inputs you put in. As it turns out, if you XOR (eXclusive OR, aka "output 1 if inputs differ") the first and last bits and feed it back in, you can achieve a sequence that displays 15 of 16 possible total states (missing the all-null state):



The sequences shown is (little-endian): 8, 12, 14, 15, 7, 11, 5, 10, 13, 6, 3, 9, 4, 2, 1. Each state (except 0) is represented exactly once for a flat distribution.

This is called a maximal sequence length linear-feedback shift register. This fits all of our criteria: it expresses (almost) every possible value, does so in a random-appearing way as high-value bits get turned on and off, is very fast to run and easy to implement. Oh, and all the "maximal length" taps listed on the Wikipedia article are wrong - the example images don't even match the table!

To get the first and last bits in the C64, there are a few approaches, but the most straightforward way to me is to copy the register, AND it with your preferred bitmask (so to find the fourth place: 1010 AND 0001 -> 0000), subtract (SBC) your bitmask (0000 - 0001 will set the negative flag) and check for negative values. Then EOR (C64 version of XOR) the bits and use them to set the carry flag (SEC), which the ROL/ROR operation picks up and uses as the inserted bit.

So we end up with this kind of loop:

Copy register
Clear carry flag
Extract value of first bit
Extract value of last bit
XOR first and last bit
Set carry flag depending on outcome
Rotate register, inserting new bit
Clear carry flag

It's not exactly the same as what's in game, since in game there actually isn't a maximal-length sequence used - the developers maybe did this intentionally to make it run faster.

This runs a lot and is single-handedly responsible for a lot of the delay between turns. It turns out that the game applies another mask to the RNG values to limit them to a certain length - that corresponds almost exactly to the various list lengths of the news string arrays.

So that's the mystery of the news items solved: every news item that isn't directly related to costs or cash is randomly generated.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply