BCA & BTY files problems

Creating and editing buildings and Commodities.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

BCA & BTY files problems Unread post

Adding "demand only" to a new civic building, like a super-sized church with a passenger rating at 5, comes with some risks. There is obviously something more to this than adding a cargo demand or transformation, since default civic buildings, like retail and commercial buildings, don't self-delete (or, at least, I've never seen one self-delete). And there's where I come up empty, my handy-dandy new Cathedral (for lack of a better name for a big church) self deletes if I add a demand only for 1 alcohol per year, which seemed a small, safe demand to add. The issue being, it displays a profit and loss panel, and no cargo panel, unlike the retail and commercial buildings do. So at some point, usually about year 5, lack of alcohol and/or the financial loss causes the "cathedral" to self-delete. I deleted the demand only and it stops self-deleting, but I can't really say with any certainty that the passenger rating being set to 5 has any real impact that I can see.

I'd like to figure out how to get the Cathedral to pull the Sermon of the Week strings from the language file. I reckon if I can get that working, it will solve the other issue.

With a straight up new industry building, like the cannery and the auto dealership I made, the transforms show up without a problem. Pure profit and loss mechanics. But civic buildings seem problematic. And recent experience informs me that new housing units are also a bit twitchy. After the failed attempt to add new architectural styles, I made a multiple house mesh based on the Stadium footprint, 8 houses + a small retail, and named it "Worker housing" (and company store), gave it a BCA with 8 x the demand of a single family house. Another bad idea from the start, it seems. Same problem as the Cathedral, shows up in seeding, eventually self-deletes.
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: BCA & BTY files problems Unread post

Are you sure you're setting the correct building group for municipal? Should be 03 at byte #50.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

Re: BCA & BTY files problems Unread post

Indeed, sir, I had it set to 03. Further experimentation indicates that "church" is a category that has some portion of its properties hard-coded into the EXE. Only by changing the building category at position 34 in the BTY to "Church" was I able to fix the problem satisfactorily. Any other value (meaning targeting any other BCA) resulted in undesirable behavior and consequences. I haven't tried modding the Church.BCA, but I suspect that a change there to the cargoes will cause the same problems, since I cloned the Church.BCA for the "Cathedral".
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
RulerofRails
CEO
Posts: 2061
Joined: Sun Dec 08, 2013 1:26 am

Re: BCA & BTY files problems Unread post

Just Crazy Jim wrote:There is obviously something more to this than adding a cargo demand or transformation, since default civic buildings, like retail and commercial buildings, don't self-delete (or, at least, I've never seen one self-delete).
If that's true I never noticed. I can't give you a specific example (solid evidence), but I am pretty sure they can be self-deleted. But this "fuzzy memory" of mine doesn't contradict your other statements, in the sense that I also suspect that certain conditions cause a higher chance of self-deletion. I know that houses (1.05 or 1.06) do self-delete.

Self-deletion of a building that the game seeded, surely means that the game will later seed that building in a new place. For a civic building, a city that your are servicing to give growth will surely be a likely place for a new location. Don't forget that you can select a density in the bca footer: link.

Not quite sure why you can't see a cargo panel. I know a displaying demand only function can be added to the church. Blackhawk did.

If you look at Trainmaster you will see many civic buildings that don't have the hard-coded text display (my suspicion also is that this is linked somewhere in the exe to specific bca file names, like you figured), instead showing a small loss. I loaded up a saved game and found a few buildings that hadn't consumed any cargo and were still around on the map after 50+ years. However, those buildings were not seeded, but placed manually in the map editor. Ned encouraged people making maps for TM to place buildings manually. Good reason for the agricultural communities, but maybe this is a secondary reason. Others have stated before that manually placed buildings are less likely to be deleted.

In TM, there are two models for the church (bty files) both using the same "church" bca file. Which would line up with your observations. However, new demands have been added to the "church" bca file. I never noticed higher rates of deletion in civic buildings with modded bca files whether TM or 1.06 compared to 1.05, but I was never paying attention to that either. If time permits, such a test might be worthwhile.

If a civic building is more likely to avoid deletion by having a function in the game with loads in/out, then surely a connection to a network and hauling passengers will give it such useful function and discourage self-deletion.


If it turns out that running at a loss is causing the deletion, there is probably a work-around to get the building to turn a small profit by using a supply function. Since you are adding a demand-only for Alcohol, the building will have a demand for that even if it is in isolation. The trick is to also add a supply function for Alcohol but keep the output quantity very low, just enough so that it can consistently turn a profit. Experiment, you could start at 0.1 loads per year.

There is a drawback to this method, if a map maker uses an event to modify either overall cargo or specifically Alcohol production, the balance for a small profit will be lost. In such case the building may make a bit more money than you intended (or if production drops, it may return to the original loss-making condition). Potential extra profit wont be a big problem since the player wont be able to buy the building during the game, as long as the consumption provided by the demand-only function is sufficient to consume the excess cargo.

Other potential drawbacks, because the cell is never "un-supplied" with Alcohol it may not ever reach the maximum price for Alcohol, but it will be close.

If you are using a building that isn't coded to hide the cargo supply/demand info while in-game, you will have a nonsensical supply amount show up. There is a solution for this. Blackhawk gave me this information in a PM:
After the start/stop dates in the production chain, there are 4 hexes for something, then 4 more for something else, I think pjay called it q2 in his notes. If 02 is entered into the first of these hexes for q2, the chain is no longer displayed.
There actually isn't a q2, only q0, and q1. He means q1. For a usage that works check out the industrial facilities (Lumber Mill, Steel Mill, Textile Mill, etc.) in 1.06 that use this trick to hide their demand for Machinery.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

Re: BCA & BTY files problems Unread post

Thanks for the reply, RoR. This is all very helpful info. I will follow your advice to add a fractional output to keep the ledger out of loss. I will also keep whittling at this until I have more hard data. I seriously need to play around in Trainmaster more to see how far they changed things from Vanilla.
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: BCA & BTY files problems Unread post

RulerofRails wrote:For a usage that works check out the industrial facilities (Lumber Mill, Steel Mill, Textile Mill, etc.) in 1.06 that use this trick to hide their demand for Machinery.
That's bad. I never knew about this. How are players supposed to know what is demanded if it's hidden?
User avatar
RulerofRails
CEO
Posts: 2061
Joined: Sun Dec 08, 2013 1:26 am

Re: BCA & BTY files problems Unread post

Well, I can't say what Milo or the others who worked on 1.06 were thinking, but one possibility is that they didn't want a "0" (any decimals are rounded down so 0.99 displays as 0) demand displayed since IIRC, the demand level for Machinery is only 0.1. When Ned made Trainmaster he disregarded such consideration so there are zeros (demands less than 1.0) everywhere. If it was my choice, I think I would prefer to know. Although, Machinery demand is weak IMO, and I would seriously consider raising the level, if it's 1.0 or more, no "0" becomes a mute point. When tossing ideas around in the 1.06 industry/cargo fixes thread, the idea to add Machinery demands at the mines/oil wells/logging camps helps to give better Machinery demand on the map.

IMO, what I suggested qualifies as legitimate use since the purpose of the hidden function is only to help the industry profit . It's not pertinent information for strategizing during game-play.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

Re: BCA & BTY files problems Unread post

I hear you and and agree. Civic buildings should not be held to the same standards as a for-profit industry.

As for the for-profit sort... I certainly want to know what I can do to make my industry flourish, but I don't want to be bogged down with the minutiae of the operands and operators and sums of 50+ industries. Also, adding the fractional demand for oil to Lumber Mills, Machine Shops, etc, taught me this much: demand too little and a surplus rapidly evolves, then the supplying industry for that demand goes into a financial death spiral, eventually self-deleting and then you are at the mercy of RNG if a warehouse does not supply a "Supply Only" cargo like oil, bauxite, etc. Demand too much and the price becomes inflationary to such a degree that even a fractional demand can cause an otherwise profitable industry to become unprofitable. I have seen pre-placed warehouses (which should be a bit more bulletproof) self-delete not long after they upgraded because of the latter case. So it is a delicate bit of business working out the right balance. When I added the fractional oil demand, I figured that 2 oil a year from a warehouse should be sufficient, however, on several different maps, by about year 15, there was a surplus of oil that caused the whole map to turn yellow and orange for oil. So I had to rethink things a bit and settled on a soultion very much in line with your advice about my Cathedral problem, I added a fractional supply of oil to meat packing plants (to simulate animal fats as "grease", historically accurate for my chosen era, both as axle-grease and tallow candles). In this, you can see that my Whale Oil idea is shaping into something else.

Aside: Bayberry wax (not just coz it smelled good), Bees wax and coconuts were primarily used for making candles in the 19th century. When I was thinking about "Wax" as a new cargo, I considered making Fruit Farms/Orchards upgradable (add beehives) but fertilizer already sort-of-kind-of does that and I couldn't find a way to add an output only linked solely to an upgrade. And a "Beekeeper" building would be too small to merit adding to the map, so I went off that idea.

I also agree that the demand for machinery should be higher. My thinking on this is based on what I have seen in real world:

I live near 3 coal mines and a hardwood lumber mill and the ground support industries for them flourish. Service Wire Co. and Phillips Machine Services probably make as much money from the mines as the mines make from coal. And Special Metals (formerly INCO) in Huntington has a full-time on site machine shop that uses Service Wire and W.Va. Electric Supply Co. for bits and bobs they can't fabricate from onsite materials. Even in the restaurant and hotel industry, with which I have much personal experience, there is a demand for "machinery" in the form of carpet cleaners, laundry equipment, industrial dishwashers, ovens, etc, all of which that need regular service that frequently approaches the cost of total replacement in a given year. It could be assumed that these things are covered in the "overhead" category of the ledger, but if there is an in-game machinery cargo, reducing overhead (automatic) and increasing the machinery cargo demand is both more visible and directly related to the "supply & demand" economy, IMHO therefore desirable because a wise investor could then make money on both ends of the purchase.

And another aside: AFAIK, Tool & Die shops don't make "direct-to-market" goods, they make intermediary things that other industries use to fabricate actual goods, like an onsite grinding/lathing shop at an auto plant that manufactures non-casted parts for a car. But "goods" is a vague, open-ended term that could be stretched to include any end-use product from nails to automobiles. So, my disagreement may be with the broadness of the term, rather than the function of the building. In 1.06 there seem to be a number of industries that are IMHO half of a great idea. I have no idea how to "fix" them without breaking everything. My understanding of 1.05's much simpler economy is just adequate to not break the game every time I alter something.
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: BCA & BTY files problems Unread post

Just Crazy Jim wrote:I also agree that the demand for machinery should be higher. My thinking on this is based on what I have seen in real world:

I live near 3 coal mines and a hardwood lumber mill and the ground support industries for them flourish. Service Wire Co. and Phillips Machine Services probably make as much money from the mines as the mines make from coal. And Special Metals (formerly INCO) in Huntington has a full-time on site machine shop that uses Service Wire and W.Va. Electric Supply Co. for bits and bobs they can't fabricate from onsite materials. Even in the restaurant and hotel industry, with which I have much personal experience, there is a demand for "machinery" in the form of carpet cleaners, laundry equipment, industrial dishwashers, ovens, etc, all of which that need regular service that frequently approaches the cost of total replacement in a given year. It could be assumed that these things are covered in the "overhead" category of the ledger, but if there is an in-game machinery cargo, reducing overhead (automatic) and increasing the machinery cargo demand is both more visible and directly related to the "supply & demand" economy, IMHO therefore desirable because a wise investor could then make money on both ends of the purchase.
Bear in mind that this will depend on the period. For instance, in the 1800's most felling and sawing of logs was done with hand tools. Well the felling certainly was. Depending on where you were the mill may have had a waterwheel or a steam engine, but pit saws were still in use too. So if increasing demand for machinery in 1.06 it may be a good idea to phase it into different industries gradually, based more or less on what they were doing at the time.

The other point is that machinery is hard to produce on most maps, due to the requirement of three inputs. IME it's fairly rare to get enough production to make any real difference.


