Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Jan 16, 2019 11:23 am

All times are UTC




Post new topic  Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue Jan 01, 2019 9:23 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 02, 2008 7:45 am
Posts: 21
I have no idea how "scripts" actually work and what they could do.
But is there a script or perhaps a way to write a "automatic spectator script"?

The idea is that someone would host a server and play like you normally would with your friends.
Then you'd have a separate client join and run the spectator script on that client.
The script would pan around the map and look at what everyone's doing, and also now and then show the stats of each player.
That client could then be streamed to Twitch (or similar) for everyone to enjoy.

Is this something a script could do?


Top
   
PostPosted: Wed Jan 02, 2019 1:36 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4545
Location: /home/sweden
No, not using AI or Game Scripts of current official release versions.

- Game Script has an API to pan the view, but it only work in single player.
- AI doesn't have this API as they control companies. Also the AI code only runs on the server in multiplayer.

With the possibility of custom source code changes, it is possible you just have to figure out how to implement it. (this is not an offer to do it for you)

Edit: Also, note that there may be other solutions using console scripts or admin port that could solve your problem, but as you posted in the AI and Game Script sub forum, the answer focus on this area.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Wed Jan 02, 2019 7:18 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 02, 2008 7:45 am
Posts: 21
Good to know!
Is there perhaps some way to output information about the current game to a text file of some sort?
Perhaps the server could write each new event, along with its position and who created the event, to a log file.


Top
   
PostPosted: Wed Jan 02, 2019 8:15 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9102
Location: Sol d
Hezkore wrote:
Good to know!
Is there perhaps some way to output information about the current game to a text file of some sort?
Perhaps the server could write each new event, along with its position and who created the event, to a log file.

You can do that via the admin port. One of its purposes is logging. SOAP is the incarnation I use for accessing it.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Thu Jan 03, 2019 7:58 pm 
Offline
Engineer
Engineer

Joined: Wed Dec 18, 2013 12:32 pm
Posts: 99
CityMania client has a spectator patch. You can select one player or whole company and it will continuously pan to a place of last action. It's not a particularly nice viewing experience as you only see the end result of each action not player's mouse or building process. But it's the best you can do without requiring players to run a heavily modified game or some video recording software.


Top
   
PostPosted: Sat Jan 05, 2019 4:35 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 02, 2008 7:45 am
Posts: 21
Is there anywhere I can read about this "Admin Port" without looking at pure source code?
Any sort of documentation?


Top
   
PostPosted: Sat Jan 05, 2019 5:19 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4545
Location: /home/sweden
There is docs/admin_network.txt with protocol documentation.

On the wiki, you can find some starting points for libraries/utilities to use as is or to read in order to learn and build your own.
https://wiki.openttd.org/Server_admin_port

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
PostPosted: Sat Jan 05, 2019 6:45 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 02, 2008 7:45 am
Posts: 21
I've got a bot running that can connect and send and receive data.
But the data structure of each packet is a mystery.
Having to decode someone else code (in a different language) is quite the chore.
The wiki should really have a brief overview of each packet and its data structure.


Top
   
PostPosted: Sun Jan 06, 2019 9:10 pm 
Offline
Engineer
Engineer

Joined: Tue Sep 02, 2008 7:45 am
Posts: 21
I ended up creating an Admin Port library for the open-source language Monkey2

You can read more about it in this thread

Image


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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-2019 phpBB Limited

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