Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Dec 12, 2018 1:24 pm

All times are UTC




Post new topic  Reply to topic  [ 103 posts ]  Go to page 1 2 3 4 5 6 Next
Author Message
 Post subject: [NoGo] CityDomination
PostPosted: Thu Dec 22, 2011 1:54 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
This is a game game script which deems people 'owner' of a town based on their station ratings. It is good for demonstrating:

1. SuperLib integration
2. Catching events
3. Placing Signs
4. Using Newsticker

Depends on:

SuperLib for NoGo(v19)

Please tell me if you have a suggestion.

Latest Download:

CityDomination v9

TIP: You can automatically get the latest version of CityDomination on the content download service

EDIT:
CityDomination no longer depends on Text, and added link to latest download


Attachments:
CityDomination-1.tar [40 KiB]
Downloaded 409 times

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Last edited by 11Runner on Tue Apr 15, 2014 2:55 am, edited 4 times in total.
Top
   
PostPosted: Thu Dec 22, 2011 9:04 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
11Runner wrote:
Known Bug:
Signs build over themselves when replaced

Use Helper.SetSign(tile, "message", true) in SuperLib. It will look for existing signs on a tile and replace them with the new message. For AIs the case was that it would only see signs owned by its own company. For GS I would guess that it only see the GS/None-owned signs.

11Runner wrote:
Text (v1)

I've marked this library obsolete on bananas as GSText now have the functionality that was provided by the library.

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


Top
   
PostPosted: Fri Dec 23, 2011 8:56 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
CityDomination v2

New Release Improvements:

1. Goals per company added

Zuu wrote:
11Runner wrote:
Known Bug:
Signs build over themselves when replaced

Use Helper.SetSign(tile, "message", true) in SuperLib. It will look for existing signs on a tile and replace them with the new message. For AIs the case was that it would only see signs owned by its own company. For GS I would guess that it only see the GS/None-owned signs.

11Runner wrote:
Text (v1)

I've marked this library obsolete on bananas as GSText now have the functionality that was provided by the library.

2. Did Zuu's Improvements
3. Faster station checking
4. HQ now displays dominated towns
5. Creates news on who is doing the best, etc.
6. Towns grow with competition

Planned improvements:

1. Must dominate town for at least a month before it can be counted as your dominated town (so that the town doesn't switch who dominates so fast)

Also, I have included my english.txt. If you choose to translate, I will be greatful :D

CityDomination should also be available on bananas :wink:


Attachments:
CityDomination-2.tar [40 KiB]
Downloaded 174 times
File comment: For translating
english.txt [664 Bytes]
Downloaded 170 times

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD
Top
   
PostPosted: Fri Dec 23, 2011 10:39 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
I fired up 2*CluelessPlus (in town-to-town only mode) and 2*Convoy to test this goal script. Here are some comments:
  • If an AI don't build a HQ (Convoy), you can't see how many towns it has dominated. I don't know if this is a problem or not, as I in general think that it is good that this script encourage you to build a HQ.
  • If you move the HQ, the old sign is not removed. If you take a look on my TransportGoals script (v2), you'll see that I actually use the API GSSign.BuildSign directly but store the sign id along with the other company specific data. This way I can remove the sign if the HQ has been moved without knowing the old location. (you could of course instead store the previous HQ location and just use Helper.SetSign(old_tile, "", true); to erase the old sign)
  • Your script crashes on load when I load a the game after having saved it. It looks like you are executing a DoCommand from inside your Load function. A solution is to just store the table with load data in your main class instance and then actually read and react on the data in the beginning of your Start() function. [you could again take a look on TransportGoals if you want inspiration]
  • I get a flood of news messages on a 256*512 game with four AIs.
  • The towns grow to large cities quite fast. In just 10 years I got about 20 towns with a size between 3000 and up to 9000 inhabitants. (no town house NewGRF) If this is good or bad is a question of what you want to do with your script. Perhaps there is some other ways to reward players that dominate a town than growing it? (as most towns will have a dominator/owner and thus grow)

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


Top
   
PostPosted: Sat Dec 24, 2011 4:21 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
CityDomination v3

Thank you Zuu for your suggestions :D . My thoughts about them:

Quote:
If an AI don't build a HQ (Convoy), you can't see how many towns it has dominated. I don't know if this is a problem or not, as I in general think that it is good that this script encourage you to build a HQ.


In some ways, I suppose it could be a problem. As of right now, there don't appear to be very many good ways to communicate with the user (I will be requesting such features later). Besides, if NoGo is intended for Multiplayer use, there will be less of a chance of having AI's with no ability to build an HQ.

Quote:
If you move the HQ, the old sign is not removed. If you take a look on my TransportGoals script (v2), you'll see that I actually use the API GSSign.BuildSign directly but store the sign id along with the other company specific data. This way I can remove the sign if the HQ has been moved without knowing the old location. (you could of course instead store the previous HQ location and just use Helper.SetSign(old_tile, "", true); to erase the old sign)


That was fixed, thank you :)

Quote:
Your script crashes on load when I load a the game after having saved it. It looks like you are executing a DoCommand from inside your Load function. A solution is to just store the table with load data in your main class instance and then actually read and react on the data in the beginning of your Start() function. [you could again take a look on TransportGoals if you want inspiration]


That was also fixed (And TransportGoals was my inspiration from the very start :D )

Quote:
I get a flood of news messages on a 256*512 game with four AIs.


I was getting similar floods of messages too, but I was not sure how the community would react. As of now, I have limited some of the news messages to certain companies, depending on their relevance.

Quote:
The towns grow to large cities quite fast. In just 10 years I got about 20 towns with a size between 3000 and up to 9000 inhabitants. (no town house NewGRF) If this is good or bad is a question of what you want to do with your script. Perhaps there is some other ways to reward players that dominate a town than growing it? (as most towns will have a dominator/owner and thus grow)


I am still considering such ideas. For right now, I have lowered the growth speed of towns.

An updated version of english.txt has been included if you would like to translate.


Attachments:
CityDomination-3.tar [40 KiB]
Downloaded 139 times
File comment: for translating
english.txt [726 Bytes]
Downloaded 131 times

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD
Top
   
PostPosted: Sat Dec 24, 2011 10:53 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Code:
         // Right now we have to find the sign manually...
         local signlist = GSSignList();
         signlist.Valuate(GSSign.GetLocation);
         signlist.KeepValue(company.hq);
         GSSign.RemoveSign(signlist.Begin());


can be changed to

Code:
Helper.SetSign(company.hq, "", true)


If you pass an empty string to SetSign, it will remove all signs from that tile.

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


Top
   
PostPosted: Sat Dec 24, 2011 12:50 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Fri Jan 19, 2007 7:26 pm
Posts: 326
11Runner wrote:
CityDomination v3

Quote:
The towns grow to large cities quite fast. In just 10 years I got about 20 towns with a size between 3000 and up to 9000 inhabitants. (no town house NewGRF) If this is good or bad is a question of what you want to do with your script. Perhaps there is some other ways to reward players that dominate a town than growing it? (as most towns will have a dominator/owner and thus grow)


I am still considering such ideas. For right now, I have lowered the growth speed of towns.



Maybe use some capture the flag system? As in, make a counter from x to 0 per company. If you dominate more cities than your opponent, your opponent loses points (depending on the number of towns). If someone reaches 0, he or she loses. Come to think of it, I think many game modes from other games now can directly be "copied" into OpenTTD :D


Top
   
PostPosted: Sat Dec 24, 2011 7:04 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
Quote:
Maybe use some capture the flag system? As in, make a counter from x to 0 per company. If you dominate more cities than your opponent, your opponent loses points (depending on the number of towns). If someone reaches 0, he or she loses. Come to think of it, I think many game modes from other games now can directly be "copied" into OpenTTD


Unfortunately as of now, I do not know if it is possible to deem a player as "looser" well enough for it to impact the game or make players really care, and I dont think it would be very fair either. Every player should get another try :D ! However, your idea does make me think it possible to judge a winner every year based on the number of new towns a company has taken over. Hmmm... :)

Then again, I may not be understanding your idea clearly enough.

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Top
   
PostPosted: Sat Dec 24, 2011 9:45 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Fri Jan 19, 2007 7:26 pm
Posts: 326
Can't you give a dialog with 'Player x has won. Do you want to quit or keep playing?'.

To explain the system, I've googled for the game which I had in mind, which is Battlefield Vietnam. Source: http://www.gamespot.com/features/battle ... 19/?page=2

Quote:
Each team starts out with a certain number of points (called 'tickets'). Whenever somebody on a team is killed, that team will lose one ticket. Whichever team runs out of tickets first loses the battle. Depending on which type of map you are playing on, having more control points in your team's possession will also cause the enemy's tickets to drain slowly away, even without them dying.


Remove the killing of course, and substitute control points with dominated cities.


Top
   
PostPosted: Sat Dec 24, 2011 9:59 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Dec 03, 2002 10:36 am
Posts: 13179
Location: The Netherlands
Just some thinking out loud: can this really neat looking script make building transport related objects more expensive for companies that aren't the dominating transport company? Or even cooler: force competing transport companies to buy transportation rights?

_________________
Image
Dutch Trainset for OpenTTD | Dutch Trainset Topic | Combined Roadset v0.10


Top
   
PostPosted: Mon Dec 26, 2011 2:54 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
Thanks for all of the suggestions!

Quote:
Can't you give a dialog with 'Player x has won. Do you want to quit or keep playing?'.


As far as I know, the best ways to communicate with the user is only news message or signs. There does not appear to be support (yet) for such a dialog, nor could I force a user out of buisness (you can double check the nogo docs: http://nogo.openttd.org/)

Quote:
Can't you give a dialog with 'Player x has won. Do you want to quit or keep playing?'.

To explain the system, I've googled for the game which I had in mind, which is Battlefield Vietnam. Source: http://www.gamespot.com/features/battle ... 19/?page=2

Quote:
Each team starts out with a certain number of points (called 'tickets'). Whenever somebody on a team is killed, that team will lose one ticket. Whichever team runs out of tickets first loses the battle. Depending on which type of map you are playing on, having more control points in your team's possession will also cause the enemy's tickets to drain slowly away, even without them dying.


Remove the killing of course, and substitute control points with dominated cities.


I think the idea in itself is very good! I might modify it a bit (for example, each user starts with a set of towns, and if you loose all of them, you go out of business or similar. I don't think that there is a way to make a company bankrupt in the current API...). I will proboably try to implement that (possibly as a GS Option) in the future :)

Quote:
Just some thinking out loud: can this really neat looking script make building transport related objects more expensive for companies that aren't the dominating transport company? Or even cooler: force competing transport companies to buy transportation rights?


I wish! I dont think NoGo supports that either... Forcing exclusive transport rights upon the company is possible, but it would make it much harder for competing companies to have better station ratings. I have been thinking of a way to make the dominator of a town have a greater (or lesser) advantage locally in the town.

I have been considering quoting comments like this and placing them on the NoGo thread as suggestions for new features! :wink:

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Top
   
PostPosted: Mon Dec 26, 2011 8:15 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Kogut contributed a function to SuperLib.Money that will use up all money of the current company. It's called succide or similar. If you use GSCompanyMode around the call to that function you can probably use it, with the assumption that using GSCompanyMode affects how CURRENT_COMPANY is resolved.

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


Top
   
PostPosted: Mon Dec 26, 2011 5:45 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
I am not sure but really large company may earn money faster than it is possible to spend.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
PostPosted: Tue Dec 27, 2011 1:11 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
CityDomination v4:

This is really more like a mini release!

Improvements:

* Fixed Crash on company out of buisness

* Added month delay to confirm "worthiness" for a town domination

english.txt is included for translating if you would like to do so :D


Attachments:
CityDomination-4.tar [40 KiB]
Downloaded 125 times
File comment: for translating
english.txt [726 Bytes]
Downloaded 116 times

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD
Top
   
PostPosted: Tue Dec 27, 2011 10:48 am 
Offline
Traffic Manager
Traffic Manager

Joined: Sat Jun 25, 2005 10:44 am
Posts: 169
Location: The Netherlands
Perhaps a possible goal could be trying to achieve a set (though adjustable beforehand obviously) amount of people that is calculated by adding the populations of towns a company dominates?

_________________
/r/OpenTTD
/r/tycoon


Top
   
PostPosted: Tue Dec 27, 2011 7:50 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
LSky wrote:
Perhaps a possible goal could be trying to achieve a set (though adjustable beforehand obviously) amount of people that is calculated by adding the populations of towns a company dominates?


That sounds like a feasable (and cool) idea. The program might even be able to determine the yearly winner based on that factor rather than number of towns dominated :) I will look into putting this into our next release :D

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Top
   
PostPosted: Thu Dec 29, 2011 7:36 pm 
Offline
Engineer
Engineer

Joined: Tue Nov 30, 2010 8:48 pm
Posts: 5
How can I add this script to dedicated server? I've tried to add this script to cfg:
Code:
[game_scripts]
CityDomination =


Next i've copyied .tar file to ~/openttd/content_download/game/ and it's doesn't work. On singleplayer game everything is fine.


Top
   
PostPosted: Thu Dec 29, 2011 10:30 pm 
Offline
Tycoon
Tycoon

Joined: Thu Dec 20, 2007 12:49 pm
Posts: 3653
mousepl wrote:
How can I add this script to dedicated server? I've tried to add this script to cfg:
Code:
[game_scripts]
CityDomination =


Next i've copyied .tar file to ~/openttd/content_download/game/ and it's doesn't work. On singleplayer game everything is fine.

Did you also copy the SuperLib and Text libraries to the proper directories? If you manually install it, you should copy it to ~/.openttd/game/ (and ~/.openttd/game/library/ respectively).


Top
   
PostPosted: Thu Dec 29, 2011 10:38 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
Yexo wrote:
mousepl wrote:
How can I add this script to dedicated server? I've tried to add this script to cfg:
Code:
[game_scripts]
CityDomination =


Next i've copyied .tar file to ~/openttd/content_download/game/ and it's doesn't work. On singleplayer game everything is fine.

Did you also copy the SuperLib and Text libraries to the proper directories? If you manually install it, you should copy it to ~/.openttd/game/ (and ~/.openttd/game/library/ respectively).
Yexo is right, but the Text library is no longer needed (it is now depracated)

My thoughts if that is not the problem (some of this may be a bit obvious and simple, but it could be the problem):

* Ensure your server is running the OpenTTD trunk or test release of 1.2

* Ensure you are running CityDomination v4 (older versions used a different name which may confuse the configuration)

Otherwise you may want to give me your openttd.cfg

Finally, this is not likely to be an issue, but scripts downloaded or placed manually should be placed in $OPENTTD_ROOT/game, not $OPENTTD_ROOT/content_download/game. You may have to create the directory manually.

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Top
   
PostPosted: Fri Dec 30, 2011 1:54 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
CityDomination v5 (also available on bananas)

New Improvements:

* Population related goals, measurments, and winners (thank you LSky)

* Brief bugfixes

Attached is english.txt if you would like to translate

EDIT:

The population goals and measurments are a settable option in the gamescript settings dialog. You must edit the setting before starting the game. It is turned on by default


Attachments:
CityDomination-5.tar [50 KiB]
Downloaded 181 times
File comment: for translating
english.txt [1.13 KiB]
Downloaded 177 times

_________________
Image

SynTrans - A Synaptic Networking AI for OpenTTD


Last edited by 11Runner on Fri Dec 30, 2011 6:42 am, edited 1 time in total.
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 103 posts ]  Go to page 1 2 3 4 5 6 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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.