SimpleAI v14 - trying to remake the old AI

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

HGus
Engineer
Engineer
Posts: 95
Joined: 12 May 2013 22:28
Location: Argentina

Re: SimpleAI v13 - trying to remake the old AI

Post by HGus » 15 Jan 2019 05:54

It seems Brumi forgot to apply the fix sugested by krinn here

runningcost_limit still falls to zero when Banker.GetInflationRate() is over 6000

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: SimpleAI v13 - trying to remake the old AI

Post by Brumi » 15 Jan 2019 14:22

I wish I had been using some proper version control software, I had no idea how I missed that :) The thing is, I was aware of the inflation problem in v9, and actually did something about it in v10. But why I didn't include the fix that both krinn and SirkoZ were suggesting, I have no idea. My bad! And it's not just some integer/float conversion problem, the logic itself is bad...

So I will make a new release this week, including this fix (finally!). I still have to review SirkoZ's fix for the road deletion bug though.

I really appreciate you guys not only finding bugs in my AI, but even fixing them. Apologies for the bad code though, the bulk of SimpleAI was written before I started attending university...

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1506
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: SimpleAI v13 - trying to remake the old AI

Post by SirkoZ » 16 Jan 2019 17:07

No apologies are necessary as I see it, I'm just grateful for your wonderful effort of making this AI. We'll get it right. :mrgreen:

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: SimpleAI v14 - trying to remake the old AI

Post by Brumi » 20 Jan 2019 14:43

There is a new version out!

Two things were changed:
The inflation issue in the train engine valuator is now fixed. Thanks SirkoZ and krinn for the fix!
The AI sometimes did not remove the C-shaped road pieces when failing to build a road station. I implemented a fix for that, which should work in theory (if my assumption was correct about the root cause of the problem), but as I had no reliable reproduction of the case, I could only make a best-effort fix. (for those interested, the fix is in cBuilder::BuildRoadStation, removing the remainders when AIRoad.BuildRoadStation fails)

As usual, the AI can be downloaded from BaNaNaS or the first post.

burt
Engineer
Engineer
Posts: 2
Joined: 25 Apr 2019 10:58

Re: SimpleAI v14 - trying to remake the old AI

Post by burt » 25 Apr 2019 11:01

Hello !
Sorry I am new on open ttd, and I try to install AI but I have always this message.
Can you help me ?
Thanks !


Image

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: SimpleAI v14 - trying to remake the old AI

Post by Brumi » 26 Apr 2019 09:27

It seems that your [OpenTTD installation directory]/ai/compat_1.2.nut file is outdated for some reason.

What version of the game are you using? 1.9.1? JGRPP? How exactly did you install this version? Did you upgrade from an older version?

Anyway, compat_1.2.nut has to contain this piece of code at the end:

Code: Select all

/* 1.9 adds parent_group_id to CreateGroup function */
AIGroup._CreateGroup <- AIGroup.CreateGroup;
AIGroup.CreateGroup <- function(vehicle_type)
{
	return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
}
If it's not there, try to re-install your game, and make sure that the compatibility files are also updated.

burt
Engineer
Engineer
Posts: 2
Joined: 25 Apr 2019 10:58

Re: SimpleAI v14 - trying to remake the old AI

Post by burt » 26 Apr 2019 18:47

Very sorry, it was the switch version and everything work perfectly ! ^^
https://gbatemp.net/threads/openttd-tra ... 941/page-4
Thanks a lot for your work ! :)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests