CityBuilder Release Topic
Moderator: OpenTTD Developers
Re: CityBuilder Release Topic
Probably the newgrf is causing. have to test it whithout newgrf and try to set prospecting settings also.
Re: CityBuilder Release Topic
Loading function dosent work when game has been played almost 12H.
and all NewGRFs where disabled so its a bug in normal version.
and all NewGRFs where disabled so its a bug in normal version.
- Attachments
-
- Untitled4.jpg (64.43 KiB) Viewed 4949 times
Re: CityBuilder Release Topic
Thanks for the report. An array out of bounds could occur if there were more than 2 companies in the game. This new version should fix it.
It's also still compatible with v64, hopefully.
It's also still compatible with v64, hopefully.
Re: CityBuilder Release Topic
Works now like a charm.
next bug is the ECS compability, that it does show up the resources in goal system, but city dosent count them delivered. So when city req these newgrf resources it dosent count them even it needs them :/
next bug is the ECS compability, that it does show up the resources in goal system, but city dosent count them delivered. So when city req these newgrf resources it dosent count them even it needs them :/
Re: CityBuilder Release Topic
By 'City' do you perhaps mean a town with the ..::CITY::.. tag, that shows (city) in it's town window?
Those may have different behaviour. Off the top of my head the default setting for them is to grow 'normally', e.g. just as they would have in default OpenTTD. They also are not claimable, and merely exist as a source of passengers.
If you do mean a regular town, there can be multiple causes to a resource not being counted, can you please provide a screenshot of the local area with an included info window, or perhaps a save-game?
The most common thing is that the station's sign needs to be closest to the town you intend to deliver to. If it is not you may be delivering to another town.
Those may have different behaviour. Off the top of my head the default setting for them is to grow 'normally', e.g. just as they would have in default OpenTTD. They also are not claimable, and merely exist as a source of passengers.
If you do mean a regular town, there can be multiple causes to a resource not being counted, can you please provide a screenshot of the local area with an included info window, or perhaps a save-game?
The most common thing is that the station's sign needs to be closest to the town you intend to deliver to. If it is not you may be delivering to another town.
Re: CityBuilder Release Topic
sry i meant WITH!!!!! city part the town and i need to do some more tests with v66 if it works later on. in earlier versions it didnt work evevn if i had the factory and stasion build under the town name. But the normal resources works normally which OpenTTD has.
Re: CityBuilder Release Topic
Just start a game, claim a town, do nothing and a month later, there is a crash...
Re: CityBuilder Release Topic
Thanks for the report, this should now be fixed.
It was an issue relating to a particular combination of settings.
Also, the new version will now by default define any passenger-producing industry type as a 'town industry type' as well, in order to properly support building FIRS hotels in every town at the start of the game. This can be turned off in the settings.
And there are now 'Introduction dates' between 1700 and 3000 for each cargotype to extend further support to ECS and FIRS. You can now set an 'introduction date' for each type of cargo. Towns will not demand the cargo until the date reaches the introduction date. For example, if you set the date for 'petrol' to 1920, then in 1910 no town will require petrol to grow. By default all dates are 1700.
It was an issue relating to a particular combination of settings.
Also, the new version will now by default define any passenger-producing industry type as a 'town industry type' as well, in order to properly support building FIRS hotels in every town at the start of the game. This can be turned off in the settings.
And there are now 'Introduction dates' between 1700 and 3000 for each cargotype to extend further support to ECS and FIRS. You can now set an 'introduction date' for each type of cargo. Towns will not demand the cargo until the date reaches the introduction date. For example, if you set the date for 'petrol' to 1920, then in 1910 no town will require petrol to grow. By default all dates are 1700.
Re: CityBuilder Release Topic
Tnx! It is indeed fixed!
Other issue: I was just looking how everything works, not really play the game serieusly. Just claim a town and see what happens. Some busses to let the city grow. But now the population is above the 400 and I need some Steel (15 stocks or something like that) and 1 stock of NOTHING?!
Next month, i need to deliver 2 stocks of nothing... A bit strange to deliver some stocks of nothing...
Other issue: I was just looking how everything works, not really play the game serieusly. Just claim a town and see what happens. Some busses to let the city grow. But now the population is above the 400 and I need some Steel (15 stocks or something like that) and 1 stock of NOTHING?!
Next month, i need to deliver 2 stocks of nothing... A bit strange to deliver some stocks of nothing...
- Attachments
-
- nothing.png (32.94 KiB) Viewed 4649 times
Re: CityBuilder Release Topic
Is this the reason why i can't reload a save game without a error? No information about the crash in the log. This the message that is crashes, and that's all.Current bug status is <One game-breaking bug remains>
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: CityBuilder Release Topic
Probably you could iterate over the list of industries on the map and check their cargo acceptance and cargo production via GSIndustryList_CargoAccepting and GSIndustryList_CargoProducingAphid wrote: And there are now 'Introduction dates' between 1700 and 3000 for each cargotype to extend further support to ECS and FIRS. You can now set an 'introduction date' for each type of cargo. Towns will not demand the cargo until the date reaches the introduction date. For example, if you set the date for 'petrol' to 1920, then in 1910 no town will require petrol to grow. By default all dates are 1700.
http://nogo.openttd.org/api/1.3.0-beta1/index.html
But I understand that this takes both, much more of your programming time and possibly also of the possibly precious time at initialization of the game script.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: CityBuilder Release Topic
Actually that doesn't sound too expensive if cleverly done.
E.g. to keep a global variable IsCargoProduced[32]
And only require a cargo if it is in there. The yearly check would take up to 64 (max industry types) * 2 = 128 calls to GSIndustryList_CargoProducing.
That is .01 of a tick of lag in the script. Plus it will eliminate some of the options that not many people will use. I will probably want to lag the introduction by [X] years to allow people to respond to the new cargo being introduced.
The only other lag is from accessing this variable in the Town() objects, which amounts to one operation per town per month. Clever
As a sidenote, version 72 will no longer require you to do this, as it will autodetect the cargoes as non-introduced yet and not give you the reqs.
Edit:
The real problem is not verifying this for the industries, but for the towns.
There is no method to call to verify which cargoes towns can produces themselves. For example in the default game buildings produce mail and passengers. Of course, NewGRF townsets may allow a town to produce *ANY* cargo, so it is no use making assumptions. There is currently no easy callback for me to call to know which cargoes -towns- can produce. What is a good way of doing this?
I'm trying code like this:
But this is obviously horribly expensive. 32 * 5000 = 160,000 loops at most. There are only 32 passes possible through the inner condition so this amounts to at most 160,064 if() operations. and 160,064 array lookups.
I'm trying to keep the per-town per-cargo code at a bare minimum, only storing the amounts delivered and checking them against precomputed goal values. Is there an easier way of doing this?
There is a function
But does a false return result guarantee that no town building can produce this cargo, ever?
E.g. to keep a global variable IsCargoProduced[32]
And only require a cargo if it is in there. The yearly check would take up to 64 (max industry types) * 2 = 128 calls to GSIndustryList_CargoProducing.
That is .01 of a tick of lag in the script. Plus it will eliminate some of the options that not many people will use. I will probably want to lag the introduction by [X] years to allow people to respond to the new cargo being introduced.
The only other lag is from accessing this variable in the Town() objects, which amounts to one operation per town per month. Clever
This is entirely normal. That is because the default settings have requirements for cargo for all climate(s). The Readme.txt has instructions for you on how to properly set it up for your climate or Industry Set. Basically, there's Food, Water, Goods, Passengers, Mail, Coal, Valuables, Diamonds and Gold in the default game. If you are playing temperate, you have to turn off the requirements for Food, Water, Diamonds, and Gold in the script's options. You can check whether you have done so by viewing the debug log at the start of the game. It will give you a warning if it detects incompatible cargoes.
Other issue: I was just looking how everything works, not really play the game serieusly. Just claim a town and see what happens. Some busses to let the city grow. But now the population is above the 400 and I need some Steel (15 stocks or something like that) and 1 stock of NOTHING?!
Next month, i need to deliver 2 stocks of nothing... A bit strange to deliver some stocks of nothing...
As a sidenote, version 72 will no longer require you to do this, as it will autodetect the cargoes as non-introduced yet and not give you the reqs.
Edit:
The real problem is not verifying this for the industries, but for the towns.
There is no method to call to verify which cargoes towns can produces themselves. For example in the default game buildings produce mail and passengers. Of course, NewGRF townsets may allow a town to produce *ANY* cargo, so it is no use making assumptions. There is currently no easy callback for me to call to know which cargoes -towns- can produce. What is a good way of doing this?
I'm trying code like this:
Code: Select all
local Townlist = GSTownList();
foreach (town, _ in Townlist)
{
for(local id = 0; id < 32; ++id)
{
if(Havenot[id]) // Havenot is an array of 32 fields.
{
if(GSTown.GetLastMonthProduction(town, id) > 0)
Havenot[id] = false;
}
}
}
I'm trying to keep the per-town per-cargo code at a bare minimum, only storing the amounts delivered and checking them against precomputed goal values. Is there an easier way of doing this?
There is a function
Code: Select all
GSCargo::IsFreight (CargoID cargo_type)
Re: CityBuilder Release Topic
Having done all that, the actual performance is not -that- bad but it could be better.
Anyway, using GSIndustryTypeList will still not work correctly for FIRS introduction dates, because the GSIndustryTypeList will simply list industries that are not yet introduced as available. Neither CanBuildIndustry() nor CanProspectIndustry() will work 100% of the time to correctly identify whether the industry has been introduced, because it is possible to turn either or both building and prospecting off.
Using IndustryList will work. That is so much more expensive though.
Exactly where do I lookup the introduction dates, that is the big question
Anyway, using GSIndustryTypeList will still not work correctly for FIRS introduction dates, because the GSIndustryTypeList will simply list industries that are not yet introduced as available. Neither CanBuildIndustry() nor CanProspectIndustry() will work 100% of the time to correctly identify whether the industry has been introduced, because it is possible to turn either or both building and prospecting off.
Using IndustryList will work. That is so much more expensive though.
Exactly where do I lookup the introduction dates, that is the big question
Re: CityBuilder Release Topic
Version 72 is up with automatic introduction dates, saving should work. This version should also be more newbie-friendly in that it should not require changing the settings to have a playable game, you can now in theory download and play immediately. Some tinkering with the default settings could further improve friendliness; please do voice your opinions.
Re: CityBuilder Release Topic
Outstanding script! Keep up the work please, make it 100% complete!
Am currently trying to configure it for my server to chillax with friends, will let you know if anything found.
But for now I got a tiny (documentary) suggestion as I am a huge newb in the servering, and with OTTD 1.3 there is no longer game difficulty button.
In Readme it tells:
Am currently trying to configure it for my server to chillax with friends, will let you know if anything found.
But for now I got a tiny (documentary) suggestion as I am a huge newb in the servering, and with OTTD 1.3 there is no longer game difficulty button.
In Readme it tells:
My question - do I still need to do those steps, and if so - where..- Set your game difficulty to 'custom'.
- Set the script settings to default.
Re: CityBuilder Release Topic
There has been been a suggestion over IRC that going away from cargo ID's to labels is easier for administrator and will work in later versions, as OpenTTD is moving to dynamic cargos (without fixed ID's).
Here is a log of a chat:
Here is a log of a chat:
11:13 < frosch123> anyway, tell the author to use cargo labels to identify cargos
11:15 < alandarev> frosch123: I think that is made for compatibility with custom industry sets. so I
can set "Town should require cargo ID 26 100 per 1000 pop" where 26 will bei
mplemented by custom industry vector
11:15 < alandarev> frosch123: that is great, and he gave a warning in readme that configuration is
complex
11:16 < frosch123> well, once we implement dynamic cargos, it will break
11:16 < alandarev> dynamic cargos? sounds interesting but no idea what stands behind it
11:18 < frosch123> currently you can only use a single industry set
11:18 < frosch123> multiple sets will conflict because they use the same fixed cargo ids
11:18 < alandarev> ah I see
11:18 < frosch123> to make multiple industry sets work, you have to remove the "fixedness"
11:19 < alandarev> sounds like a right direction But indeed will make a life for the script owner
harder...
11:19 < alandarev> I'll copy last 6 messages to the script topic, ok?
11:19 <@Alberth> no, it's easier, you get nice labels to identify a cargo instead of a magic number
11:20 <@Alberth> alandarev: alternatively link to a log
Re: CityBuilder Release Topic
Is it a bug or I am misunderstanding something?
P.S. What confuses me, is why town grows with no resource requirements met?
P.S. What confuses me, is why town grows with no resource requirements met?
Last edited by stinkyfax on 29 Mar 2013 14:21, edited 1 time in total.
Re: CityBuilder Release Topic
And another issue:
There are dozen of busses around, Also already supplying water.
Town stays same population for two years, yet it says "grows", I would really appreciate some help in figuring out what is wrong.
There are dozen of busses around, Also already supplying water.
Town stays same population for two years, yet it says "grows", I would really appreciate some help in figuring out what is wrong.
Re: CityBuilder Release Topic
betterAphid wrote: I'm trying code like this:
Code: Select all
local Townlist = GSTownList(); foreach (town, _ in Townlist) { for(local id = 0; id < 32; ++id) { if(Havenot[id]) // Havenot is an array of 32 fields. { if(GSTown.GetLastMonthProduction(town, id) > 0) Havenot[id] = false; } } }
Code: Select all
local Townlist = GSTownList();
local Havenot = AIList();
for (local id = 0; id < 32; ++id) Havenot.AddItem(id, 1);
local cargo_use = AIList();
cargo_use.AddList(Havenot);
foreach (town, _ in Townlist)
{
foreach (item, dummy in Havenot)
{
if(GSTown.GetLastMonthProduction(town, item) > 0) { Havenot.Remove(item); if (Havenot.IsEmpty()) break; }
}
}
cargo_use.RemoveList(Havenot); // now you get list of cargo that have been found in town only
Re: CityBuilder Release Topic
Small city's will always grows to some level (with you can determine yourself if i am right). Therefore your city grows.stinkyfax wrote:Is it a bug or I am misunderstanding something?
P.S. What confuses me, is why town grows with no resource requirements met?
Who is online
Users browsing this forum: No registered users and 11 guests