Page 1 of 2

Contracts System

Posted: Wed Jan 09, 2008 9:32 pm
by davcefai
Could somebody please enlighten me as to how the contracts system in Oolite works? I'm not sure if it's broken.

I had worked my way up to getting some very lucrative contracts - gold, platinum and gemstones. Suddenly I'm back to more mundane cargos for comparatively small fees.

Where before, in my saved games, my contract record listed several contracts, it now lists one or none at all. In the reputation section I have:
<key>reputation</key>
<dict>
<key>contracts_expired</key>
<integer>0</integer>
<key>contracts_fulfilled</key>
<integer>9</integer>
<key>contracts_unknown</key>
<integer>0</integer>
<key>passage_expired</key>
<integer>0</integer>
<key>passage_fulfilled</key>
<integer>0</integer>
<key>passage_unknown</key>
<integer>7</integer>
</dict>
Moreover most of the contracts on offer are too large for my ship - an Imperial Courier.

I have tried pasting previous contract records into the current save file but the entries vanish with the next save.

I am running 1.71 and regularly download the nightly builds.

Posted: Wed Jan 09, 2008 10:46 pm
by Eric Walch
davcefai wrote:
Could somebody please enlighten me as to how the contracts system in Oolite works? I'm not sure if it's broken.
I never understood it. The code is very complex and I have been looking if a player status has influence on the offered contracts. I still don't know if it has.

But in principal are the numbers in the save file no real contract numbers. You should more see it as a score number, or reputation. For every fulfilled contract the "contracts_fulfilled" number raises, for every expired one the "contracts_fulfilled" number lowers. When it goes below zero, is starts raising/lowering the "contracts_expired".

"contracts_fulfilled" (or any of the other entries) never should get higher than 7 when I look at the code. (I see 9 in your save file).

On time it erodes the reputation. "contracts_fulfilled" and "contracts_expired" change to "contracts_unknown". However the sum of the several contract entries should never raise above 7. Probably you edit it to high and now it gets confused.

Posted: Thu Jan 10, 2008 5:43 am
by davcefai
Thanks for this.

'contracts_fulfilled' reached 9 on its own. I'll see what cutting it back to 5 does - it's too early in the morning to even think of trying now.

Posted: Thu Jan 10, 2008 4:03 pm
by Eric Walch
Last time I looked at the source code of the contracts was half a year ago. Then I didn't understand exactly how the individual files were linked (I still have problems, but less). In the contract code a reputation is calculated based on the numbers in the save file resulting in a reputation number between -7 and +7.

Half a year I could not see were this reputation was used. Now I see that the "contracts" file is also called from within the "station" file and from within the "system" file. It is the system file that is checking for the "reputation" when it is making a list of available contracts for a given system.

Every time a contract is fulfilled in time it calls a function that raises the reputation. But there is a check of lower than 7 before increasing the value. Thus maximum can not raise above the 7.

Looking at the function structure and because it is part of the player entity, it is a function that also can get called from the legacy-script. I tried it several times, and noticed that my reputation rose, but stopped as the value of 7. (as it was programmed).

I probably never traded enough. With a reputation of 7 I got an lucrative offer to bring 6000 grams of gems to an very nearby system. And just 6 kg fits in even the smallest ship. So the contracts in Oolite 1.70 work as they always did.

I'll program this into my own UPS courier for the next release: increasing of the general contract reputation when a UPS delivery contract was fulfilled. (and decreasing by change on refusal)

Posted: Fri Jan 11, 2008 9:30 am
by Eric Walch
Now I have it clear. On entering the market 256 different cargo transports are calculated. Of which the player only sees the first few. But during calculating some are skipped.

From the code I read in a selection for skipping:

Code: Select all

if ((unit == UNITS_TONS)||([player contractReputation] == 7))	// only the best reputation gets to carry gold/platinum/jewels
This means that all contracts in TONS are shown (no matter what the reputation is) and contracts in all UNITS when the players "contractReputation" equals 7. Or in more clear English: contracts in grams or kilograms are only offered when the reputation is exactly 7 (not >= 7).

Your value of 9 makes that you don't get them. When you don't trade for a while. Full filled contracts will erode to a lower value and simultaneously the "unknown reputation" will rise. The sum however will be still wrong and will never correct itself. But seeing the code and the always present check for "< 7" before raising the value, I still can't believe it got to 9 by itself.

By the way, erosion of someone's reputation goes by chance factor and will happen on average by 1 reputation point every 32 jumps. So to keep your reputation up at the highest level, you must keep fulfilling contracts.

Posted: Fri Jan 11, 2008 12:45 pm
by Hoopy
since contracts seem to be a bit underused by most players do you think it might be an improvement if the decay was removed so the rating only dropped if you failed to make a delivery?

Posted: Fri Jan 11, 2008 1:25 pm
by Eric Walch
Hoopy wrote:
since contracts seem to be a bit underused by most players do you think it might be an improvement if the decay was removed so the rating only dropped if you failed to make a delivery?
It is very underused as you say. Therefor also my long explanation on this subject to give this function within Oolite more appreciation.

However, it works fine as it does in my opinion. If one really goes for earning money with deliveries, it will take him on average less than 10 jumps for a delivery. He won't accept the longest distances and will also combine freight. With a decay rate of one point every 32 jumps, he will easily improve his reputation until the highest level when he stays on the subject.

The player only needs to know it is profitably to keep on transporting. But the big profit is there only for the persistent player.

For passenger transport I see less profit. Players with good records only get relatively more jobs offered to systems with higher government number. But it could be that those passengers pay more.

Posted: Fri Jan 11, 2008 1:32 pm
by Hoopy
As you've said it works fine if you use it regularly. But if a new mission OXP is launched and you decide to play that for a while then you're back to square 1. That seems a bit harsh when you've not done anything 'wrong'. Think how masny jumps it takes to complete assassins for example...

Posted: Fri Jan 11, 2008 1:54 pm
by another_commander
On the subject of passenger transport, I think it could be desirable to review the payment system. Meaning, make passenger contracts much more profitable than what they are now, in order to give the players initiative to engage in taxi services. To me, it makes sense that any person willing to hire a ship to travel to a destination some 20 jumps away would be ready to pay a very handsome fee for it. But it should be made in such a way, so that taxi runs become about as profitable as cargo ones. There should be some kind of balance between the two. As it is now, no one is even looking at passenger opportunities.

Posted: Fri Jan 11, 2008 2:53 pm
by davcefai
It makes sense that your contract reputation will drop if you stop accepting contracts. It parallels real life - "How good is he? What was his last job? Hmm, that's some time back, is he over the hill?

Regarding Passenger Transport, I agree that it should be made more attractive.

As far as my problem goes, I do not remember seeing "contract reputation" in my save file. Last night I set "contracts fulfilled" to exactly 7 and I didn't get any attractive offers while visiting 3 stations.

I enjoy the contracts part of Oolite. It sets a purpose to one's voyages and, if you have 3 (carefully selected) cargos in your hold timely delivery can be quite tricky.

Eric I can assure you that contracts fulfilled got to 9 on its own, with no assistance from Kwrite.

Posted: Fri Jan 11, 2008 4:11 pm
by Hoopy
it may parallel real life but we're talking about a game here - it's meant not be fun above being realistic. Hence you can fly to the sun in a couple of minutes instead the hours it would take in any simulated system.

Posted: Fri Jan 11, 2008 4:33 pm
by Disembodied
I agree completely with the need to revise passenger transport rates. It's not currently economically viable. You have to give up 5 tons of cargo space in order to carry one passenger: that's 5 tons of potential profit you're losing out on each jump. OK, not every jump will be a Poor Ag-Rich Industrial milk run, but I think you could assume a minimum value of, what, 10Cr per ton per jump? That would mean that over a 10-jump run, the passenger bay space would be worth 500Cr to the player. Then there's fuel costs (call that another 80Cr), plus bed and board... I think a break-even charge for transporting a passenger 10 jumps would be near on 800Cr. Add on being willing to take a route not of your choosing, and a profit margin, I'd really want about 2500Cr minimum for a 10-jump passenger contract. Currently you'd be lucky to get half that.

Maybe there could be different classes of passenger cabin? Dr Nil has done some recent adverts...

Image
Image


The bottom rung could be a 1-ton cold storage unit, where the passenger travels in hibernation (like I assume slaves do). Passengers could get away with paying 1000Cr for a 10-jump trip in one of those. For a standard 5-ton cabin, that could be multiplied by 2.5. And for a luxury 10-ton berth, I'd say multiply the fee by 7.

Posted: Fri Jan 11, 2008 5:07 pm
by Eric Walch
davcefai wrote:
As far as my problem goes, I do not remember seeing "contract reputation" in my save file. Last night I set "contracts fulfilled" to exactly 7 and I didn't get any attractive offers while visiting 3 stations.
The physics used by Oolite try were possible to follow real live. Also in this case. From the comment in the source:

Code: Select all

// now we need a commodity that's both plentiful here and scarce there...
// build list of goods allocating 0..100 for each based on how
// much of each quantity there is.
When offering Oolite does not just invent offers, but analyses a large series of systems and compares the prices. (you probably noticed the delay when entering that screen). Based on that, it issues some offers. You could get a comparable profit when you bought them self on the market and would sell them at that destination. (I think). The only advantage is that you can have more cargo this way. The maximum for sale is normally 127 quantities.
This means when he does not find an interesting price difference for precious metals or gems, he will not offer one. The only thing what reputation does is removing those interesting contracts when they emerge. A better reputation also increases the change of including systems with a higher government in the offer. This way the pool to get a decent contract from becomes higher and it is more likely there are better contracts among them. The precious metal contracts however, are only for those with the best reputation.

"contract reputation" as such is not saved but gets calculated from the three corresponding reputation entries in the save file.
Hoopy wrote:
But if a new mission OXP is launched and you decide to play that for a while then you're back to square 1. That seems a bit harsh when you've not done anything 'wrong'. Think how masny jumps it takes to complete assassins for example...
Yes, live is bitter and full of choices...

I'm also commercially active in real live, and when I should decide to do something else for a year, I very likely also will have lost some of my reputation when I start again.

Posted: Sat Jan 12, 2008 12:10 am
by Cmdr. Maegil
Yes, but not all of it, nor is it so difficult to regain it...
"Some people were saying he was over the hill, but he's just shown'em all wrong!"

Posted: Sat Jan 12, 2008 8:50 am
by davcefai
Regarding Passenger Transport:

This might not be easy to program but there could be different types of passengers.

1. Hitch-Hikers. They'd pay low(ish) fares, hibernate and take their chances on the arrival time.

2. Normal Travellers who would pay more and have a quite reasonable time window. I believe that some tramp steamers used to offer such a service.

3. Mega-Rich travellers who would pay a lot, take up a lot of cargo space (for their luxury cabins), have a demanding timetable and would complain (and reduce the fee) if you went off-course or bounty hunting while they were on board.