The International Simutrans Forum

 

Author Topic: Line management separate graphs for passenger classes  (Read 1656 times)

0 Members and 1 Guest are viewing this topic.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2686
  • Languages: EN
Line management separate graphs for passenger classes
« on: January 09, 2018, 07:06:30 AM »
Would be useful if line management had separate graphs for different passenger classes. Currently it is very difficult to know how much traffic of different kinds one is shipping via a line. This could also apply to mail.

If one does not want to clutter up the UI these separate graphs could be overlaid onto the Transported graph, using distinct colours for different classes.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18617
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Line management separate graphs for passenger classes
« Reply #1 on: January 18, 2018, 09:27:11 AM »
That is an interesting idea. I doubt that I will have time to implement this myself for a very long time, but I do not know whether this would be something that Ves would be interested in doing.

Offline Kirill Stepanoff

  • *
  • Posts: 8
Re: Line management separate graphs for passenger classes
« Reply #2 on: January 31, 2018, 01:02:33 PM »
Also it could be usefull to have separate graph for transported cargo class bulk/piece/long/perishable/livestock.
It would be great tool to adjust mixed freight line composition accordingly to actual freight transported by specific line. In current version it is three options -
 1. to run separate convoys for each cargo type, see if specific cargo builds up on stations or capacity is underused,  add more convoys of that type or withdraw/divert some;
2. Run mixed convoys and readjust their composition when you see that some cargo is overcrowding at station storage and some is rarely seen at stations;
3. Try to do the heavy math - collect data for each source and drain connected to the line, wich is available for only last 12 month, and calculate the required monthly capacity. It is somewhat simple to p2p connections, but when it comes to interconnected networks with several nodes many sources and drains of each cargo type, with cargo flows splitting and merging it would be like analyzing DC-electrical circuit. And I'm not good in doing matrix algebra mentally ;)

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18617
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Line management separate graphs for passenger classes
« Reply #3 on: January 31, 2018, 11:05:04 PM »
Hello and welcome to the forum! Thank you for your contribution.

As I noted above, as is common with many open source projects, coder time is very much at a premium. I am doubtful that I shall have time to work on this aspect of things myself in the foreseeable future; I cannot speak for others, although all the other contributors also only work on Simutrans-Extended in their spare time, and all have their own priorities.

May I ask whether you are familiar with C++? If so, you could code the feature yourself. Indeed, given the very large backlog of current development projects, it would quite seriously be quicker for you to learn to code from scratch and implement this feature than it would for me to get around to it after completing all higher priority projects.

I do not mean to disparage your idea in any way - it would be a most useful thing to have this sort of statistical separation; but there are a very large number of other things that are equal or higher priorities for very limited coding time. I should be happy to review and incorporate a patch to add this feature (providing that it works without causing unwanted side effects) from anyone who would care to code it.

Offline Kirill Stepanoff

  • *
  • Posts: 8
Re: Line management separate graphs for passenger classes
« Reply #4 on: February 08, 2018, 10:24:12 AM »
It seems to me that lines have no tools to accumulate any cargo statistics - they just aggregate statistics collected by convoys running that line.

On first glance on code in "simconvoi.h", ability to store separate statistics for each type of freight/mail/passengers will require to enlarge financial_history array about x3..4. I'm not sure how this will do with memory requirements: 16*int64 for each convoy on the map for pack128.Britain, if I haven't missed some cargo type or special cargo.
Second, number of passenger/mail/cargo classes is pack-dependent, so it may be reasonable to store that statistic in some sort of dynamically allocated container, or switch to dynamically allocated arrays instead of static. But in case of containers that will bring more overhead for convoys that are hauling many types of cargo.

The other way to get similar statistic data is to store it in station connection data, may be even create additional additional connection matrix (it would be sparce matrix) for that. I'm not sure how resource-hungry will be that. Are there more convoys than stations connections in typical late-game? But this can give a tip to add additional convoy to some capacity-hungry connection.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18617
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Line management separate graphs for passenger classes
« Reply #5 on: February 08, 2018, 10:30:10 PM »
I do not think that the memory overhead for adding statistics to convoys is likely to be excessive. (I do not advise adding this for connexions, however, as they are a performance critical part of the code).

If you would like to code this feature, you would be welcome to do so - so long as it works well and does not break anything else, I should happily incorporate it.

Offline Kirill Stepanoff

  • *
  • Posts: 8
Re: Line management separate graphs for passenger classes
« Reply #6 on: February 24, 2018, 08:43:23 AM »
Is there any class/function reference and savegame format description?
And which C++ standard is preferable to use c++98, 03 or 11?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18617
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Line management separate graphs for passenger classes
« Reply #7 on: February 24, 2018, 12:36:16 PM »
The saved game format is a little ad hoc: it relies on the saved game file having the exact data in the exact order that the game expects; different data can be expected in different sequences depending on the file name version, which can be accessed in any rdwr() method (rdwr standing for "read/write") with the file->get_extended_version() and file->get_extended_revision() method calls (I suggest incrementing the revision for your purposes).

As to the C++ standard, Simutrans was written before even C++98 was finalised (the project was originally started in 1997), and for a long time sought to maintain compatibility with older compilers, so the code is mostly written in what is now a very dated C++ style.  However, Simutrans (both Standard and Extended) now officially target C++11, so you can use any of the language features of C++11 to work on the code.