Monday, September 11, 2023

The Streets of San Francisco Game

I know the names of nearly 1/5th of the streets in San Francisco. Which is incredible - especially when you consider I've never been to San Francisco. Luckily my hitherto unbeknownst knowledge of the names of San Franciscan roads makes me a God of SF-Street-Names

SF-Street-Names is a surprisingly fun map game in which your only requirement is to name streets in the Golden City. SF-Street-Names consists of an unlabeled map of San Francisco. Your job is to just type in the possible name of any San Francisco street. If you type in a correct name the street will then become labeled on the map and you score will increase.

I loved SF-Street-Names as a concept so much that I immediately started thinking about how I could replicate this for other cities. SF-Street-Names is built on top of Mapbox GL. Which means that you might be able to create a game like SF-Street-Names using the 'in' expression to check names and add place-name labels to the correctly identified street. 

For example you could check a user's entry and if they 'type' Mission color the Mission Street green on the map using the following expression,
'line-color': [ 
  ['in', 'Mission', ['get', 'name']], '#3DDC97'
However I can also think of a number of problems of using expressions to check and respond to user inputs (for example having to set up a bounding box to only check and color the correct results within San Francisco and not the rest of the world).

This is why I suspect that a more brute force method might be a better approach to creating a game like SF-Street-Names. For example you could download the polylines and names of every street in San Francisco from OpenStreetMap. You could then create a separate variable for every street name. It would then be relatively easy to check user inputs against these variables and change the map and increase the user's score when they enter a correct street name.

However I really don't want the unnecessary effort of having to write my own code. My fervent wish is for the developer of the game to create a GitHub repository for SF-Street-Names so that anybody can clone the map and adapt it to work for other cities around the world.

Update: I've stolen the SF-Street-Names idea for my own game - Streets of Winchelsea. This is a smaller game in which you have to name the 17 streets of Winchelsea in East Sussex. The game will probably have limited appeal. I suspect it will only be completed by one or two of the 600 people who actually live there.

If you want you can clone the map on Glitch here. All you need to make the game work for a different location is to update the street data in the places.js file

Spoiler Alert

Despite only knowing the street names of 'Haight', 'Ashbury', 'Lombard' and 'Mission' I was able to guess the names of nearly 19% of San Francisco's streets. My tips for scoring reasonably well (even if you don't know San Francisco) is to think about how much Americans like to use a numbering system for their street grids and to think about which dead presidents are likely to have been memorialized by having streets named after them. 

If you enjoy playing SF-Street-Names as much as I did then you might also like Noah Veltman's History of San Francisco Place Names map. The History of San Francisco Place Names is one of my favorite interactive maps of all time. The map explains the toponym and origin of many San Francisco street names. Click on a highlighted street on this interactive map of San Francisco and you can discover who that street was actually named for.

No comments: