-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow separate control of parking lanes on 1-way streets. #516
Comments
The back end interface sets/unsets parking based on direction. fixing this requires fixing the interface and making the old interface obsolete. |
According to the parking code I think that both sides of the street are park-able.
|
Basically there should be an icon for each parking lane on a road segment Similar to how Speed Limits tool works when in "lane-wise" mode. So if a road has 3 parking lanes, even if it's one-way road or whatever, there would be 3 parking icons, one for each parking lane. |
@aubergine10 This requires a MAJOR change to back end in a way that it may not be backward compatible. The current backend uses the serialization format is:
Backward compatibility is tricky here. I should check version and load based on version because XML stores based on variable names
EDIT: with also may need a ConvertIndex(segmentId, laneIndex)// convert lane index to first, second third ... to reduce the size of the array above. Do you agree with this? |
Ah, I hand't considered that it would require changes to the data persisted in savegame. There's still lots of people moving over from v10 and then sometimes try reverting back to v10 if they run in to problems. Should we delay making changes to a later version? |
I can provide backward compatibility. But this issue in whole should be handled separately than #702 . Its just too many things at once. What should the interface look like though? EDIT: we could have a 32bit flag variable for each landIndex so its not much of a memory.
This way there is no need to have a loop to go through all lanes to see which one is a parking lane. |
What happens if some lunatic creates a road that has > 32 lanes? (I've no idea if there's a limit on the number of lanes - what size is the integer used by prefabs to index lanes?) |
There is no limit for lanes and number of lanes is always calculated on demand (not cached/ hardcoded) |
@aubergine10 @krzychu124 LaneIndex is byte size.
then the parking will not work lol! and users will not be surprised! it will work though because usually the parking lanes are in the first 4 lanes ( the first 2 are pedestrian). but that's not always the case. If I want to go in a loop for a 32 lane in every simulation step that is not going to look good. its better if the parking didn't work in crazy case rather than the game running slowly. the flag can be 64 bit. |
OK an array of 64 bit flags then how is that @aubergine10 . the loop that way is going to be small for the first 64 lanes :). |
I was joking lol. One thing to check before implementing the 32-bit flag thing is how will it affect pathfinder? Does it need to factor in which side of road the vehicle is on as to which side it looks for parking on? Depends what info it already has at that point (like lane index and segment id?) as to what the impacts could be. |
@aubergine10 lol! It works. lane index is available to path/parking finder as you can see in the code i provided in #516 (comment). Speaking of the witch GetClosestLanePosition is really slow for this part of the code. remember when you were complaining it reduced FPS when I used this to improve precision of vertical hitpoint in the lane connector? |
some UL roads are acting weird see #708 (comment) and #708 (comment) the parking lanes has direction=both: |
This is almost certainly root cause of #366 as well. What value should the setting have? It's something that I should note in our guide to asset authors. |
Forward or backward. matching the nearby lane. |
I'd like to provide support for For example, in #366 I noticed that vehicles were doing 180 degree turn to park 'facing wrong way' in adjacent parking lane. And another user noted that cars were facing same direction on both sides of road. So from end-user perspective at least, there is the issue in which way the vehicles are facing when they park. Also, I think it would still be cool - for one or two lane roads where I suspect But, on the other hand, we can't get all the asset authors to correct their roads in the workshop. Maybe we have single pass of networks when a city loads and try and detect issues like this and correct them where possible? Usually parking is at outer edge of road, and thus easy to determine which way it should face either by looking at adjacent lane or just determining what direction traffic would flow on that side of road. But there are some unusual roads with parking in the middle, eg. between two medians, or adjacent to middle, eg. next to a central median, that might prove more difficult to correct. The speed limits manager already has to scan all networks (#510, #513) to determine which are viable for speed limits (as we were getting all sorts of weird things showing speed limits signs in default speed limits UI, eg. decorative networks). Maybe we split that out in to a central network validator that is used to supply a ready-made, and auto-corrected where possible, list of network prefabs to all tools? We could also, as part of that, create bitmasks that describe what lanes are available (eg. #516 (comment)). |
@aubergine10 I don't think direction will matter when I use laneIndex for the backend. that is why I mixed it with this issue.
I think maybe we can cache
|
Why would we do stuff at runtime? And why store distance? When a city loads, or as it's loading (but only after mods like NExt2 and CSUR have added their roads), we could just scan all the network prefabs:
Then if we know what lane a vehicle is driving on, we can get the id of it's best choice parking lane. But if we're going to do that, why not plan to create our own representation of a netinfo (etc)? Like, there's loads of info in a prefab that TM:PE, pathfinder and vehicle AIs just don't care about. We could create a compact descriptor with data structure that's optimal for what TMPE, AIs and pathfinder need. Each time we find an expensive calculation that could be done in advance and cached, we can update our descriptor to contain the computed info = start reducing needless per-frame and/or per-vehicle calculations = faster framerate. |
@aubergine10
You have asked several questions about the code in the link I think you should have a look at the code. EDIT:
Yes that exactly what I meant. calling it cache was poor wording on by behalf. |
Is randomization the correct approach? I think for small roads where But for most roads, particulalry anything with more than 2 lanes of oncoming traffic, it seems odd to encourage cars to go wandering - perhaps for quite some distance - for a turning point and then drive all the way back just to reach parking spot on the other side of road. |
the randomizer is not even based on the position of the car. its based on segment center +random displacement vector. If I am not mistaken its better to just choose a random parking lane. do we even consider the length path the car has to travel to reach to the parking? because to me it seems to be purely based on distance of the car position to center position of the segment with parking. it is not necessarily the same segment the car is parked in. the code I mentioned is in an spiral loop:
By that time the road side does not matter anymore I guess. |
I am so going to create our own representation of a netinfo to solve this issue. its going to save both memory and speed :) |
It's something this mod has needed for long time. By doing some processing up front we can probably drastically reduce per-frame processing in many places. Really looking forward to seeing what you come up with. |
the speed limit tool can modify default speed limits. it has its own representation of a netinfo. I just need to extend it. Alternatively each manager can have its own representation of netinfo. it does have the advantage of making each manager self sufficient but it makes information sharing a bit harder. |
I'd prefer a "single source of truth" net info otherwise we end up having to constantly grab from different lists rather than just one list. In my mind it would work something like this:
Also, thinking this forward, if we start allowing lane customisation (eg. the ability to turn bike lane in to parking lane or turning lane...) we'd might need a You could then take that even further that we could start adding or removing lanes. :) And if you take that even further, given some 'chunks of mesh and textures' we could actually generate our own road meshes/textures based on our special netinfos. Instead of subscribing loads of roads, users could create their own road prefabs in-game, like "I'll have a road this wide with pavement either side and a median and three lanes each way with tram tracks on the innermost lane and paint it in style of US road markings and maybe some shrubs to make it look nice". It would be like Network Skins on steroids; instead of just making minor changes, you could build completely custom roads and even bundle them in the savegame file to make it shareable. |
No idea what we'd call "our net info" so just referring to it as
|
@aubergine10 whats that ? a linked list? I think an array based on We have ExtSegmentEnd, ExtSegment so why not ExtNetInfo? it extends netInfo after all. in speed limit
|
Yes, I assume each segment on the map has it's own copy of the netinfo? So it can be customised on segment by segment basis (in much same way network skins can change trees for individual segment)? |
@aubergine10 The way NS2 works is that for every new skin, it creates a new Skin instance which can be shared by multiple segments. There is an array of segmentId->Skin. each skin is based on a NetInfo. multiple Skins can be based on the same NetInfo. In TMPE we do not want to do that. we want one ExtNetInfo instance per NetInfo instance. With the exception of |
On one-way streets, only a single parking icon appears which affects parking on both sides of street.
Would it be possible to get more granular control so each parking lane can be toggled independently?
EDIT: We could also support parking for lanes with m_direction=both . see #516 (comment) this has to be removed after fix : https://github.com/CitiesSkylinesMods/TMPE/wiki/Notes-for-Asset-Creators#parking-lanes
The text was updated successfully, but these errors were encountered: