The International Simutrans Forum

 

Author Topic: Extension request (exp): Catering_level for station extensions  (Read 2725 times)

0 Members and 1 Guest are viewing this topic.

Offline wlindley us

  • Devotee
  • *
  • Posts: 962
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Extension request (exp): Catering_level for station extensions
« on: January 06, 2012, 12:57:56 PM »
Could station extension buildings have a catering level, as well?  If we used the same logic as currently for passengers and traveling post offices -- they would have a higher maintenance cost, but would derive revenue from the waiting passengers.  Might even increase the happiness of the passengers at that station?  Something like this:

Code: [Select]
Obj=building
 Name=Station Cafe
 type=extension
 catering_level=2
 ---
Obj=building
Name=Restaurant
type=extension
catering_level=3
---
Obj=building
Name=Hotel
type=extension
catering_level=5

The exisitng Post Office buildings (and in pak128.Britain, the Staging Inn) would get assigned a catering_level as well; post-boxes and bus-stops would (presumably) not.


Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18587
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #1 on: January 06, 2012, 01:10:17 PM »
I had considered something similar to this, but mainly related to passengers' maximum waiting times at stations (better equipped stations have a longer wait time before passengers abandon their journeys and demand refunds). However, such an idea would, I am afraid, have to come at the bottom of a long list of things that I need to do first.
« Last Edit: November 29, 2012, 03:07:26 PM by jamespetts »

Offline wlindley us

  • Devotee
  • *
  • Posts: 962
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Extension request (exp): Catering_level for station extensions
« Reply #2 on: November 29, 2012, 02:55:18 PM »
Continuing a discussion from here:

If you want to simulate mail more realistically it might be worth having sorting offices (or for some time periods travelling post offices)... Could be done by forcing mail interchange stops to have special extension buildings.

Just as catering levels of vehicles affect the comfort of the entire convoy, perhaps catering levels of extension buildings affect all vehicles calling at that station.  Something like this:
  • Postal building catering levels
    • Basic postal sorting office: Permit mail transfers (postal buildings with catering_level=0 would then be for storage only)
    • Well Staffed facility: Reduce standard vehicle mail loading time by 25%
  • Passenger building catering levels
    • small restaurant: Increase comfort by 10%
    • large restaurant: Increase comfort by 20%
    • first-class lounge: Increase passenger revenue overall by 5%
Per Kierongreen's observation,  requiring an extension building would eliminate the oddity of post-boxes being used to transfer mail.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18587
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #3 on: November 29, 2012, 03:09:10 PM »
Hmm - I worry that things that might interfere with the routing (extensions requiring transfers) would increase complexity both for the purposes of computational load and player convenience beyond acceptable bounds.

As for comfort: comfort is a property of lines and convoys, not stops. How would catering facilities at stops interact with comfort in your model?

Offline wlindley us

  • Devotee
  • *
  • Posts: 962
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Extension request (exp): Catering_level for station extensions
« Reply #4 on: November 29, 2012, 04:21:56 PM »
How would catering facilities at stops interact with comfort in your model?

In simconvoi.cc, starting around line 4270, the fare is calculated when a convoy arrives --

Code: [Select]
                                comfort = line->get_finance_history(1, LINE_COMFORT);

Below there is where the comfort modifier, speed bonus, and catering levels are computed.

As an extension --  Some of those calculations could include an additional variable which is derived from halt.catering. 

Here's how I read the code now:

The variable "comfort" comes from the line's history, or if not bound to a line, the convoy's history.  Then a comfort modifier of either 20% or 100% is used based on the journey distance. If the comfort is higher than "tolerable" the modified comfort boosts the revenue; if less than tolerable, it cuts the revenue.   Curiously, this means passengers always give either a luxury bonus or subtract a discomfort penalty -- there is no "grey area" in which neither is applied.

As an extension -- We could, for example, define a station extension that would add a fixed value to the "comfort" variable before the modifier is used.

For mail, looking at line approximately 4390: If the journey length in minutes is above the "TPO Threshold"  then a bonus is added.  The bonus looks to be 10%.

As an extension --  If halt.catering > 0, we could add an additional 10% on top of that.

p.s., This suggests a secret of the comfort calculation:  It may be highly advantageous to put rakes (consists for our American viewers) which are out-of-the-ordinary into their own lines, or leave them without lines.  If you have a suburban line of ten relatively uncomfortable trains, and you upgrade one of them with high comfort equipment, you spread the comfort bonus across all ten trains; but if that train is in its own line, or has no line, then that train alone gets the entirety of the comfort bonus.  Likewise if you have a line with ten relatively comfortable trains, and one rather uncomfortable one, that one train drags down the comfort bonus for all the trains.  If everything were equal, the simple averaging wouldn't matter... but through judicious use of wait-until-full and departure schedules, we can get a real boost from this.
« Last Edit: November 29, 2012, 04:31:12 PM by wlindley »

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #5 on: November 29, 2012, 05:58:02 PM »
This is a very interesting idea.

Offline wlindley us

  • Devotee
  • *
  • Posts: 962
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Extension request (exp): Catering_level for station extensions
« Reply #6 on: November 29, 2012, 06:32:45 PM »
Specifically, makeobj could compute a 16-bit binary catering_level field for stations as follows:

Code: [Select]
catering = (enables_pax << catering_level) bitwise-or (enables_post << catering_level  << 5) bitwise-or (enables_ware << catering_level << 10)
which results in the bits p1-p5 for passengers, m1-m5 for mail, and w1-w5 for goods:

(0)(w5)(w4)(w3)(w2)(w1)(m5)(m4)(m3)(m2)(m1)(p5)(p4)(p3)(p2)(p1)

Thus permitting you to build, at a station, an extension of catering-type 1 and an extension of catering-type 4, for example, and have both of those modifiers at that station.  Those bit flags would be used in simconvoi.cc to apply the various modifiers.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18587
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #7 on: November 30, 2012, 12:04:42 AM »
It's not correct that the comfort calculations are either exactly 20% or 100% - they scale proportionately between various ranges set in simuconf.tab. Here is the full code for reference:

Code: [Select]
if(final_revenue && ware.is_passenger())
{
//Passengers care about their comfort
const uint8 tolerable_comfort = calc_tolerable_comfort(journey_minutes);

uint8 comfort = 100ll;
if(line.is_bound())
{
if(line->get_finance_history(1, LINE_COMFORT) < 1)
{
comfort = line->get_finance_history(0, LINE_COMFORT);
}
else
{
comfort = line->get_finance_history(1, LINE_COMFORT);
}
}
else
{
// No line - must use convoy
if(financial_history[1][CONVOI_COMFORT] < 1)
{
comfort = financial_history[0][CONVOI_COMFORT];
}
else
{
comfort = financial_history[1][CONVOI_COMFORT];
}
}

// Comfort matters more the longer the journey.
// @author: jamespetts, March 2010
sint64 comfort_modifier;
if(journey_minutes <=welt->get_settings().get_tolerable_comfort_short_minutes())
{
comfort_modifier = 20ll;
}
else if(journey_minutes >=welt->get_settings().get_tolerable_comfort_median_long_minutes())
{
comfort_modifier = 100ll;
}
else
{
const uint16 differential = journey_minutes - welt->get_settings().get_tolerable_comfort_short_minutes();
const uint16 max_differential =welt->get_settings().get_tolerable_comfort_median_long_minutes() -welt->get_settings().get_tolerable_comfort_short_minutes();
const sint64 proportion = differential * 100 / max_differential;
comfort_modifier = (80ll * proportion / 100ll) + 20ll;
}

if(comfort > tolerable_comfort)
{
// Apply luxury bonus
const uint8 max_differential = welt->get_settings().get_max_luxury_bonus_differential();
const uint8 differential = comfort - tolerable_comfort;
const sint64 multiplier = (welt->get_settings().get_max_luxury_bonus_percent() * comfort_modifier) / 100ll;
if(differential >= max_differential)
{
final_revenue += (revenue * multiplier) / 100ll;
}
else
{
const sint64 proportion = (differential * 100ll) / max_differential;
final_revenue += (revenue * (sint64)(multiplier * proportion)) / 10000ll;
}
}
else if(comfort < tolerable_comfort)
{
// Apply discomfort penalty
const uint8 max_differential = welt->get_settings().get_max_discomfort_penalty_differential();
const uint8 differential = tolerable_comfort - comfort;
sint64 multiplier = (welt->get_settings().get_max_discomfort_penalty_percent() * comfort_modifier) / 100ll;
multiplier = multiplier < 95ll ? multiplier : 95ll;
if(differential >= max_differential)
{
final_revenue -= (revenue * multiplier) / 100ll;
}
else
{
const sint64 proportion = (differential * 100ll) / max_differential;
final_revenue -= (revenue * (multiplier * proportion)) / 10000ll;
}
}

// Do nothing if comfort == tolerable_comfort
}

What I do not understand about your suggestion, however, is how station comfort would fit into line comfort. How would the comfort of a station be weighted against the comfort of a line? Would it be the arrival or departure station in which comfort is taken into account or both? If both, how would they be weighted against each other? Would the importance of the comfort of the station adjust in proportion to the waiting time at the station? How would this interact with the comfort of a line differing in importance with the travelling time?

Offline wlindley us

  • Devotee
  • *
  • Posts: 962
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Extension request (exp): Catering_level for station extensions
« Reply #8 on: November 30, 2012, 06:15:09 AM »
No, there would not be a value for "station comfort" ... these would be extension buildings that set binary flags to describe the extra characteristics a station.  (e.g., one bit for "Has restaurant")

When a vehicle arrives at a station, the fare calculation would include, for example, "If arrival station 'has restaurant', increase the computed line-or-convoy comfort by 20% before computing fare".

The binary flags could also be used in, for example, the logic when a train prepares to depart a station: "If departure station 'has signal-box', reduce the convoy's initial loading time countdown by 25%."

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18587
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #9 on: November 30, 2012, 12:52:41 PM »
I'm not sure that it makes sense for a station to increase the comfort by a fixed amount when the proportion of time that people spend travelling as opposed to waiting at the station might vary wildly.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Extension request (exp): Catering_level for station extensions
« Reply #10 on: November 30, 2012, 08:22:03 PM »
I think that Station they have good comfortlevel have that than passenger they more use.