And another aside: AFAIK, Tool & Die shops don't make "direct-to-market" goods, they make intermediary things that other industries use to fabricate actual goods, like an onsite grinding/lathing shop at an auto plant that manufactures non-casted parts for a car. But "goods" is a vague, open-ended term that could be stretched to include any end-use product from nails to automobiles. So, my disagreement may be with the broadness of the term, rather than the function of the building. In 1.06 there seem to be a number of industries that are IMHO half of a great idea. I have no idea how to "fix" them without breaking everything. My understanding of 1.05's much simpler economy is just adequate to not break the game every time I alter something.
This is the other thing, in that to some extent the 1.06 cargoes are fighting with the 1.05 cargoes, depending on how you look at all the definitions. And I agree that a lot of 1.06 seems to be "half of a good idea". That applies to the locomotives as well as the industries. I literally can't bring myself to use the 1.06 locos, but at the same time lack much enthusiasm for fixing them. In general I'd rather put the work into other locomotives.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

Re: BCA & BTY files problems Unread post

Gumboots wrote:Bear in mind that this will depend on the period. For instance, in the 1800's most felling and sawing of logs was done with hand tools. Well the felling certainly was. Depending on where you were the mill may have had a waterwheel or a steam engine, but pit saws were still in use too. So if increasing demand for machinery in 1.06 it may be a good idea to phase it into different industries gradually, based more or less on what they were doing at the time.

The other point is that machinery is hard to produce on most maps, due to the requirement of three inputs. IME it's fairly rare to get enough production to make any real difference.
Agreed. Machinery should be a "late game" demand. Maybe not as late as Electronics, but I'd ballpark it to be no earlier than 1890. And a graduated demand increasing over time would be preferable to a fixed rate from the onset.
Gumboots wrote:This is the other thing, in that to some extent the 1.06 cargoes are fighting with the 1.05 cargoes, depending on how you look at all the definitions. And I agree that a lot of 1.06 seems to be "half of a good idea". That applies to the locomotives as well as the industries. I literally can't bring myself to use the 1.06 locos, but at the same time lack much enthusiasm for fixing them. In general I'd rather put the work into other locomotives.
With all due respect to all the hard work that went into making 1.06, to this casual player, in some regards, it seems to be a bit more broken than the version it aimed to fix. But I would say that has much to do with the limiting factor of how far one can legally and logically hack the EXE before arriving at a completely new compile of the EXE. I know that the hard-coded bits are not easily patched out with anything short of a fresh compile, but that is true of many games. As an example, even though Civilization 4 gives the end user a bit of source code, that source code only allows so much tinkering and never allows a real, full re-coding effort. And it has taken teams of upwards of 50 devoted modders a number of years to achieve the better mods for that game. The same can be said for Neverwinter Nights (original). So, at the end of the day, with RT3 being as cryptic and downright cranky as it is, that 1.06 happened at all is nothing short of miraculous.

Now that Firaxis holds the keys to RT3, it is a crying shame that they have no plans to ever release the code to the community, probably because we might just make a game better than Sid Meier's Railroads!. Which, in all truth, wouldn't take much effort. Talk about your "half a great idea". All Railroads! and Pirates! really achieved was to provide the Civ modding community with a ready source of new models to inject into Civilization mods. Still, Pirates! is less egregiously broken than the Ubisoft released Pirates of the Caribbean game, even it that is comparing two very broken things and deciding which is less broken.

Alas. 'T'is passing true, the want of money makes good men bad and bad men wicked indeed. Wicked enough to make and release games like Railroads!
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
Just Crazy Jim
Dispatcher
Posts: 413
Joined: Fri Oct 14, 2016 9:57 pm
Location: Coal Fields of WV

Re: BCA & BTY files problems Unread post

OK, just back from a fresh run of experiments with the Church.BCA in 1.05. Any edit whatsoever to the Church.BCA in 1.05 results in a problem in one direction or another. These problems are not present in 1.06 or Trainmaster, so there was some manner of hoodoo performed to the EXE in those versions that permits alteration. But in 1.05, it's most definitely a no-go. Similarly, School Houses cannot be made to have a demand without causing a similar issue to manifest as seen with the Church.

As far as I can tell, there is some extraneous bit of code in the 1.05 EXE that refuses to cooperate with alterations to the civic buildings with string calls to the language file for weekly blurbs, that in refusing to cooperate also dumps the building into a behavior like "industry". Which makes no sense to me, as industry is building group 02 and housing is group 00, so it stands to reason that a borked read of the BCA should result in the building being vetted out as 00, not 02. But, on an altered BCA, the display is most assuredly that of industry, not that of housing.

However, more hammering and prying may discover something useful, so I will continue to hammer and pry at it.
"We have no patience with other people's vanity because it is offensive to our own."
-- François de La Rochefoucauld. Réflexions ou sentences et maximes morales. 1665.
User avatar
sbaros
Conductor
Posts: 256
Joined: Sun Nov 15, 2020 1:59 pm
Location: Inside the 9th car

Re: BCA & BTY files problems Unread post

An additional note to be included in PJay's Stuff BTYspec.txt
It fails to notice that byte No. 41747 onwards (hexadecimal 0000a313) contains the name of stuff surrounding the building concerned. For example, the Corn Farm mentions "corn", the Quarry's BTY mentions "Granite", the Fruit Orchard mentions "orange1" etc. Experimentation showed I can do this to any building, e.g. surround houses or specific factories with plants, stones etc. It would be good to update the relevant documentation.
If you have no Marxists in the leadership of your trade union, you have no trade union.
Abolish NATO and the (Na)zionist state !
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: BCA & BTY files problems Unread post

Hey that's a handy trick. :)
User avatar
sbaros
Conductor
Posts: 256
Joined: Sun Nov 15, 2020 1:59 pm
Location: Inside the 9th car

Re: BCA & BTY files problems Unread post

The issue is, who has the authorisation to supplement and update these downloadable guidelines, so that they always reflect the best of our collective knowledge.
Speaking of this, there are some obscure points about PJay's explanatory notes. I can understand the Dutch words he uses occasionally, yet there are many question marks inside, which probably were meant to be something else, obviously screwed up by some encoding misinterpretation when converted to TXT format.
If you have no Marxists in the leadership of your trade union, you have no trade union.
Abolish NATO and the (Na)zionist state !
User avatar
sbaros
Conductor
Posts: 256
Joined: Sun Nov 15, 2020 1:59 pm
Location: Inside the 9th car

Re: BCA & BTY files problems Unread post

As far as I have understood, the BCA file structure allows a commodity to be composed from more than 1 components, but doesn't allow a commodity to be split into more than 1 products, right? As for example, livestock could be split into meat and hides. Or recompose 2 commodities into 2 different ones, like corn + alcohol producing biodiesel + chemicals ? Such conversions are commonplace in the chemical industry.
User avatar
RulerofRails
CEO
Posts: 2061
Joined: Sun Dec 08, 2013 1:26 am

Re: BCA & BTY files problems Unread post

You are correct. Functions allow multiple inputs, up to 5, but only a single output.

Multiple conversion functions are not well supported. Priority is thought to be given to the more profitable conversion, however, there are some indications that this isn't reliable in all cases, for example in some tests I did where certain cargo prices were reduced via event.

Furthermore, no matter how many conversion functions you add, production quantity for the ENTIRE building is set in one place in the header, decimal address: 042. We could imagine conversion functions combined with "OR". Make x of this OR that. Multiple output cargo types can encoruage a micro-mangement scraping strategy where players try to prevent cargoes going to an industry that would produce the less favorable cargo. The cargo controls don't allow "don't haul x". If the inputs are the same, aka. Recycling Plant, there is nothing a player can do but take whatever the game gives.

The most practical use for multiple conversion functions seems to be illustrated with the Textile Mill or Tool & Die. To give multiple options for production. The player is not really concerned which of the functions is used, as long as there is a reliable resource feed. He/she can try to run efficiently by choosing a more profitable/strategic option, for example using Aluminium instead of Steel to make Goods, the Steel can then be used to make Automobiles. But it's pretty fool-proof, and will run fine without player intervention.
Post Reply