[NoGo] CityDomination

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

lugo
Engineer
Engineer
Posts: 100
Joined: 12 Oct 2010 13:55

Re: [NoGo] CityDomination

Post by lugo »

A suggestion i think could be fun:
-Keep current goals as they are
-Add player must have x/50/75/100% of town owned land to win the game.
I do not know though if the number of map tiles which are owned by a town or all towns together is exposed to the GS framework.
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: [NoGo] CityDomination

Post by 11Runner »

lugo wrote:A suggestion i think could be fun:
-Keep current goals as they are
-Add player must have x/50/75/100% of town owned land to win the game.
I do not know though if the number of map tiles which are owned by a town or all towns together is exposed to the GS framework.
that is definitely something I could do over Christmas, this project could use an update :)
matsydoodles
Engineer
Engineer
Posts: 10
Joined: 22 Jun 2013 13:08

Re: [NoGo] CityDomination

Post by matsydoodles »

11Runner wrote:This gamescript does not end, it just declares a winner every year based on who "owns" the most towns.
Been playing this a lot with my house mate, would be cool if you could set a time limit for a maximum number of years, and then at the end of that period the person who has the most number of towns under their control wins.
NegatiboOPENTTD
Engineer
Engineer
Posts: 1
Joined: 26 Jan 2020 00:55

Re: [NoGo] CityDomination

Post by NegatiboOPENTTD »

Remi_Woler wrote: 04 Jan 2012 15:19 Actually, I'm not making an AI. It's an existing one. I just started it in the same map to see how the gamescript worked. It has absolutely no clue about the goals, but it will go for profit, so sooner or later it will start "dominating" a town (by accident).

I do realize that a new owner becomes pendingOwner first for 30 days (default), and only then takes over. However, that part of the code does have some issues. Right now, the AI company *is* able to take over "my" towns, however, I am not able to take over their towns. At best, I do become the pendingOwner, it gives me a pendingTime, but nothing happens after that. I could easily remain the owner for well over 30 days (seen 288 already with some extra logging), and still I don't become the new owner of the town. The following lines are shown, and when I add the score to the "Adding station" debug line, I see that I should have the town, or at least become the pendingOwner:

Adding Station Drohall Airport
Adding Station Tonborough Airport
Adding Station Tonborough
Old Owner: Remi
New Owner: NiceCAB - v2.1.3
Winning Company: Remi

Yet, I only very rarely become the pendingOwner, and I never become the real owner, even though it says I'm the winning company on every iteration of the GameLoop (I can wait years, and it still won't happen).

Also: if a company is merged, all towns get "no owner". Even if there is plenty of stations around it from the merge-into company. The town will stay with this "no owner" till a new AI starts (which has the same company name, but a different ID) and then the new AI gets *all* towns the old AI owned. This seems like a bug too.

I can't yet figure out why I am never considered for ownership. At first I thought maybe my companyid was 0 (0-based array is normal in programming) and maybe the const GSCompany.COMPANY_INVALID would have a value of 0 as well (so my company would always be considered as invalid), but I looked through the OpenTTD source and the const has a value of -1, so that isn't the issue either.

I am currently trying to refactor the script code to make it a lot more simple, which will hopefully either iron these bugs out, or at least tell what causes them. I'll post my version here when done. Edit: I started playing with cargodist/distpach, and don't need goals anymore to make the game enjoyable for more than an hour. Color me hooked :oops: Maybe I'll pick it up later, but don't count on it.
I have the same problem
thatonenoob
Engineer
Engineer
Posts: 1
Joined: 10 May 2022 20:07

Re: [NoGo] CityDomination

Post by thatonenoob »

Played this script last weekend in multiplayer but yes, am wondering how to use the admin socket and set either a year domination or a population goal.

By the way, that's providing that anyone survived covid, right? So let us know you're still around peeps!
fuijsa
Engineer
Engineer
Posts: 1
Joined: 14 May 2022 12:30

Re: [NoGo] CityDomination

Post by fuijsa »

Hey there!

I just tried out the script and I love the idea. I am wondering though that whenever an AI has taken over domination of one city it seems impossible to win it back?

Even when the AI has one measly truck station in town with two trucks and I have more and better rated stations I never can seem to win a town from an AI... Is that intended?
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests