Commit Graph

4908 Commits

Author SHA1 Message Date
Dustin Carlino
a6520b26c0 Omit trip timeline buttons to jump to the beginning/end of a trip in freeform mode. When you reset there, the sim is empty; there's no scenario. So it'll just crash, because the person doesn't exist. 2020-08-15 11:14:13 -07:00
Dustin Carlino
a70131b629 While hovering on turn icons in map-space, highlight the intersection and offset in the side panel to help orient. Little laggy, but worth it... 2020-08-15 11:04:22 -07:00
Dustin Carlino
3623296548 Improve rendering of multiple traffic signals in the side-bar by
"compressing" empty space between intersections. The result is a little
unexpected sometimes, but it's an improvement over the previous thing.
@michaelkirk suggested a variation in Slack that I'll try soon.
2020-08-15 10:40:15 -07:00
Dustin Carlino
83e84c10af Handle more errors in importer. Got the entirety of Taiwan to import...
but the water polygons are so sad. :(
2020-08-15 09:36:23 -07:00
Dustin Carlino
100d126d62 Also lazily render road center-lines. London from 42s down to 32s 2020-08-14 20:57:46 -07:00
Dustin Carlino
49ea9f2d54 Faster London:
- wire up the flag to skip building contraction hierarchies in one-shot
  importer. 406s to import london without, 230s by skipping CH
- lazily render zoomed parking lot details. 72s and laggy X11 mouse
  before, 42s and no GPU melting after
- add my script for stress-testing the importer
2020-08-14 20:50:22 -07:00
Dustin Carlino
5bede4aca2 Start some initial UI for tuning offset of multiple intersections 2020-08-14 20:50:13 -07:00
Dustin Carlino
3f86af0dc0 Add back some primitive control for signal offset at a single
intersection. Interpret the value in the simulation layer again (it was
removed around bb3da1f8eb or so due to
being unused).
2020-08-14 20:50:13 -07:00
Dustin Carlino
e6c1d960ec In traffic=none mode, allow recording (most of) the manually specified
trips as a Scenario to later re-run. This is useful for quickly defining
"test cases" for development, and it's a start to a UI for letting
players specify (and eventually share) traffic patterns they define.
2020-08-14 18:53:39 -07:00
Michael Kirk
3ed8b9cf81 Fix glium build, which was broken with: 85ad194d
85ad194d introduced a patched winit.

In the glium build, we were pulling in a second version of winit (the
unpatched version, via glutin). This caused conflicts between the data
types, breaking the build.

Apparently the proper way to specify a patch like this, usable by
transitive dependencies, is via cargo's "patch" specifiers
2020-08-14 15:11:49 -07:00
Dustin Carlino
377e154a1c Refactor the Transition enum, collapsing enum variants that were
combining primitive transitions into sequences.

Brief context on the state/transition system: The game crate is
organized as a stack of states, with the topmost one being active.
Transitions manipulate this stack. For example, the stack might look
like: [main menu, sandbox mode, edit mode, traffic signal editor, signal
picker]
2020-08-14 14:38:50 -07:00
Michael Kirk
e5b08c71c0 Fix HiDPI screens for wasm
Fixes upstream winit bug
2020-08-14 14:13:18 -07:00
Dustin Carlino
bc858fdbb3 Work around a crash on the intersection demand panel, reproducible by
watching https://www.openstreetmap.org/node/53214134 on the weekday
scenario. At some point, an arrow polygon with an inner ring is scaled
down, collapsing its points so much that the ring becomes invalid.
2020-08-14 12:09:06 -07:00
Dustin Carlino
25ee39af89 Prepare to flag-guard an experiment to handle uber-turns differently
when allowing a car to start a turn. It causes
https://github.com/dabreegster/abstreet/pull/276#discussion_r470269394
and also the lakeslice scenario to gridlock (a regression that began a
few weeks ago). But keep the flag on for now, to keep the montlake
scenaro running at least.

https://dabreegster.github.io/abstreet/trafficsim/gridlock.html has
notes about the many different causes and in-progress fixes for
gridlock. This experiment hasn't been explained very well yet, but
roughly it treats a cluster of traffic signals as one, so that once a
vehicle gains access through the first light, they guarantee immediate
access through the entire sequence. This interacts with the "don't block
the box" behavior (don't start a turn if you might get stuck in the
intersection) strangely.

