Project: Multiplayer Server Options, Commands & Goals

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

User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Project: Multiplayer Server Options, Commands & Goals

Post by XfrankX »

Good- Morning / Afternoon / Evening :)

First let me introduce myself cause this is my first post on this forum :-):

I'm Frank and i'm hosting a few Multiplayer servers online with different Landscapes. (The "-=Public=- [NL]" servers)
At the moment i'm using Autopilot+ 4.0 BETA to make a connection to IRC from the OpenTTD servers which runs pretty smoothly, but still has a LOT of limitations!

I've been reading these forums for a while now searching for some "Server Side Patches" for Multiplayer servers to make the game a little more attracting, like the mods that are allready in use on some servers. For example: The Citybuilder Module on the Luukland servers are GREAT. Also the Goal Modules on some servers are very nice!

Now: What I actually would like to know is if there are more people interested / busy with server side patching and are willing to share / contribute the code to the community.

I've allready seen a Beta of the Citybuilder patch on the forums here:

http://www.tt-forums.net/viewtopic.php?f=33&t=44319

This patch is based on / for the code of version 0.7.1 of OpenTTD which offcourse is VERY old and had A LOT of code changes in the meantime!

I was wondering if there are people who could help me in coding new server side modules / scripts like porting the citybuilder mod to version 1.1.1 (Current Stable Release)

My goal is actually to create / modify some patches for the Multiplayer Dedicated Server part of OpenTTD. Some Examples and Ideas:

- Citybuilder Module
- Goal Module
- Commands which you can use to, for example, change your name (!name Frank) without going to the console

All these modules should be available to users WITHOUT changing their base / stable client side of OpenTTD, so just downloading the client and GO :-)

These are just a few ideas and would LOVE to hear more, so if you have an idea, please let me know and I will add it to the first post :-)

If you are a coder and would like to contribute to a project (or more projects) focusing on multiplayer servers, please let me know by replying and I will setup a test server, IRC channel, etc.

Thanks for reading, hope we can get something of the ground here :-)

PS: If you would like to talk to me on IRC, i'm on:

Server: irc.x-base.org
Port: 6668
Channel: #openttd-devel

Best regards,

Frank
Last edited by XfrankX on 08 Aug 2011 10:34, edited 1 time in total.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Project: Multiplayer Server Options, Commands & Goals

Post by planetmaker »

What about the goal to make it as patches worth for trunk inclusion instead of (only) aiming to make a server-side patch... ?

Generally it would suite the game well to receive some kind of goal framework; one of the main questions is there how to properly faciliate that. Doing it as server-side only cannot be the way as it (also) should become available in single player.
User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by XfrankX »

I totally agree... It would be great if we can also construct a goal system for Single Player modes :-)

I'm just trying to share some ideas here and gather some coders who like the idea to implement some goal features, so everything is open for suggestion offcourse :-)

Thanks for your reply :-)

Frank
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by FooBar »

As for objectives, I think we can start by borrowing some ideas from Rollercoaster Tycoon. RCT2 defines the following objectives:
- Number of guests at a given date
- Monthly profit from food/merchandise
- Repay loan and achieve a given park value
- Park value at a given date
- Number of guests in park
- Build 10 rollercoasters
Those can easily be translated to TTD objectives:
- Number of vehicles of type X at a given date, with each at least a monthly profit of Y
- Monthly total vehicle profit
- Repay loan and achieve a given company value
- Company value at a given date
- Number of vehicles of type X with each at least a monthly profit of Y
- Complete X cargo chains [0] [1]

With some imagination, this can be easily expanded upon:
- In games with AI/multiplayer, have a company value at least X times as high as any of your competitors.
- Amount of cargo type X transported at a given date
- Company rating at a given date
- etc.


[0] This can be split in two separate objectives: "Complete X unique cargo chains" and "Complete X different cargo chains". In the first variant a chain is only counted if no chain with the same cargo order has been completed before. In the second variant all chains are counted as long as they each use different industries.

