Dumping Expenses (stats) every year

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
kaspaa
Engineer
Engineer
Posts: 8
Joined: 19 Apr 2013 14:25

Dumping Expenses (stats) every year

Post by kaspaa »

I want to dump expenses (whatever stats) for all players every year just to txt or csv.

I've searched for quite some time for a solution - the closest was a patch written way back in 2006 - http://www.tt-forums.net/viewtopic.php? ... cs#p451840. If I compile the patch into a dedicated server will it still run okay for clients?

Or does anyone know if autopilot would give me the information?

Is the issue that there is noway to get this sort of information from the console?

Any advice would be helpful.

K
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Dumping Expenses (stats) every year

Post by planetmaker »

Use the logging function of the admin port.

You'll need a programme which interfaces with that - something which is a bit difficult to find and which you likely will have to write yourself (if you do, do better than existing solutions, don't keep it to yourself, but share it). Some starting places:


Java:
* Joan with the demo-implementation grapes and example-plug-in berries.
* openttd-admin

Python: libottdadmin
kaspaa
Engineer
Engineer
Posts: 8
Joined: 19 Apr 2013 14:25

Re: Dumping Expenses (stats) every year

Post by kaspaa »

planetmaker wrote:Use the logging function of the admin port.

You'll need a programme which interfaces with that - something which is a bit difficult to find and which you likely will have to write yourself (if you do, do better than existing solutions, don't keep it to yourself, but share it). Some starting places:

Python: libottdadmin
Thanks to Xaroth's libottdadmin2 I've been able to make some progress on dumping stats. The stats are then loaded up and displayed on the web. So far so good.

Image
User avatar
3iff
Tycoon
Tycoon
Posts: 1094
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Dumping Expenses (stats) every year

Post by 3iff »

That looks great. Does data get dumped every year?
kaspaa
Engineer
Engineer
Posts: 8
Joined: 19 Apr 2013 14:25

Re: Dumping Expenses (stats) every year

Post by kaspaa »

3iff wrote:That looks great. Does data get dumped every year?
It's run through the admin port, so data can be dumped at any interval. At first I had all data displayed monthly. but it's a bit overwhelming to chart. So 3, 6, or 12 months.

Unfortunately it looks like "income" information from the admin port is just change in money rather than any form of earnings.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Dumping Expenses (stats) every year

Post by Zuu »

First, I want to say that I don't know what information that is available through the admin port.

However, if there is any information available in the GS API, but not directly via the admin port, you can use ServerGS as a bridge to from admin port to GS API. Income information in the GS API is found in GSCompany.

The current version (version 1) of ServerGS will only support nightlies of r25808+, but IIRC it is quite trivial for me to support also 1.3.2 with it. Just let me know in its thread if you are interested in that.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
kaspaa
Engineer
Engineer
Posts: 8
Joined: 19 Apr 2013 14:25

Re: Dumping Expenses (stats) every year

Post by kaspaa »

Zuu wrote:First, I want to say that I don't know what information that is available through the admin port.

However, if there is any information available in the GS API, but not directly via the admin port, you can use ServerGS as a bridge to from admin port to GS API. Income information in the GS API is found in GSCompany.

The current version (version 1) of ServerGS will only support nightlies of r25808+, but IIRC it is quite trivial for me to support also 1.3.2 with it. Just let me know in its thread if you are interested in that.
Just had a read rough the gs api - it looks like it'd be great! If you could make it compatible with 1.3.2 I would appreciate that.

Can GSAPI be used concurrently with your other gs scripts such as 'neighbours are important'?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Dumping Expenses (stats) every year

Post by Zuu »

The ServerGS game script will be the most responsive GS to use if you want GS access from the admin port. It is possible to add such capability to other GS by perhaps releasing the Server GS core as a library which other GSes can use. However, I'm not sure how large the interest would be from GS authors to incorporate this into their GSes. The general interest of the Script Communication Protocol library (which adds AI<->GS communication to allow making AIs aware of GS goals not handled by OpenTTD API) has seemed to be quite low.

Another option is to look at doing what Server GS do, but inside OpenTTD. Though, then you are at a point where I wonder if users will be okay with having not 100% of the GS Squirrel API available or keep demanding that every feature in GS for squirrel to be available via admin port (which is non-easy when you come to things like valuating lists etc that use variables holding non-simple data types in Squirrel).


So, it is possible more the point that each GS should consider to offer some stats control points via the Admin Port rather than offering full GS API access.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
kaspaa
Engineer
Engineer
Posts: 8
Joined: 19 Apr 2013 14:25

Re: Dumping Expenses (stats) every year

Post by kaspaa »

Zuu wrote:The current version (version 1) of ServerGS will only support nightlies of r25808+, but IIRC it is quite trivial for me to support also 1.3.2 with it. Just let me know in its thread if you are interested in that.

Hi Zuu, reckon you could make the ServerGS compliant with 1.3.3?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Dumping Expenses (stats) every year

Post by Zuu »

It is actually ready. I was only waiting for 1.3.3 to be released and have a version flag in bananas. :-)


Edit: I've now released a Server GS v2 which is compatible with 1.3.3.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Dumping Expenses (stats) every year

Post by Kogut »

kaspaa, can you share your code? It looks amazing and doing something like this is on my list of TODO since months.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 51 guests