While attempting to get this rollback to work, I also had to manually
redraw the traffic lights for a few manually specified intersections.
They became out-of-date a few weeks ago when I cleaned up the OSM
geometry upstream and the referenced IDs changed, and I hadn't bothered
to re-time the signals. Luckily, with the new multi-signal editor,
redrawing the timing was much easier than originally!

Regenerated all data and lots of bus routes vanished. Plan to get back
to that project soon.
2020-08-14 11:33:25 -07:00
Dustin Carlino
b8e9155ada Adjust picker UI 2020-08-13 15:12:03 -07:00
Dustin Carlino
340d61d33e Refactor how signal editor applies a single new change 2020-08-13 15:12:03 -07:00
Dustin Carlino
92a7279a44 Just warn when lining up phases for multiple signals. Not sure what the
UX should look like for undoing the synchronization.
2020-08-13 15:12:03 -07:00
Dustin Carlino
06c7beb369 Proper UI for picking multiple traffic signals to edit together 2020-08-13 15:12:03 -07:00
Dustin Carlino
d7eb07502b Reorganize signal editor code into some submodules 2020-08-13 15:12:03 -07:00
Dustin Carlino
91f0076d35 Remove the old TrafficSignalEditor, cut over to the new variant for both individual and multiple signals 2020-08-13 15:12:03 -07:00
Dustin Carlino
dcc7ff9e72 Add back the "Edit entire signal" menu, only when editing one
intersection.
2020-08-13 15:12:03 -07:00
Dustin Carlino
c84833feb4 More steps on the multi-signal editor, adapted from the old editor:
- Add a header to the side panel
- Prevent leaving the editor with missing turns
- Apply edits properly when leaving
2020-08-13 15:12:03 -07:00
Michael Kirk
535ebe127c fixup to 1d46845d 2020-08-13 14:18:47 -07:00
Dustin Carlino
11cefb118a And the same thing for OriginalIntersection
Actually, don't need to regenerate map data. Thanks to the magic of
zero-cost wrapper types, the binary format is the same.
2020-08-13 11:48:13 -07:00
Dustin Carlino
843d24b6ed Refactor: OriginalBuilding should just be OsmID. The purpose of
OriginalBuilding was to refer to buildings in a stable way across
different maps and across OSM updates. Recently, OsmID and friends
appeared. The double layer of wrapping is an annoying API.

Not regenerating map data yet; about to do the same thing for
OriginalIntersection
2020-08-13 11:37:06 -07:00
Dustin Carlino
1d46845dc9 Upgrade glow. No noticeable change on Linux, might help on Mac. 2020-08-13 08:26:49 -07:00
Dustin Carlino
f70d01626f Fix bug introduced in 9ce7ab1c88. Don't
cache intersection_type in DrawIntersection; it changes when converting
stop signs<->traffic signals<->closed for construction.
2020-08-13 08:21:27 -07:00
Dustin Carlino
d9da24b3d1 Work around the initial window size being wrong by reseting the minimap
when the window is resized. This is a bit unexpected if done
interactively in-game, but not unreasonable.

This mostly fixes the issue that sometimes happens starting with --dev.
When the resize happens late on X11, the minimap looks initially better,
but still cut off horizontally. Zooming in and out fixes it. (Before,
even zooming in/out would keep it tiny, because base_zoom was never
reset.)
2020-08-13 08:15:21 -07:00
Dustin Carlino
58849d3d15 Small refactor: in most places, we can actually use String as the error type; Box<dyn Error> is only useful when errors of different types are propagated.
Nowhere in abst do we care about handling different errors differently
2020-08-13 07:12:06 -07:00
Dustin Carlino
eca71d27c9 tiny cleanup: use ScreenPt for canvas cursor 2020-08-12 17:53:17 -07:00
Dustin Carlino
ae18b09b3b refactor separators 2020-08-12 16:46:11 -07:00
Dustin Carlino
9af8aafb44 now that we're drawing lots in the multi-sig editor, cache it 2020-08-12 15:50:23 -07:00
Dustin Carlino
e4a2f35bb0 glue more basic functionality to the multi-sig ed 2020-08-12 15:50:23 -07:00
Dustin Carlino
490471848a copy over lots of the misc functionality to the new multi-signal editor 2020-08-12 15:50:23 -07:00
Dustin Carlino
ca501b7b80 initially synchronize all signals in a group 2020-08-12 15:50:23 -07:00
Dustin Carlino
5803e5721e add turn icons to the new multi-signal editor 2020-08-12 15:50:23 -07:00
Dustin Carlino
c08e244d23 tiny start to a new multi-intersection traffic signal editor. just get
the left panel to display some kind of merged view
2020-08-12 15:50:23 -07:00
Michael Kirk
62828e1ffa revert wasm shader changes. unfixes DPI2 devices, but fixes DPI1 devices 2020-08-12 15:44:48 -07:00
Michael Kirk
abe1f051eb code review: make more things private, remove unused method 2020-08-12 15:44:48 -07:00
Michael Kirk
4d3194c362 Revert "DO NOT MERGE: web logging"
This reverts commit fecfad72806b095e8477d983dc69f1275422a90f.
2020-08-12 15:44:48 -07:00
Michael Kirk
5c8ccef970 DO NOT MERGE: web logging 2020-08-12 15:44:48 -07:00
Michael Kirk
05f1a0332b glow backend compiles, but untested
These are my best guess at the changes to get glow working with the DPI changes.

Currently on master, on macos at least, building the glow backend
launches a blank screen. That's not resolved by this PR, so all these
changes are untested.
2020-08-12 15:44:48 -07:00
Michael Kirk
58d360668e add glow feature 2020-08-12 15:44:48 -07:00
Michael Kirk
32a92c0d76 wasm backend 2020-08-12 15:44:48 -07:00
Michael Kirk
f7f4fd889e consolidate screenspace and mapspace methods since they now behave the
same.

rg -l screenspace_svg | xargs sed -i .bak 's/screenspace_svg/load_svg/'
rg -l mapspace_svg | xargs sed -i .bak 's/mapspace_svg/load_svg/'
2020-08-12 15:44:48 -07:00
Michael Kirk
f42b7c003c layout uses logical pixels, not physical
Previously it was not clear (to me at least) when a value used
in layout was in units of logical pixels vs physical pixels.

This lead to some ambiguity about where to scale values, and lead to
some values being scaled more than once or sometimes not at all, leading
to inconsistent layouts across DPI's.

The intent of this change is to solve this ambiguity by having the ui
clients work *exlusively* with logical pixels.

To achieve this, we consolidate all scaling to the graphics backend.
We translate all PhysicalPositions from the windowing libraries to
LogicalPixles.

Our own types: ScreenPt, ScreenDim, etc. are all in logical units.

In some places, I replaced passing raw floats with a corresponding
Screen* type to clarify that the units are in logical pixels.
2020-08-12 15:44:48 -07:00
Dustin Carlino
9ce7ab1c88 defer drawing intersections, same as lanes. faster startup time and melts my GPU less trying to load london and tokyo 2020-08-12 11:17:06 -07:00
Dustin Carlino
3b49353df2 gracefully degrade if we cant make TurnGroups for a traffic signal. this
gets SF, Tokyo, and London to import!!!
2020-08-12 11:05:19 -07:00
Dustin Carlino
7a0dbb28b1 handle some rendering failures, getting new orleans to load 2020-08-12 09:47:35 -07:00
Dustin Carlino
62bb82886d blaze through all the crazy errors in intersection_polygon, just
recording errors and falling back to circular geometry and not trimming
roads

also filter out highway areas like
https://www.openstreetmap.org/way/132705692, woops!

Manchester and NOLA now import...
2020-08-12 09:36:46 -07:00