News:

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

In what method is road replacing written?

Started by THLeaderH, July 16, 2017, 03:57:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

Roads in a city district are automatically replaced by cityroads under certain conditions. In what method is this replacement process written?

An_dz

If I'm not mistaken it's either in wegbauer or simcity. Perhaps in weg

Ters

As far as I can tell, city road construction takes place when buildings are built. Several classes are likely involved.

Dwachs

Parsley, sage, rosemary, and maggikraut.

DrSuperGood

QuoteRoads 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.

THLeaderH

Thank you for your advices, everyone 8)
I found this part of code in stadt_t::build_road(). It's simcity.cc::L3318~L3325

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?

Dwachs

replacement is done here: bool process_city_street(grund_t& gr, const way_desc_t* cr)
Parsley, sage, rosemary, and maggikraut.

THLeaderH


prissi

#8
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.

An_dz

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.

THLeaderH

QuoteI 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.

An_dz

Ok, I'll focus on the graphics, I still need to create the global object.

THLeaderH

QuoteEDIT: 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.

Ters

Quote from: prissi on July 18, 2017, 05:18:59 AM
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?

rapidliner

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

Vladki

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.

rapidliner

#16
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

Leartin

Quote from: Vladki 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.

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...

Ters

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.

Quote from: Leartin on July 27, 2017, 09:26:46 AM
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.

Vladki

Quote from: rapidliner 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
With max speed I was talking about the legal limit, not real possibilities due to traffic jam or midnight emptiness.

Sent from my ONEPLUS A3003 using Tapatalk