AIRail::BuildNewGRFRailStation
Moderator: OpenTTD Developers
Re: How to pause ai?
That's something I would like to have as well but at the moment there is no support for that. To do i it nice, there would need to be a new state variable for AIs that is checked before starting the AI execution at each tick.
The break on string works such that it uses up all op codes when there is a match and then the game is paused at the end of the current tick. The break on string feature needs a bit cleaning up in the code. See Therken/Alberths comment in my thread about that feature.
The break on string works such that it uses up all op codes when there is a match and then the game is paused at the end of the current tick. The break on string feature needs a bit cleaning up in the code. See Therken/Alberths comment in my thread about that feature.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Why squirell is ******* [solved]
There are more differences to find out. Some rather nasty ones. :-p Like that you can't use enum over several files or the problem that occurs if you do not clear all member variables in the constructor.Kogut wrote:I wasted 3 hours on detecting that (first for me) difference between squirrel and C++.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: AIVehicle::GetLength ( VehicleID vehicle_id )
AIVehicle::GetLength ( VehicleID vehicle_id ) - why it is impossible to perform it on AIEngine?
Some of newgrf rail vehicles are very long, and I prefer to know about it BEFORE vehicle construction.
Some of newgrf rail vehicles are very long, and I prefer to know about it BEFORE vehicle construction.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIVehicle::GetLength ( VehicleID vehicle_id )
Because OpenTTD cannot tell the length before construction.
Vehicle length hat quite often dependencies which cannot be resolved before construction. Trainwagons may change length when being attached to different engines. Very often the length also changes on refitting (i.e. even after the vehicle has been constructed). Take a look at HEQS for a extreme case: You may refit cargo trams from a length of about 3 tiles up to about 9 tiles.
Vehicle length hat quite often dependencies which cannot be resolved before construction. Trainwagons may change length when being attached to different engines. Very often the length also changes on refitting (i.e. even after the vehicle has been constructed). Take a look at HEQS for a extreme case: You may refit cargo trams from a length of about 3 tiles up to about 9 tiles.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: AIVehicle::GetLength ( VehicleID vehicle_id )
But it may be information like http://noai.openttd.org/api/1.0.0/class ... 7405eb0f14 Only general hint.
This function is not exhaustive; a true here does not mean that the vehicle can pull the wagons, a false does mean it can't.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIVehicle::GetLength ( VehicleID vehicle_id )
I tried to use AIRail::BuildNewGRFRailStation ( http://noai.openttd.org/api/0.7.3/class ... 2262c8b42f ).
But I see:
IndustryType source_industry,
IndustryType goal_industry
What with industry to town / town to town routes?
But I see:
IndustryType source_industry,
IndustryType goal_industry
What with industry to town / town to town routes?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIRail::BuildNewGRFRailStation
Towns are 0xFF.
Seems like there is no enumeration for that
Seems like there is no enumeration for that

⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: AIRail::BuildNewGRFRailStation
I tried to solve this (I figured that max weight should be about 3*Te), but:Michiel wrote:But yeah, I think I see where some of the difficulty comes from. It's very crowded, and the trains are severely underpowered, crawling uphill at 9 km/h, which means they make little profit.
There are functions AIEngine::GetWeight, AIEngine::GetMaxTractiveEffort, I can get freight_trains setting. Unfortunatelly I am unable to find function for weight of fully loaded wagon (I can get capacity but it is rather useless).
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: crawling uphill at 9 km/h
I prepared working function based on assumption that GetCapacity == GetWeightOfCargo for freight or CargoWeight = 0 otherwise.
function RAIL::WeightOfEngine(engine, cargo)
{
local weight = AIEngine.GetWeight(engine);
local capacity = max(AIEngine.GetCapacity(engine), 0);
if(AICargo.IsFreight(cargo)) weight += capacity * AIGameSettings.GetValue("vehicle.freight_trains");
return weight;
}
Unfortunatelly trains with ability to climb on everything are waaaay too small.
But in default trainset everything is OK.
function RAIL::WeightOfEngine(engine, cargo)
{
local weight = AIEngine.GetWeight(engine);
local capacity = max(AIEngine.GetCapacity(engine), 0);
if(AICargo.IsFreight(cargo)) weight += capacity * AIGameSettings.GetValue("vehicle.freight_trains");
return weight;
}
Unfortunatelly trains with ability to climb on everything are waaaay too small.
But in default trainset everything is OK.
- Attachments
-
- Przechwytywanie.PNG (8.22 KiB) Viewed 1674 times
-
- Przechwytywanie.PNG (16.3 KiB) Viewed 1673 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: crawling uphill at 9 km/h
For such a long train (=more than 8 wagons), use 2 locos (or for every 8 wagons - 1 locomotive).
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: crawling uphill at 9 km/h
For default vehicles even very long trains are OK (like that desert mountain), but newgrf trainsets have way lower tractive effort what causes problems: risk of train stuck at moutain slope or short trains.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: crawling uphill at 9 km/h
As I said - multiple locomotives.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Who is online
Users browsing this forum: No registered users and 6 guests