Production of raw materials industries

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
George
Tycoon
Tycoon
Posts: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Production of raw materials industries

Post 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)
Image Image Image Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Production of raw materials industries

Post 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.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
George
Tycoon
Tycoon
Posts: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Production of raw materials industries

Post 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!
Attachments
testw.rar
(30.32 KiB) Downloaded 48 times
Screenshot
Screenshot
iore-10.png (203.61 KiB) Viewed 488 times
Image Image Image Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Production of raw materials industries

Post 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.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
robertbeunes
Engineer
Engineer
Posts: 17
Joined: 22 Sep 2005 18:53
Location: Havana, Cuba
Contact:

Re: Production of raw materials industries

Post 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
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Production of raw materials industries

Post 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?
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
robertbeunes
Engineer
Engineer
Posts: 17
Joined: 22 Sep 2005 18:53
Location: Havana, Cuba
Contact:

Re: Production of raw materials industries

Post by robertbeunes »

Wow!!!!

A rapid answer!!!!!

I use ECS in all there extension.This is all vectors for template.
LV4, Dbset, DbsetECS... what else???
User avatar
George
Tycoon
Tycoon
Posts: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Production of raw materials industries

Post 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.
Image Image Image Image
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Production of raw materials industries

Post 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.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Production of raw materials industries

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
George
Tycoon
Tycoon
Posts: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Production of raw materials industries

Post 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.
Image Image Image Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Production of raw materials industries

Post 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 :)
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
George
Tycoon
Tycoon
Posts: 4364
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Production of raw materials industries

Post 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
Image Image Image Image
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests