NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.1.3

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

bokkie
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 19 Jan 2007 19:26

Re: NoCab - Trucks, Busses, Airplanes and Ships! [Revision 205]

Post by bokkie »

Tried r205 for a few minutes on fast-forward, still doing nicely! Some things stood out

1 - Natorade Vallei is too far from the steel mill (GRF: Pikka's Basic Industries 1.5) for it to accept coal, now it only accepts iron. (Also, there are two airports in Natorade. Not necessarily bad but when cargodest hits trunk a bus to transfer passengers to it would be aesthetically more pleasing but that's something for v5)
Geen naam, 5 Jan 1946.png
(170.29 KiB) Downloaded 165 times
2 - Even after 50 years, no ships were built by one of the 2 NoCab's playing. I guess it doesn't use transfer orders yet to transport the oil to a refinery on land?
Geen naam, 8 Mei 1994.png
(97.61 KiB) Downloaded 133 times
3 - Coal mine closed but after years there are still many trucks waiting at the stations (probably for v2)
Geen naam, 30 Mrt 1994.png
(146.25 KiB) Downloaded 148 times
Good luck with NoCab! Will try it sometimes to be able to give some feedback but development is probably more dependent on your time than my feedback ;).

bokkie
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 19 Jan 2007 19:26

Re: NoCab - Trucks, Busses, Airplanes and Ships! [Revision 205]

Post by bokkie »

Sorry for double post but attachment limit reached ;).

NoCab seems to be able to hamper performance. In the attached savegame, fast-forward to around March 24th and then OpenTTD begins to stutter for a few days (also happens other times). Convoy is also included in the savegame but the stuttering is only prevented by removing NoCab from the game and not by removing Convoy. Since I've got a Core2Duo processor there's something pretty wrong when OpenTTD stutters :D
Attachments
Murphy & Co., 3 Mrt 1958.sav
(314.1 KiB) Downloaded 92 times

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! [Revision 205]

Post by Morloth »

athanasios wrote:I hope you can find a solution, because it looks very ugly. There is open sea there without obstacles (no land in the middle), but the ship prefers to zig zag. Good luck.
I'm a little bit fuzzy what you mean here. Because the actual pathfinding is handled by the game and that's something I cannot change in the AI. The only thing I can do is place buoys to guide the ship towards its goal. The buoy problem is now solved, so it won't lead ships astray anymore. :)
bokkie wrote:Tried r205 for a few minutes on fast-forward, still doing nicely! Some things stood out

1 - Natorade Vallei is too far from the steel mill (GRF: Pikka's Basic Industries 1.5) for it to accept coal, now it only accepts iron. (Also, there are two airports in Natorade. Not necessarily bad but when cargodest hits trunk a bus to transfer passengers to it would be aesthetically more pleasing but that's something for v5)
Geen naam, 5 Jan 1946.png
I think your latter point is something for v5, at the moment NoCAB only cares about profit ;). But the NewGRF stuff as Yexo already mentioned is quite hard to handle as it's impossible to derive that information from the API. We can only guess, but it's something I want to work on but it won't be a milestone.
bokkie wrote: 2 - Even after 50 years, no ships were built by one of the 2 NoCab's playing. I guess it doesn't use transfer orders yet to transport the oil to a refinery on land?
Geen naam, 8 Mei 1994.png
If a ship has to travel to far we won't consider it until later in the game (or not at all if it has to travel way to long!). But the transfer order gave me some good ideas, thanks! :D
bokkie wrote: 3 - Coal mine closed but after years there are still many trucks waiting at the stations (probably for v2)
Geen naam, 30 Mrt 1994.png
Yeah.... industry closure isn't handled yet at the moment. We detect it, but don't react on it ;). I will try to fix this for the release of v1.
bokkie wrote: Good luck with NoCab! Will try it sometimes to be able to give some feedback but development is probably more dependent on your time than my feedback ;).
Thx, looking forward hearing more :D.
bokkie wrote: NoCab seems to be able to hamper performance. In the attached savegame, fast-forward to around March 24th and then OpenTTD begins to stutter for a few days (also happens other times). Convoy is also included in the savegame but the stuttering is only prevented by removing NoCab from the game and not by removing Convoy. Since I've got a Core2Duo processor there's something pretty wrong when OpenTTD stutters :D
There will be some moments yeah. I try to squise out as much from Squirrel as possible in the least amount of opcodes. I'll look at your safegame and see if something needs to be done. Will get back to this!

Once again for all the feedback and expect a release in about 1~2 weeks! Oh, the recent version in SVN is bloody fast! Revamped the advisors and it's faster then ever! :mrgreen:

- Bram

User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: NoCab - Trucks, Busses, Airplanes and Ships! [Revision 205]

Post by athanasios »

Morloth wrote:... the actual pathfinding is handled by the game and that's something I cannot change in the AI.
I thought you could do something. Seems we have to be patient for yet yet ... another pathfinder.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! 1.0RC2 (r213)

Post by Morloth »

Ok, release candidate 2 is out!

Some issues have been solved, most notably:
* There were some issues in the pathfinder for road vehicles where it would produce wrong results on hilly maps (to do with the fact that building a tunnel can cause terraforming at the other end.
* Paths for ships are now calculated optimally and we also guide the ships back from the the delivery point.
* Sometimes a depot was placed between a landmass which prevented ships from reaching the pick-up dock.
* Advisers have gained a huge performance boost, this is mainly to do with the fact that we only update the world state when needed.
* Some code cleaning and other small bug fixes.

Some known issues:
* When an industry closes the AI doesn't act upon it. This will be fixed in v2.
* I think I fixed the hampering problem, but I'm not really sure. With my iBook G4 OpenTTD hampers all the time so I can't really tell ;).

When no other bugs are found I'll post the final version of NoCAB. This will be the same as this one, but cleaner code + more documentation. After this I'll focus in v2 which will include:

* Route update adviser, this adviser will look at existing routes and look for possible upgrades. Either by making the route longer, replacing vehicles with newer versions, or build bigger stations / ports / docks / etc.
* The removing of industries will be properly handled.
* Make the AI aware of subsidies.
* Introduce terraforming.

I hope you have fun playing around with this AI and as always, any feedback is welcome!
- Bram

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by Morloth »

Final version is out! Develop speed will from now on be less intensive than the last couple of weeks due to other obligations. This final version is almost similar to the RC2, but some bugs are fixed, most notably in the pathfinder and the construction of sea routes.

I hope everyone will enjoy it and watch this topic for information about the progression of version 2 (and perhaps some bug fix releases for version 1).

Cheers,
Bram

xyz
Engineer
Engineer
Posts: 46
Joined: 19 Feb 2005 07:37

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by xyz »

Grate job. Needs some tweeking thow :wink: look at the screenshot
Attachments
Unnamed, 30th Jun 1951.png
(100.4 KiB) Downloaded 255 times
Interesting Projects:
Celestia an open source space simulator.
EventGhost an open source PC remote control.
TA Spring
OpenTTD

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

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by SirkoZ »

I have tested the v1.0 FINAL (hopefully not :) ) and have one suggestion - the poor AI builds truck routes competing with my train routes (with or without town statues) - such routes are mostly in red so I think it should check e.g. if % transported is under 60% for an already connected industry (like the good old TTO/TTD AI does).

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by Morloth »

xyz wrote:Grate job. Needs some tweeking thow :wink: look at the screenshot
Ai... I was afraid something like that might happen. Will fix it in the next version!
SirkoZ wrote:I have tested the v1.0 FINAL (hopefully not :) ) and have one suggestion - the poor AI builds truck routes competing with my train routes (with or without town statues) - such routes are mostly in red so I think it should check e.g. if % transported is under 60% for an already connected industry (like the good old TTO/TTD AI does).
Do you have a save game by any chance? Would be interesting to see what happens. Because if there are to many vehicles waiting NoCAB should sell some of them, it should never happen that a line becomes non profitable. I do agree that I should check the current percentage which is transported, will fix that in the new version as well!

At the moment I'm bounded by multiple deadlines so development on Version 2 (I will dub it... erm... ... Eco blaster! :)) will start in full swing no earlier then next year. In the meantime I'm curious to hear your feedback and if more bugs pop up, I'll be delighted to hear about them!

Cheers,
Bram

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

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by SirkoZ »

That's nice.
Well - I don't really have a save game with those AI vehicles because I have exploded them and removed their stations because they were redundant, i.e. only lowering % transported - and I don't like that... ... very much. :-)

Of course if I observe any other eye-sore, I'll notify. :-)

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by Yexo »

I was doing some testing with NoCab, and it crashed. See screenshot for debug log. (Using 1.0 final from first post btw).
Attachments
Unnamed, 1958-08-17.png
(58.35 KiB) Downloaded 124 times

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by Morloth »

At...last!

NoCAB is revamped to work with the latest changes made to the NoAI framework. From now on I'll work again on and off on this AI so expect more updates the coming weeks.

Congratulations to all NoAI developers to have made ik to the trunk! :D
- Bram

TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1312
Joined: 31 May 2004 09:21

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.0 FINAL

Post by TrueBrain »

Morloth wrote:At...last!

NoCAB is revamped to work with the latest changes made to the NoAI framework. From now on I'll work again on and off on this AI so expect more updates the coming weeks.

Congratulations to all NoAI developers to have made ik to the trunk! :D
- Bram
Whiiieee! An update :)

For you too, please use numeric version values, also in BaNaNaS. This makes a lot of things a lot easier :) Using your SVN version for example is very fine.

PS: you too concratz on all the work you did on NoAI ;)
The only thing necessary for the triumph of evil is for good men to do nothing.

lovelypl
Engineer
Engineer
Posts: 9
Joined: 10 Jul 2008 08:03

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by lovelypl »

Why NoCAB cannot deploy any vehicle?
Here is screenshot with errors about depot.
Attachments
Drudingworth Transport, 19ty Lis 1982.png
AI debug log
(34.09 KiB) Downloaded 78 times
Image

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Morloth »

lovelypl wrote:Why NoCAB cannot deploy any vehicle?
Here is screenshot with errors about depot.
Hey lovelypl,

Thanks for your reply, this behaviour is very weird indeed. What NewGRFs are you using when you were testing my AI? I only test my AI without any NewGRFs enabled so the culprit may be in some of these packages. But if you provide me with a list I'll try to fix this problem.

Thanks!
- Bram

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Yexo »

Morloth: That error is shown why you try to build trams in a normal depot, or normal road vehicles in a tram depot. Could it be NoCab tries to build trams in a normal depot?

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Morloth »

Yexo wrote:Morloth: That error is shown why you try to build trams in a normal depot, or normal road vehicles in a tram depot. Could it be NoCab tries to build trams in a normal depot?
That'd seem impossible since I only use road vehicles at the moment. So after the AI is instantiated I set the road type to road vehicles and never touch it again during execution.

lovelypl, could you otherwise provide us with a screenshot of one of the depots so we can verify this?
Thanks!
- Bram

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Yexo »

Setting CurrentRoadType to normal road isn't enough. You also need to filter out trams from the vehicle list.

Code: Select all

		local engineList = AIEngineList(AIVehicle.VT_ROAD);
		engineList.AddList(AIEngineList(AIVehicle.VT_AIR));
		engineList.AddList(AIEngineList(AIVehicle.VT_WATER));
		foreach (engine, value in engineList) {
			local vehicleType = AIEngine.GetVehicleType(engine);
			if ((AIEngine.GetCargoType(engine) == cargo || AIEngine.CanRefitCargo(engine, cargo)) && 
				AIEngine.GetMaxSpeed(cargoTransportEngineIds[vehicleType][cargo]) * AIEngine.GetCapacity(cargoTransportEngineIds[vehicleType][cargo]) < AIEngine.GetMaxSpeed(engine) * AIEngine.GetCapacity(engine)) {
				cargoTransportEngineIds[vehicleType][cargo] = engine;
			}
		}
This doens't seem to do it. Easiest way is to add this code just after the first line posted above.

Code: Select all

enginelist.Valuate(AIEngine.GetRoadType);
enginelist.KeepValue(AIRoad.ROADTYPE_NORMAL);

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Morloth »

Ah, yes. That makes sence. Thanks for the fix Yexo! :)

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

Re: NoCab - Trucks, Busses, Airplanes and Ships! v1.2

Post by Zuu »

Hmm, If I remember correctly my AI(s) has the same issue with not filtering away tram engines. Thanks for bringing that up. :)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest