News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

DSG Development Blog

Started by DrSuperGood, October 11, 2016, 12:52:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrSuperGood

Quote
DrSuperGood, I appreciate that you, as every developer, endeavours to fully test changes before committing. However unless these are entirely trivial (a handful of lines at most) as Ters says, there is the possibility of unintentional changes occurring. We all try to write good code, sooner or later we will all make mistakes. Bugs may happen which result in intermittent issues and peer review minimises the possibility of this.
My JIT2 and power network revisions still have not been reviewed... At that rate I might be able to push out 3-4 commits a year!

I will be working to replace all/most of the magic constants used to reference the public service player with a method call. This should result in no functional or performance change (get_player(1) to get_public_player()). However it should make the code more maintainable in future as it reduces the usage of magic number constants.

DrSuperGood

Been working on bridge consistency improvements with regards to city interaction. I plan to commit the patch on 13/11/2016, a week from now.

Since as long as I have been playing one has always been able to build bridges over cities. Even tall buildings could be bridged through. However if the bridge used pillars then houses under it could no longer upgrade (not sure why, maybe just luck with the tests I ran) and empty spaces under the bridge could not be used to build new houses. This behaviour is inconsistent in that it is order dependent and certainly not what people would expect.

This patch changes it so that cities can build houses under bridges with pillars and that such houses will upgrade. Code was added to ignore pillar objects when looking for suitable build spots as well as when building new houses. How this fixed the upgrading issue I am unsure. Tests show that with this patch applied houses are now built under bridges with pillars and that such houses as well as existing houses do upgrade as one would expect.

One can argue if this is the "correct" behaviour for bridges and cities. However it is at least going to be consistent and most people should be able to understand it.

prissi

I would rather forbid bridges with pillars over houses, as these are quite often mortar bridges which could not accomodate houses; however there are japanese highways and special houses for these bridges. Updating such houses would certainly not welcomed.

I would rather suggest: No house updates below any bridge. Pillars must by built on empty tiles or bridge building fails: Any object on a tile is "not nature" and thus not building space.

Ters

Quote from: prissi on November 05, 2016, 11:46:26 PM
Pillars must by built on empty tiles or bridge building fails: Any object on a tile is "not nature" and thus not building space.

I see no reason why the bridge builder can not automatically remove the same kind of objects that are automatically removed when building plain ways, such as trees and (non-moving) ground objects, when building pillars. Furthermore, some ground objects, or even some trees, could co-exist with pillars that are on the edges (like the viaduct in pak64), but it might be too difficult to make a distinction between what works and what doesn't (the tiny watchtowers in pak64 "physically" fit under a bridge, but it still seem odd for them to be there).

DrSuperGood

Quote
I would rather forbid bridges with pillars over houses, as these are quite often mortar bridges which could not accomodate houses;
Hard to implement retrospectively due to how many such bridges exist. Look at the average server game. Would need load logic to detect and remove them in a sensible way, but that would break a lot of people's work.

Quote
however there are japanese highways and special houses for these bridges. Updating such houses would certainly not welcomed.
Except there are no such special houses? Sure the artwork might exist however neither city or bridge builder build them with such rules. It makes no sense that one can build a bridge over something but that same sort of something cannot be upgraded to when under a bridge.

Such mechanics might be something to do in the future. Such as special buildings for under bridges, limitations for pillared bridges and different sorts of pillared bridge with short bridges not needing pillars. Let us not forget more sensible height checks as well as pillars for elevated ways. If such mechanics are implemented perhaps a game option should be added as I think some people enjoy the freedom, especially in servers where one often is forced to bridge or tunnel big distances due to other players.

For now I think the improvement in consistency is certainly welcome. At least it feels polished and intended instead of the mechanics conflicting. Currently one can delete bridge pillars by deleting the ground they touch anyway, which in theory would have allowed cities to build there. Nothing stops elevated ways from magically floating in space either. Some nonsense bridges over huge buildings or with dense pillars inside houses is probably not the most illogical thing one can do.

If people use such houses for model railroads then perhaps they can buy the house to stop it upgrading as upgrading is ownership tested. If not then one can always stop the city growth and occasionally increment it manually.

Quote
Any object on a tile is "not nature" and thus not building space.
That method is poorly named. It actually means that the underlying ground is natural, as opposed to a bridge, tunnel, water etc. It seems to be a test of ground type and not ground content.

Quote
I see no reason why the bridge builder can not automatically remove the same kind of objects that are automatically removed when building plain ways, such as trees and (non-moving) ground objects, when building pillars. Furthermore, some ground objects, or even some trees, could co-exist with pillars that are on the edges (like the viaduct in pak64), but it might be too difficult to make a distinction between what works and what doesn't (the tiny watchtowers in pak64 "physically" fit under a bridge, but it still seem odd for them to be there).
I think it might be because not all bridges were intended to have pillars originally. It makes no sense for anything to be removed under a bridge with no pillars as it is suspended in the air.

IgorEliezer

#40
Quote from: jamespetts on October 12, 2016, 06:14:24 PM
One could perhaps forbid players other than the public player from planting trees in a network game? Transport companies do not usually plant trees, after all.
Unless transport companies are fined or required to "compensate" for tree cutting, on a sort of "1 tree cut = 2 new trees planted" basis or something around these lines. But IMO it could be rather a hurdle in Simutrans.

(late and odd reply, I've just found this topic today)

EDIT: Oops, River explained what it is about. :x

River

Quote from: IgorEliezer on November 06, 2016, 04:31:25 AM
Unless transport companies are fined or required to "compensate" for tree cutting, on a sort of "1 tree cut = 2 new trees planted" basis or something around these lines. But IMO it could be rather a hurdle in Simutrans.

(late and odd reply, I've just found this topic today)
I don't think you understand Igor, we don't want any trees in the map to increase load time when connecting.

Ters

Quote from: DrSuperGood on November 06, 2016, 12:49:08 AM
I think it might be because not all bridges were intended to have pillars originally. It makes no sense for anything to be removed under a bridge with no pillars as it is suspended in the air.

I was referring to prissi's proposal and suggesting a slightly different behaviour. How things were before are and why, is mostly irrelevant, since you plan to change it anyway.

jamespetts

Quote from: DrSuperGood on November 06, 2016, 12:49:08 AM
I think it might be because not all bridges were intended to have pillars originally. It makes no sense for anything to be removed under a bridge with no pillars as it is suspended in the air.

There are quite a few bridges without pillars in Pak128.Britain.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

@DSG: upgrading of buildings under bridges works just fine.

Imho cityhouses should not be build under bridges on tiles with pillars (patch part 1). Not removing the pillar if a house gets removed should be submitted (patch part 2).
Parsley, sage, rosemary, and maggikraut.

Vladki

I think removing pillars should be forbidden. Buldings under the bridges should have limited height/level, to fit under the bridge. I think that in many cases the area under the bridge had to be cleared (demolished) during construction works, and only new small buildings were allowed to be built under the bridge later.

Some bridges (viaducts) should even limit  roads that are under them to be perpendicular to the bridge.

Sometimes the arches of viaducts serve as a roof of small shops that cannot be built any where else. But that is too special case.

DrSuperGood

Quote
Imho cityhouses should not be build under bridges on tiles with pillars (patch part 1). Not removing the pillar if a house gets removed should be submitted (patch part 2).
But why should one be able to build over houses yet houses cannot build underneath? This is order dependent and can appear to players as inconsistent, hence the patch.

The patch makes it so that houses can be built under bridges just like how currently bridges can be built on top of houses. It is not intended to be a major mechanic revision, but rather just fix an inconsistency in gameplay mechanics. Importantly this is backwards compatible with existing maps as it does not change where bridges are allowed to be built.

Quote
I think removing pillars should be forbidden. Buldings under the bridges should have limited height/level, to fit under the bridge. I think that in many cases the area under the bridge had to be cleared (demolished) during construction works, and only new small buildings were allowed to be built under the bridge later.

Some bridges (viaducts) should even limit  roads that are under them to be perpendicular to the bridge.
Such restrictions would be useful for new games, as long as they are implemented consistently. The aim of the patch was not to considerably change the mechanics of bridges, but rather make the existing mechanics more consistent. One should not be left asking why one can bridge over a house but a house cannot be built underneath the same bridge.

For now I plan to remove the building height check (not way height check) from elevated ways until a more complete implementation is added (elevated ways, bridges and building under/over them, a huge amount of work). Having skyscrapers pop up and block elevated ways from being upgraded is getting annoying. However that is another patch for another day.

Dwachs

Quote from: DrSuperGood on November 06, 2016, 05:06:16 PM
But why should one be able to build over houses yet houses cannot build underneath? This is order dependent and can appear to players as inconsistent, hence the patch.
Building bridges over/through buildings with no proper height check should be 'fixed' (this would be a large patch not a small fix). Why should the program be consistent with respect to flaws?
Parsley, sage, rosemary, and maggikraut.

Ters

Quote from: Vladki on November 06, 2016, 04:32:56 PM
I think removing pillars should be forbidden.

I mostly agree, but since it is not possible to mix bridge styles without touching the ground, which might look unrealistic, I like to be able to remove the dense pillars of the high speed rail bridge/viaduct in pak64 on a single tile to let a way pass under it. These particular pillars don't combine well with anything else.


Vladki

Sure there can be high buildings under very high bridge. But they cannot be higher...
Ideally the limit on building height/level should match the height of the bridge above given tile.

And although the bridge in Millau is really high - there are no buildings undernath. Moreover you can see the destruction of landscape caused by construction works. See this bridge in Prague: http://zpravy.idnes.cz/foto.aspx?r=domaci&foto1=JB37b1a7_385499.jpg
17 houses in the path of the bridge (and at its sides) were demolished, to make place for the cranes, etc. Only one house was saved.

So I think that building bridges over any house should be forbidden, and later building small buildings underneath allowed.

With pillars I'm split - many bridges are painted to have the pillars on tile borders and then it might be OK to have buildings at the same tile. Perhaps a dat file option where pak designer could specify if the pillar occupies the centre - thus forbidding anything (including ways), or the border - allowing ways, or even houses underneath.

Some bridges (viaducts) should forbid any buildings underneath - or have some constraint for special buildings that fit into the arches:
https://www.google.cz/search?q=negrelliho+viadukt&source=lnms&tbm=isch&sa=X&ved=0ahUKEwivjf_X_5TQAhVEwBQKHQ7DDsYQ_AUICCgB&biw=1270&bih=800

prissi

That why my suggestion: Basic correction: No houses under bridges with pillar on a tile. If there is a tile every 2nd, then you must clean that tile for building the pillar.

Advanced: No houses for bridges within single clearance (one level for pak64/twp for pak128). And then one could determine the house height from the pak image size ...


DrSuperGood

Quote
Building bridges over/through buildings with no proper height check should be 'fixed' (this would be a large patch not a small fix). Why should the program be consistent with respect to flaws?
Being consistent feels polished even if the result might be broken or too strong with respects to gameplay. I am purely looking at it from a pollished gameplay perspective. Later in development one could add more strict, or realistic restrictions. I personally view this as a bug fix.

Quote
I mostly agree, but since it is not possible to mix bridge styles without touching the ground, which might look unrealistic, I like to be able to remove the dense pillars of the high speed rail bridge/viaduct in pak64 on a single tile to let a way pass under it. These particular pillars don't combine well with anything else.
Again a reason why I am reluctant to change current mechanics. Instead this patch aims to make such mechanics more consistent. It removes some nonsense build order restrictions which were more the result of a programming oversight than intentional (they were not intentional due to being inconsistent).

Quote
I think tall buildings under the bridges should definitely be kept:
China has tons on such elevated ways which really do have skyscrapers under and next to them. Sure they are only 10-20 stories, but even the tallest pak64 building is probably not much higher. Personally I find being able to build ways everywhere one of the charms of Simutrans and in multiplayer environments it can lead to impressive results.

Quote
Sure there can be high buildings under very high bridge. But they cannot be higher...
Ideally the limit on building height/level should match the height of the bridge above given tile.
I agree, however no such mechanics currently exist except only for elevated way construction. Hence I want the removal in future until a more thorough implementation which affects both building under bridges/elevated ways as well as their construction. Fractionally implementing a feature feels sloppy.

Quote
So I think that building bridges over any house should be forbidden, and later building small buildings underneath allowed.
This is an inverse consistency of currently. It also makes little sense as its the same consistency problem as the patch is trying to fix. In such a case maybe the player should have to pay a penalty for "spoiling" the property value of the house (compensation), but again that is a new feature.

Quote
With pillars I'm split - many bridges are painted to have the pillars on tile borders and then it might be OK to have buildings at the same tile. Perhaps a dat file option where pak designer could specify if the pillar occupies the centre - thus forbidding anything (including ways), or the border - allowing ways, or even houses underneath.
In future new restrictions and mechanics should be added. The viaduct for example should not mix well with housing while a pillar-less bridge should have no problem going over housing. I also agree that running roads through viaduct pillar walls looks stupid. However one cannot suddenly make that illegal for all bridges which do not have walls.

I would recommend such features be developed separately in the future for adding into new paksets.

Quote
That why my suggestion: Basic correction: No houses under bridges with pillar on a tile. If there is a tile every 2nd, then you must clean that tile for building the pillar.
However again applying this retrospectively to existing game is a problem as no such restriction existed and houses and pillars mix.

I also support this as a restriction. However it needs to be developed as a new feature. Either a pakset author must enable it for a bridge type (more flexible, recommended) or some simuconfig setting needs to be added (less flexible, maybe good enough).

Quote
Advanced: No houses for bridges within single clearance (one level for pak64/twp for pak128). And then one could determine the house height from the pak image size ...
Not sure what is meant by this. If a bridge is above a house it is still above the house and this is possible even in real life. Exceptions are needed for bridges like pak64 viaduct which take a tile below the way for the arches. However again this would need new pakset features where one can explicitly define bridge construction restrictions. Some way to relay these to the player are also needed.

General height clearance for buildings is lacking except for ways. Hence I suggest removal from elevated ways (only logic and it is only for building the way) until some kind of complete solution is ready which affects all building.

Quote
And then one could determine the house height from the pak image size ...
Apparently some people argue otherwise. I raised this a year or so ago when first suggesting elevated way consistency improvements. The arguments included that some parts of buildings were purely aesthetic, eg a lighting conductor, and hence in reality would be removed to make way for something above them.

DrSuperGood

I am planning to finally merge in my power system and JIT2 fixes which I made all those months ago. The patch is attached and the commit will happen on 08/01/2017.

To summarize...
Fixes power tick on save load.
Fixes distribution transformer payment accumulator lost on load.
Power net information now shows the correct demand for the supplied. Before it used to be 1 tick out of sync allowing nonsensical values.
Distribution transformer overloaded graphics now correctly modulate instead of suffering arithmetic overflow.
Fixed incorrect power payment scaling. Monthly revenue from power is now proportional to month length instead of constant.
Distribution transformers now pay out at regular intervals, currently set to 10 seconds. This stops message spam for high powered consumers as well as fixes rare messages for low powered ones.
Revisions to JIT2 production rate stability. I forget the exact details but it should result in smoother production scaling and less oscillation.

It is worth noting that some of the save/load changes will only take effect once version is incremented.

I plan to work on JIT2 some more after this. Specifically I have thoughts to address the most talked about issues. Instead of a feedback production regulator, a periodic think regulator run every minute would set the production rate for the next minute. It would track how much demand was dropped due to undersupply and so be able to throttle back production to track supply and hence solve the pulse width modulation like activity that JIT2 factories that are undersupplied suffer from. Additionally input storage maximum behaviour would be completely discarded (no penalty for overflow) and output storage would be adjusted based on production rate to guarantee at least 1 think time (minute) worth of output production. Every month some magic algorithm (not thought of it yet...) would determine if the input storages need trimming and if so it would drop some orders over the next month. This would make JIT2 more compatible with pak64 and other paksets as well as fix issues such as power network stability. It might also make industry tick logic simpler as fewer values need computing every tick.