Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu Sep 20, 2018 4:07 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Jan 23, 2018 1:07 pm 
Offline
Engineer
Engineer

Joined: Tue Jan 23, 2018 12:51 pm
Posts: 3
Location: Moscow, RU
Hi all,

I'd like to make some analysis/data visualization for OpenTTD data. At the moment it looks to me like the best option would be to get a kind of events happening in it (like train #n stopped at the station $station_name; train #n unloaded $cargo_name for $dollars; factory $factory_name has increased output to $value, etc). Or the other suitable option is to have an API and poll it periodically for changes.


Correct me if I wrong, but it seems to me that NoAI and Game Scripts frameworks have only access to non-player objects.

Is there anything like that available? I don't think I can build it inside of OpenTTD so I'm looking for a way to get the data outside of it.


Top
   
PostPosted: Tue Jan 23, 2018 1:33 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jan 26, 2001 8:18 pm
Posts: 23877
Skype: orudge
Location: Banchory, UK
I think if you're wanting to hook into a live game, the best way to do so is via a multiplayer server. JOAN (Java OpenTTD Admin Library) seems to be the most complete project that does this. There's also an older Python project available.

If you're just wanting to interrogate a saved game, I started work on a C# library to do this some years ago - it's a bit stuck in limbo but one day I will hopefully release it (although it may not be complete!)

_________________
Owen Rudge
owenrudge.net | Owen's Transport Tycoon Station | Owen's Locomotion Depot | The Transport Tycoon Wiki


Top
   
PostPosted: Tue Jan 23, 2018 4:33 pm 
Offline
Engineer
Engineer

Joined: Tue Jan 23, 2018 12:51 pm
Posts: 3
Location: Moscow, RU
Thanks for the hint. Both libraries look a bit undocumented to me but connecting to (or maybe emulating?) a network server looks like a good idea to start with.


Top
   
PostPosted: Tue Jan 23, 2018 7:04 pm 
Offline
Engineer
Engineer

Joined: Wed Dec 20, 2017 5:56 pm
Posts: 26
What's an api ?


Top
   
PostPosted: Tue Jan 23, 2018 10:32 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Aug 08, 2005 1:46 pm
Posts: 1833
Location: Ipswich
Andrew_if wrote:
Is there anything like that available? I don't think I can build it inside of OpenTTD so I'm looking for a way to get the data outside of it.

I would expect that doing it from within OpenTTD would be by far the easiest way to do it.

Events like trains stopping at stations, cargo unloading, etc. are not directly recorded in savegames after the fact, and are not transmitted as part of the multiplayer protocol.
Each multiplayer client runs a full game simulation separately.

Adding some printf lines to key functions in the source, recompiling, running it, and then analysing the output is probably your best bet.

_________________
Ex TTDPatch Coder, Grumpy Greymuzzle
Avatar by MoonsongWolf.
Patch Pack, Github
Dad-Coder since April 2018


Top
   
PostPosted: Wed Jan 24, 2018 9:10 am 
Offline
Engineer
Engineer

Joined: Tue Jan 23, 2018 12:51 pm
Posts: 3
Location: Moscow, RU
JGR wrote:
Andrew_if wrote:
Is there anything like that available? I don't think I can build it inside of OpenTTD so I'm looking for a way to get the data outside of it.

I would expect that doing it from within OpenTTD would be by far the easiest way to do it.


By "outside" I mean that my data viz project won't be a part of the game. At the moment I'm thinking about a streaming engine like Apache Kafka plus Grafana as a front-end. Maybe a kind of database in between. I hope it will be interesting/useful not only for me but don't know if it possible at all and if I can do it simple and reproducible. The question is if I can feed this system with data.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.