Page 1 of 1

Production of raw materials industries

Posted: 10 Nov 2007 21:41
by George
A question about production of raw materials industries. OTTD modifies production change for raw materials industries, so they change production not only by /2 (-50%) or *2 (+100%), but also by 12% for example. It is fine for default industry, but it is also applied to new industries in ECS. Because I specify callbacks 29 and 35, this behaviour is unexpected, because callback 35 result is 00 80 and callback 29 returns only 02 80 and 01 80 (ECS Iron ore mine for example). That means we need to decide, how to support this situation. I think GRF has to have full control over its industries. So:
1) the result should be stored. I suppose we can use var 93, but put all 256 values (not only 00, 04, 08, 10, 20, 40, 80).
2) wee need two more returns for callbacks 29 and 35
0D decrease production by 1 (var 93 = var 93 - 1)
0E increase production by 1 (var 93 = var 93 + 1).
TTDP could recognise them as 00 (I suppose it is hard to have more values for var 93 in TTDP)

Re: Production of raw materials industries

Posted: 21 Nov 2007 00:52
by belugas
George wrote:A question about production of raw materials industries. OTTD modifies production change for raw materials industries, so they change production not only by /2 (-50%) or *2 (+100%), but also by 12% for example. It is fine for default industry, but it is also applied to new industries in ECS.
I was watching over the code and it seems to be working along the specs. Can you point out which behaviours might not be adequate?
George wrote: Because I specify callbacks 29 and 35, this behaviour is unexpected, because callback 35 result is 00 80 and callback 29 returns only 02 80 and 01 80 (ECS Iron ore mine for example). That means we need to decide, how to support this situation. I think GRF has to have full control over its industries.
According to waht i've seen, it is actually the case. There is no randomization nor some chance percentage, everything is performed from the callback results. I wonder what makes you think otherwise. Note that i do not doubt you, just that i lack the data to evaluate it.
George wrote: 1) the result should be stored. I suppose we can use var 93, but put all 256 values (not only 00, 04, 08, 10, 20, 40, 80).
2) wee need two more returns for callbacks 29 and 35
0D decrease production by 1 (var 93 = var 93 - 1)
0E increase production by 1 (var 93 = var 93 + 1).
TTDP could recognise them as 00 (I suppose it is hard to have more values for var 93 in TTDP)
I understand. Yes, it would be relatively easy to do. I wonder how TTDPatch would react with that new return value.
You could provide a test grf and we would be able to see how both systems would work.

Re: Production of raw materials industries

Posted: 21 Nov 2007 05:04
by George
belugas wrote:
George wrote:A question about production of raw materials industries. OTTD modifies production change for raw materials industries, so they change production not only by /2 (-50%) or *2 (+100%), but also by 12% for example. It is fine for default industry, but it is also applied to new industries in ECS.
I was watching over the code and it seems to be working along the specs. Can you point out which behaviours might not be adequate?
Iron ore mine, ECS machinery vector beta 2.
belugas wrote:
George wrote:Because I specify callbacks 29 and 35, this behaviour is unexpected, because callback 35 result is 00 80 and callback 29 returns only 02 80 and 01 80 (ECS Iron ore mine for example). That means we need to decide, how to support this situation. I think GRF has to have full control over its industries.
According to waht i've seen, it is actually the case. There is no randomization nor some chance percentage, everything is performed from the callback results. I wonder what makes you think otherwise.
News message. It reports that iron ore mine XXX production +10% (screenshot)
belugas wrote:
George wrote:1) the result should be stored. I suppose we can use var 93, but put all 256 values (not only 00, 04, 08, 10, 20, 40, 80).
2) wee need two more returns for callbacks 29 and 35
0D decrease production by 1 (var 93 = var 93 - 1)
0E increase production by 1 (var 93 = var 93 + 1).
TTDP could recognise them as 00 (I suppose it is hard to have more values for var 93 in TTDP)
I understand. Yes, it would be relatively easy to do. I wonder how TTDPatch would react with that new return value.
Ignore?
belugas wrote:You could provide a test grf and we would be able to see how both systems would work.
test GRF with callback values 0D and 0E for test issue only!

Re: Production of raw materials industries

Posted: 22 Nov 2007 01:07
by belugas
Both values are indeed called, with the result of closure, ultimately.
System is working fine :)

Take note that i have not spend a lot of time on the production problem you raised earlier.
I'll try to give it more time on my next free-time session.

Re: Production of raw materials industries

Posted: 22 Nov 2007 22:01
by robertbeunes
Hello every body:

I'm going to use this post in order to expose another problem related with this topic (Production and Industries).

In OTTD maps and town are very large and there are a lots off industries. Some times its not enought time to suply all of these type off industries and they close.

The problem is when all industries of one tipe close. In my opinion the program should verify whena an industry is going to close that isn't the last industry of that type. Before to close a Farm the program should verify there are any other farm.

Sorry about my english. I hope do yo understand me.

Best regards,

Your friend Robert

Re: Production of raw materials industries

Posted: 22 Nov 2007 22:04
by belugas
George: I checked the code in detail regarding your 10% news message and it seems that the message in question can only be generated if the cd29 or cb35 failed and running with smooth industry (which is indeed enabled in your savegame you provided me).

So it might be interesting to see what are the conditions examined by the call back, and making it fail.

robertbeunes: There are some grf that are perfoming this check. It is not mandatory for all industries to do so. And some industries may close down (all of tis kind) in order for some other industries to take its place. What were the grfs you used?

Re: Production of raw materials industries

Posted: 22 Nov 2007 22:14
by robertbeunes
Wow!!!!

A rapid answer!!!!!

I use ECS in all there extension.This is all vectors for template.
LV4, Dbset, DbsetECS... what else???

Re: Production of raw materials industries

Posted: 22 Nov 2007 22:36
by George
belugas wrote:George: I checked the code in detail regarding your 10% news message and it seems that the message in question can only be generated if the cd29 or cb35 failed and running with smooth industry (which is indeed enabled in your savegame you provided me).

So it might be interesting to see what are the conditions examined by the call back, and making it fail.
callback 35 can't fail because it is not defined in industry prop 21. Looks like this prop is ignored|redefined and callback 35 is used.

Re: Production of raw materials industries

Posted: 23 Nov 2007 04:08
by glx
Indeed callback 35 doesn't fail (it is not called). But as CB35 flag is not set, smooth economy stuff is done each month as usual. If you want to totally disable it, you just need to enable CB35 and return 00.

Re: Production of raw materials industries

Posted: 23 Nov 2007 04:19
by DaleStan
Unless I'm missing something here, the point is to have *control* over the smooth economy. Not to leave it up to the RNG to determine what happens.

Re: Production of raw materials industries

Posted: 23 Nov 2007 05:13
by George
glx wrote:Indeed callback 35 doesn't fail (it is not called). But as CB35 flag is not set, smooth economy stuff is done each month as usual. If you want to totally disable it, you just need to enable CB35 and return 00.
I think it should be documented in the wiki, section Action 0 for industries that in OTTD "smooth economy" switch activates it's own behaviour for callback 35 and ENABLES it by default. So the coder should control the callback 35 himself. (This behaviour is unexpected, at least it was for me).
Or
This behaviour should be applied to default industries only. New industries should enable callback 35 and make it fail to achieve the same behaviour.

Re: Production of raw materials industries

Posted: 23 Nov 2007 17:05
by belugas
glx just commited a fix for that. The idea is that smooth economy should not be used if ever the grf declares any kind of production callback, even if given callback fails. This is in accordance to what TTDP does, further more since smooth economy is not present in TTDP.

Hoping you will find this satisfactory :)

Re: Production of raw materials industries

Posted: 23 Nov 2007 18:06
by George
belugas wrote:glx just commited a fix for that. The idea is that smooth economy should not be used if ever the grf declares any kind of production callback, even if given callback fails. This is in accordance to what TTDP does, further more since smooth economy is not present in TTDP.
Hoping you will find this satisfactory :)
That is fine