[1] As for industry sets that implement infinite loops (e.g. FIRS), one can start with any cargo in the chain and the chain is considered complete one cargo before the starting cargo. E.g. A > B > C > D > A; if one starts at C, the chain is complete when cargo B is transported.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Terkhen »

Welcome to the forums, XfrankX.

In my opinion, the first thing that you need to choose is how broad you want the scope of your patch to be. You could make a list of additional objectives, and let the user choose one or some of them. Although this would be simpler, in my opinion this is not the way to go. Any patch following this approach would always be incomplete, because it would not give you the freedom to define whatever goals you might want to choose.

I think that it would be better to allow goals to be scripted. OpenTTD already uses Squirrel for AI scripting so it could use that same scripting language. This would be a big project, but it would be the real solution to the goal feature IMO.

Another issue is what should goal scripts be able to do. If they only determine victory conditions and company rating they would be simpler, but one of the requests regarding goal scripts is "doing something when a given condition happens".

A patch following the "short path" of defining common goals would be very welcome, as it would allow server owners with knowledge of patching and compilation to use goals that are currently kept under lock by their coders. A patch that follows the "long path" of scripting will take a lot of work, but it will also allow total freedom. If you aim for trunk inclusion, then I think that a general solution is the way to go. If you don't want to expend months on this, then a general solution is probably not the best for you.

Regarding IRC, most of us are usually at #openttd in irc.oftc.net :)
User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by XfrankX »

Hi Terkhen...

Well, in my first post I was just thinking "in the box" of Multiplayer servers which is actually a study project for me to get familiar with the coding style of OpenTTD... I'm allready studying on the code for some time now and want to be able to write my own patches. I've allready written some scripts for Autopilot+, but these are TCL scripts (allthough they are not so different from C++ at all actually).

Anyway, it actually is a good idea to integrate "a" goal in OpenTTD and the Squirrel approach isn't so bad at all since there are allready A LOT of AI script where I can "borrow" the code from... The only thing I would like to know is: how should we integrate that into OpenTTD and do we need Game changes in code? Will users select the goal as a AI script in the main menu? Or should there be extra menu items added?

Enough to think about ;-)

Frank
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Zuu »

I think (for now):
In the menu you can select at max one goal script. Then have a configure/parameters window just as for an individual AI or NewGRF.

There might be use for several goalscripts in parallell, but restricting to one will mean that several ideas has to join into the same script if they need to run in the same game. That way the conflict handling between the ideas has to be addressed in the squirrel code. Thus the OpenTTD complexity will be lower.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Luukland
Engineer
Engineer
Posts: 98
Joined: 06 May 2007 10:37
Location: Paris, France
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Luukland »

I think it is time for you and me to have a chat: XfrankX. We have been optimizing our server patch for over 2 years now. It would be a waste of time, if you would redo everything we did in those past 2 years. Those citybuilders (origionally Citymania) are unfortuanitly since 0.7.5. impossible to run. The old beta patch posted on the forum will therefore not work without the proper modifications...

The goalserver idea can be implemented by using some Autopilot thingy. Maybe google on that one :) Contact me on IRC please!
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Alberth »

Doing goals through autopilot or whatever server managing system can be done, but immediately kills any possibility for single-player goals.
So in my opinion, it should be a 2-stage thing.

Write the goal management in a script, much like the NoAI framework, and pass any goal results through to the server management system.
Single player could then just drop the second stage.
User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by XfrankX »

I have checked the NoAI approach, but (correct me if i'm wrong) there seem to be no options / classes available to give feedback to the users / players in a chat kind of way... I know there is the option to put the output to the AI debug screen, but with a goal script you need to have a way to say for example what the current status of the goal is (for example: Your current company value is: 50000 euro, you only need "BLA" to reach your goal)

Offcourse it's obvious that's it's impossible to create a single player AI goal script if you can't send feedback directly to the player in some sort of chat message instead of going through the AI debug screen!

Any thoughts about this?

Thanks

Frank
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Terkhen »

This might be interesting for you: http://www.tt-forums.net/viewtopic.php?f=65&t=55400

The existence of AIs like TutorialAI make desirable IMO to have a better way to give feedback to the users, not only because of goal scripts but for the AIs themselves.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Alberth »

XfrankX wrote:Any thoughts about this?
Probably a 'goal' window is needed to communicate with the user. No idea what it should look like, but I am sure you have good ideas about that.

Note that 'chat' is again for multi-player only, and thus not useful.
User avatar
XfrankX
Engineer
Engineer
Posts: 19
Joined: 08 Aug 2011 09:56
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by XfrankX »

Hi,

Actually I do think that the chat option used in Multiplayer is a good way to communicate! But I guess since that's a multiplayer only option, there is no way to implement a one way (from AI to player) option for this!

Using signs like they do in TutorialAI is not a good way I think since you need to update the user on a lot of aspects, especially when you are going to create more advanced goals which include for example train cargo and Road Vehicle cargo goals...

I will photoshop a little on a few screenshots with possibilities which I think would be a nice way to communicate...

Is there by the way ABSOLUTELY NO WAY in Single Player mode to make one way chat messages available from AI to user, I saw for example the following Forum thread:

http://www.tt-forums.net/viewtopic.php?f=65&t=37970

I have no idea what it does exactly, but it seems the AI can update the client with status messages.

Anyway, I will just start on some concept screens and will let you know in this forum!

Thanks

Frank
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by FooBar »

I think you should forget trying to make a goals-AI and rather use the AI-technology (i.e. squirrel scripts) as the basis for a completely new Goal framework.

This clearly calls for a new to be created GUI where users can select, activate and configure a downloaded goal script. IMO, there should be a new menu option available from the scenario editor and the "new random game" window where one can select a goal script (or no goal at all) and if the goal script provides certain configuration options, these should be available from there as well. For the configuration bit, you could reuse the AI configuration window and related technology.
A running game needs a new option to view the active goal script, which possibly can also inform you how far you are from the goal and how far other players are. Furthermore you need to think about when the goal script needs to be called; obviously when viewing the progress. But other than that a goal script configured to reach a goal at a certain date needs only be called at that particular date. A goal script based on the amout of vehicles for instance probably needs to be called after each vehicle purchase, but it may be better to just limit those to calling once at the end of each month, for performance purposes (maybe right after autosave; if a goal script crashes for whatever reason, at least you still have the autosave of which you can disable the goal script and continue the game without goal).

Anyways, that's in short how I see this can be implemented in a proper and non-hackish way. E.g. TutorialAI is a fantastic effort as a proof-of-concept, but in my view will never make it to trunk in it's current form. It however could be the basis of a proper turorial framework, based on AI technology, that in the future allows users to create and submit tutorials on different subjects in different languages.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Project: Multiplayer Server Options, Commands & Goals

Post by planetmaker »

FooBar wrote:I think you should forget trying to make a goals-AI and rather use the AI-technology (i.e. squirrel scripts) as the basis for a completely new Goal framework.

This clearly calls for a new to be created GUI where users can select, activate and configure a downloaded goal script. IMO, there should be a new menu option available from the scenario editor and the "new random game" window where one can select a goal script (or no goal at all) and if the goal script provides certain configuration options, these should be available from there as well. For the configuration bit, you could reuse the AI configuration window and related technology.
A running game needs a new option to view the active goal script, which possibly can also inform you how far you are from the goal and how far other players are. Furthermore you need to think about when the goal script needs to be called; obviously when viewing the progress. But other than that a goal script configured to reach a goal at a certain date needs only be called at that particular date. A goal script based on the amout of vehicles for instance probably needs to be called after each vehicle purchase, but it may be better to just limit those to calling once at the end of each month, for performance purposes (maybe right after autosave; if a goal script crashes for whatever reason, at least you still have the autosave of which you can disable the goal script and continue the game without goal).
(...)
Well said.

Probably I'd try to integrate the goal script call into the daily loop.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Alberth »

XfrankX wrote:Actually I do think that the chat option used in Multiplayer is a good way to communicate! But I guess since that's a multiplayer only option, there is no way to implement a one way (from AI to player) option for this!
Why do you think a chat is a good way?
A pop-up window "player Foo has reached goal Bar" would be better imho.
XfrankX wrote:Using signs like they do in TutorialAI is not a good way I think since you need to update the user on a lot of aspects, especially when you are going to create more advanced goals which include for example train cargo and Road Vehicle cargo goals...
It is already not a good way for the TutorialAI.
However, it is currently the only way to interact with another player (you cannot chat with an AI) without doing an awful lot of work. In this way, it is relatively cheap to get an idea how feasible it is to build a tutor as squirrel script. With the concrete example AI, it was also found that other interactions with the player would be useful, such as moving the main view to the interesting area. Without TutorialAI, this may not have been found until much later.
I will photoshop a little on a few screenshots with possibilities which I think would be a nice way to communicate...
Seems like a good idea.
Is there by the way ABSOLUTELY NO WAY in Single Player mode to make one way chat messages available from AI to user, I saw for example the following Forum thread:

http://www.tt-forums.net/viewtopic.php?f=65&t=37970

I have no idea what it does exactly, but it seems the AI can update the client with status messages.
As that thread demonstrates, it is technically possible.
What that thread also says, it is conceptually wrong. An AI represents a company, not a 'is a goal reached' monitor. They are different concepts, and should not be merged. (If you allow company AIs to interact with the user or the general world, it means that a player gets control over the display of other users, or players can mess with eg industry generation of the world. I am quite sure you won't like that :p )

As Foobar said, the most flexible solution seems to be to make a new kind of squirrel script (a goal script), with different powers than the current NoAI scripts.
Such a goal script could have powers to broadcast news about reached goals for example.


Goals are a completely new concept in OpenTTD (they do not exist currently in the standard game).
Try to design goals managing as ideal as possible at first (that is, think what an ideal clean implementation would look like, ignoring limitations in todays implementation). Once that is somewhat clear, start worrying about what needs to be changed in the program.
If you design a goal manager based on what can be implemented today without much effort, you will end up with an ugly hack-ish solution, that will break very soon.
Eddi
Tycoon
Tycoon
Posts: 8279
Joined: 17 Jan 2007 00:14

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Eddi »

Alberth wrote:Goals are a completely new concept in OpenTTD (they do not exist currently in the standard game).
I was always of the opinion that "goals" should replace/improve the "subsidy" mechanism.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by FooBar »

That's something else than I had in mind, but might be interesting as well.

I was thinking one "big" goal for each game, which defines a game "won" once accomplished or "lost" when you didn't manage to accomplish the goal. Similar to what Rollercoaster Tycoon does.

Multiple smaller goals which renew during the course of a game are completely different and indeed much more similar to subsidies. It would even be possible to have both at the same time.

However, I do wonder what the reward of such smaller goal should be. For the big goal it's clear: you win the game or you don't. But what for the smaller goals? Obviously it can differ per goal defined in the script, but what other rewards than subsidies have you? Obviously you can also just win a pile of money. The current problem of the subsidies is that you don't really need the extra money you can gain with them. So there needs to be a different means to make such a small goal worth the effort. There might be very good ideas about this, but I can't think of anything other than money right now...
Eddi
Tycoon
Tycoon
Posts: 8279
Joined: 17 Jan 2007 00:14

Re: Project: Multiplayer Server Options, Commands & Goals

Post by Eddi »

which particular reward such a "short-term goal" gives is of course a matter of the goal-script that is loaded. a possibility would be "set up a local transport network within <A-Town> by <Date> and transport <X> Passengers until <Date>. Get exclusive transport rights if sucessful, pay <amount> if not".

the framework's job would to provide stubs that can display such a thing in a dialog box like the vehicle preview, asking the player whether to accept or reject the offer and that can manipulate the payment rates, station ratings, town options or whatever else one can think of.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Project: Multiplayer Server Options, Commands & Goals

Post by FooBar »

Like I said, there are good ideas about it. You've just proven that :D
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests