Author Topic: In what method is road replacing written?  (Read 1480 times)

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH

In what method is road replacing written?
« on: July 16, 2017, 03:57:55 PM »
Roads in a city district are automatically replaced by cityroads under certain conditions. In what method is this replacement process written?

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2592
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #1 on: July 16, 2017, 04:53:04 PM »
If I'm not mistaken it's either in wegbauer or simcity. Perhaps in weg

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4812
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: In what method is road replacing written?
« Reply #2 on: July 16, 2017, 05:07:10 PM »
As far as I can tell, city road construction takes place when buildings are built. Several classes are likely involved.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: In what method is road replacing written?
« Reply #3 on: July 16, 2017, 05:54:08 PM »
simcity.cc, stadt_t::build_road
Parsley, sage, rosemary, and maggikraut.

Offline DrSuperGood

Re: In what method is road replacing written?
« Reply #4 on: July 16, 2017, 07:22:07 PM »
Quote
Roads in a city district are automatically replaced by cityroads under certain conditions. In what method is this replacement process written?
They are not automatically replaced. What happens is that every time a city building is built or upgraded it replaces the surrounding road ways, that are not under a depot, with null owned (not public owned, null as in no player) roads of the current (the new) city road type. This upgrades existing city roads, as well as converts private roads to city roads.

It is very well possible that some roads may never upgrade because a city cannot ever build or upgrade anything around them.

Offline THLeaderH

Re: In what method is road replacing written?
« Reply #5 on: July 17, 2017, 02:46:02 AM »
Thank you for your advices, everyone 8)
I found this part of code in stadt_t::build_road(). It's simcity.cc::L3318~L3325
Code: [Select]
if (!bd->weg_erweitern(road_wt, connection_roads)) {
strasse_t* weg = new strasse_t();
// Hajo: city roads should not belong to any player => so we can ignore any construction costs ...
weg->set_desc(welt->get_city_road());
weg->set_gehweg(true);
bd->neuen_weg_bauen(weg, connection_roads, player_);
bd->calc_image(); // otherwise the
}
It seems that this part of code only builds new way. Where is replacement taken? Or does this code also do replacement?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4247
  • Total likes: 175
  • Helpful: 149
  • Languages: EN, DE, AT
Re: In what method is road replacing written?
« Reply #6 on: July 17, 2017, 05:58:19 AM »
replacement is done here: bool process_city_street(grund_t& gr, const way_desc_t* cr)
Parsley, sage, rosemary, and maggikraut.

Offline THLeaderH

Re: In what method is road replacing written?
« Reply #7 on: July 17, 2017, 06:01:37 AM »
I got it. Thank you.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8798
  • Total likes: 319
  • Helpful: 229
  • Languages: De,EN,JP
Re: In what method is road replacing written?
« Reply #8 on: July 18, 2017, 05:18:59 AM »
But with a wayobj making overtaking roads, you do not have to worry, as it will not be touched.

EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.
« Last Edit: July 19, 2017, 12:44:21 PM by prissi »

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2592
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #9 on: July 19, 2017, 03:29:50 PM »
I believe THLeaderH will start using my patch that affects the roads itself rather than use wayobjs. I already posted my GitHub link so it can be integrated to the overtaking patch.

Offline THLeaderH

Re: In what method is road replacing written?
« Reply #10 on: July 20, 2017, 01:58:08 AM »
Quote
I believe THLeaderH will start using my patch that affects the roads itself rather than use wayobjs. I already posted my GitHub link so it can be integrated to the overtaking patch.
I decided to use a window like this rather than use a tool bar. I already finished implementation and it will be released with the next version, v11.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2592
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #11 on: July 20, 2017, 02:29:39 AM »
Ok, I'll focus on the graphics, I still need to create the global object.

Offline THLeaderH

Re: In what method is road replacing written?
« Reply #12 on: July 20, 2017, 06:47:56 AM »
Quote
EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.
I think this should be implemented immediately.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4812
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: In what method is road replacing written?
« Reply #13 on: July 20, 2017, 02:15:00 PM »
EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.

I find that a bit too strict. Streets with electrification should be upgraded, and maybe even be allowed to grow new junctions, especially since regular players don't have the tools to upgrade city roads. They can upgrade, but then the sidewalk (and speed restriction) disappears. Maybe have some flags for this, like autoconnect in the other recent wayobj discussion?

Offline rapidliner

Re: In what method is road replacing written?
« Reply #14 on: July 27, 2017, 03:44:07 AM »
A private view about the theme to which I say "Why do you become demand of change cityroad-ization algorithm raised?"

I think...maybe the algorithm of cityroad-ization on Simutrans is premised the urban development in the Europe, which "A city and a trunk road are blocked off clearly" and "Development of place which faces the main road is restricted severely". But the premise of urban development in Japan is difficult, so..."a city and a trunk road are NOT classified" and "a place which faces the trank road is also development object as a city".

The algorithm of cityroad-ization on Simutrans becomes fatal by Japanese-style development situation. We cannot be achieved "building of Japanese-style road traffic network" and "reproduction of Japanese road circumstance". Japanese Simutrans players has a lot of people who want to do Japanese-style trunk road play, and therefore "To change present city road-ization algorithm" is strong desired in Japan.

REF:Scenery of Japanese trunk road
https://upload.wikimedia.org/wikipedia/commons/a/a9/R407-shinjyukutyo.jpg
https://upload.wikimedia.org/wikipedia/commons/2/2a/Franchising%28Fujio_food_system%2Cccc%2CYELLOW_HAT_LLC%2CSeria%2CMcDonald%27s_Company_%28Japan%29%2C_Ltd.P8148155.JPG

Offline Vladki

Re: In what method is road replacing written?
« Reply #15 on: July 27, 2017, 06:26:43 AM »
The question is, what is the allowed speed on such road in japan? Same as on other city roads?

The difference in Europe is, that if the road has higher speed limit than cca 50-60 km/h, then it is usually somehow (noise wall) separated from buildings, and has no sidewalk.

You can have multi-lane road inside the city, like on your picture, but it will have the same speed limit as any other road in the city.

Offline rapidliner

Re: In what method is road replacing written?
« Reply #16 on: July 27, 2017, 08:02:07 AM »
In case of the road which isn't a expressway, the max speed on the Japanese law is 60km/h a trunk road and a city road. But, in case of a city road, which the max speed is often specified 30km/h-40km/h.

In case of a road like these pictures, the max speed can't be taken out by a traffic jam. Because passage vehicles and the vehicles which goes in and out of the roadside facilities are blended, and for a flow to stop at the stoplight. On the other hand in case of the trunk road where it has little traffic volume such as the night or the suburb, the speed limit is often exceeded(Geschwindigkeits├╝berschreitung):-P
« Last Edit: July 27, 2017, 08:19:09 AM by rapidliner »

Offline Leartin

  • Devotee
  • *
  • Posts: 800
  • Total likes: 287
  • Helpful: 44
  • !!!!!This user was banned for double posting!!!!!
  • Languages: DE, EN
Re: In what method is road replacing written?
« Reply #17 on: July 27, 2017, 09:26:46 AM »
The question is, what is the allowed speed on such road in japan? Same as on other city roads?

The difference in Europe is, that if the road has higher speed limit than cca 50-60 km/h, then it is usually somehow (noise wall) separated from buildings, and has no sidewalk.

You can have multi-lane road inside the city, like on your picture, but it will have the same speed limit as any other road in the city.

I'd argue the main difference is whether there are driveways which connect the road to houses every few meters or not. Yes, that is "seperated from buildings", but it does not require any visual seperation such as noise walls, and while they are often not the typical one-step-up-sidewalks, most often such roads do have walkways right next to it, seperated only by 10cm of grass.

As such, it's not enough that buildings don't upgrade that road. Citybuildings require a road, which can be thought of as the road their driveway connects to, so it's reachable. Roads that are not cityroads should not count towards that, so buildings should not be able to spawn at the highway. Interestingly, this would make parallel lanes viable, which often exist for larger roads in cities...

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4812
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: In what method is road replacing written?
« Reply #18 on: July 27, 2017, 03:14:30 PM »
In Norway, the law states that unless indicated otherwise, there is an 80 km/h speed limit outside densely populated areas and a 50 km/h speed limit inside them. There is no explicit markings telling you when you enter or leave a densely populated area. However, the center line is drawn differently when the speed limit is 50 km/h or lower, and they generally place speed limit signs when you enter (with signs marking end of explicit speed limit on the obverse). There are rarely new signs reminding you that the speed limit is 50 or 80 km/h. Other speed limits are explicitly signed and are as far as I know based on a decision made for that particular place, not fixed rules. Dense urban areas tend to have a 30 km/h speed limit, using special speed limits signs that do not automatically expire at the next intersection. 40 km/h has become popular in the recent two-three decades for main roads through dense urban areas and near schools. 60 km/h and 70 km/h are frequently used where the population density is intermediate, as well as when other factors make 80 km/h unsafe. 90 km/h seems to be on the way out for roads that don't have a central reservation. 100 km/h require a central reservation, as do the even rarer 110 km/h speed limit. Roads with central reservation can still have a lower speed limit.

As such, it's not enough that buildings don't upgrade that road. Citybuildings require a road, which can be thought of as the road their driveway connects to, so it's reachable. Roads that are not cityroads should not count towards that, so buildings should not be able to spawn at the highway. Interestingly, this would make parallel lanes viable, which often exist for larger roads in cities...

It is natural that normal roads turn into city roads as cities grow. Especially early on in the growth process. Simutrans needs a third kind of road which is just an obstacle as far as the city rules are concerned, and which do not become city roads. However, every once in a while, newly built city roads should connect to the highways. Getting the AI to do this sensibly can be very tricky.

Offline Vladki

Re: In what method is road replacing written?
« Reply #19 on: July 27, 2017, 03:43:09 PM »
In case of the road which isn't a expressway, the max speed on the Japanese law is 60km/h a trunk road and a city road. But, in case of a city road, which the max speed is often specified 30km/h-40km/h.

In case of a road like these pictures, the max speed can't be taken out by a traffic jam. Because passage vehicles and the vehicles which goes in and out of the roadside facilities are blended, and for a flow to stop at the stoplight. On the other hand in case of the trunk road where it has little traffic volume such as the night or the suburb, the speed limit is often exceeded(Geschwindigkeits├╝berschreitung):-P
With max speed I was talking about the legal limit, not real possibilities due to traffic jam or midnight emptiness.