Coder Social home page Coder Social logo

silentdjay / mapstery Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 10.42 MB

A geography game inspired by my long history of spending hours on end staring at maps

Home Page: http://silentdjay.github.io/Mapstery/

HTML 0.93% TypeScript 97.31% CSS 1.76%
countries geography-game maps geography google-maps lng lat geolocation reverse-geocoding

mapstery's People

Contributors

dependabot[bot] avatar silentdjay avatar wbruntra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mapstery's Issues

Make the 'Explore the Map' feature more obvious

User Feedback suggests that users want the 'Explore the Map' feature, but they can't find it. Make it more obvious!

Ideas:

  • Make the overlay less opaque
  • Make the button more obvious
  • Change the button text

Google Maps API update broke US States gameplay

in the address component that the US States version of the game uses to match the destination state, the short_name attribute has been changed in the Google Maps API. Here is the new version, for formatted_address: "Kentucky, USA":

0: {long_name: "Kentucky", short_name: "Kentucky", types: ["administrative_area_level_1", "political"]}

Previously, the short_name would have been KY.

Interestingly, in other address components, like this one, for formatted_address: "Leeco, KY 41301, USA", the short_name is still the state's abbreviation:

2: {long_name: "Kentucky", short_name: "KY", types: ["administrative_area_level_1", "political"]}

EVERY instance of `"[State], USA" has the same data pattern. This inconsistent behavior seems like a bug on Google's side of things.

long_name: "Kentucky", short_name: "Kentucky" is simply messy data, not to mention that it's inconsistent with corresponding address components found in the varying levels of addres specificity that Google returns.

Display current game category between games

this is a useful piece of information to know when making the 'New Game'/'Play Again' decision

idea:

  • replace the 'distance from click' data with the current game category once the current game is over

Establish 'countries' gameplay categories/filters

Allow a user to decide, for example, whether they want to only play with countries that are above a certain geographic area or population size. Similarly, there could be a 'small countries' only mode.

Add scale to map

To make the 'click distance from target' measurements more relevant and useful.

Add more fun data to bonusCountryData

The new version of restcountries provides all sorts of fun information that could be included in the game, like

  • official languages
  • web domain
  • area
  • population density (calculate it)
  • regional blocs
  • native name
  • gini index

incorporate some or all of these into the bonus country data

Improve click distance hint

The click distance hint should

  • mention the geographic center of the country, rather than the country as a whole
  • when the calculated distance is less than a mile (possible for very small countries), say 'less than a mile from...' instead of 'about 0 miles from...'

create visual to illustrate distance to target from last click

it's unclear to just about every user how far away the last click was relative to the current zoom level of the map - they only know if they are closer or farther away.

Perhaps you can also change the colors of the click labels based on how close the guess was to the target.

Make Mapstery playable in different languages

Once we have at least one set of translation strings available, incorporate it into the game, with a flag icon that allows a user to select their preferred language.

Also, including a 'play Mapstery in a random language' option would be fun.

Unclaimed Territory Logic is Broken

Previously, the geolocation data that Google Maps delivered would return a consistent data payload for a click that didn't return country data. Now, the logic returns information about some bodies of water (and possibly other features). I've seen click data returned for the following geographic features:

  • Pacific Ocean
  • Indian Ocean
  • Atlantic Ocean
  • Mediterranean Sea

There are bound to be others. It appears that the "types" : [ "establishment", "natural_feature" ] feature is new. I should leverage that to fix the functionality for a non-counting click.

Here is an example of the payload for a click on the Mediterranean Sea:

/**/_xdc_._1qu7rv && _xdc_._1qu7rv( {
   "plus_code" : {
      "global_code" : "8F8X9488+4R"
   },
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Mediterranean Sea",
               "short_name" : "Mediterranean Sea",
               "types" : [ "establishment", "natural_feature" ]
            }
         ],
         "formatted_address" : "Mediterranean Sea",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 45.7600288,
                  "lng" : 36.1979765
               },
               "southwest" : {
                  "lat" : 30.26984689999999,
                  "lng" : -6.004411999999999
               }
            },
            "location" : {
               "lat" : 34.5531284,
               "lng" : 18.0480105
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 45.7600288,
                  "lng" : 36.1979765
               },
               "southwest" : {
                  "lat" : 30.26984689999999,
                  "lng" : -6.004411999999999
               }
            }
         },
         "place_id" : "ChIJnzxHHLghFBMRQPjM_opZky4",
         "types" : [ "establishment", "natural_feature" ]
      }
   ],
   "status" : "OK"
}
 )

This requires a fix.

Translate Mapstery

Restcountries provides many translated names for each country. We can use those to make non-english versions of the game. Attached is a document containing translation strings.

Mapstery_translation_strings.xlsx

Feel free to add any translations you can!

No country data for some clicks

Clicks on Guernsey, Gambier Islands, and others(?) generate "Cannot read property 'formatted_address' of undefined" errors

natural_features fixes

  • fix the logic for the 'The' prefix on 'natural_features' clicks

  • clicks on natural_features without country info count toward the click total. (they shouldn't)

Fix deployment

yesterday's deployment (May 22) didn't work - the previous version of the application is still live on mapstery.org. dunno why. Fix that.

Set reveal zoom level based on size of target country

land area is included in the data payload for restcountries. Use it to dynamically calculate an appropriate google maps zoom level per target country - so that the entire country fills an appropriate amount of the screen and the country's map label is visible.

Some addresses with 'country' address data also contain `natural_feature` data

Initially I assumed that any address that included a 'natural_feature' component would not reveal any country data, so I dismiss it based on that fact. I need to introduce more logic to filter that address information and determine the country clicked.

here's an example of returned address information from a click on Ngazidja, Comoros. There are many more examples - including one in Cape Verde

        "address_components" : [
            {
               "long_name" : "Ngazidja",
               "short_name" : "Ngazidja",
               "types" : [ "establishment", "natural_feature" ]
            },
            {
               "long_name" : "Ngazidja",
               "short_name" : "Ngazidja",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Comoros",
               "short_name" : "KM",
               "types" : [ "country", "political" ]
            }
         ],

Click on `#proceed_button` when starting US states gameplay hides 'Click to start playing' button

proceed_button

When clicking on the #proceed_button <div> after selecting the US States gameplay (on either side of the button), the 'Click to start playing' button is hidden and the user cannot proceed to play the game. The rest of the contents of the modal remain and continue to cover the map.

While the #proceed_button <div> is also present on the corresponding screen for the Countries of the world game, the same does not happen.

SEO this badboy up!

I have put absolutely no effort into SEO for mapstery.world. Make some basic changes and watch the users flood in!

Save game data on a user's device

localstorage could be leveraged to make the gameplay more engaging.

Some ideas:

  • keep track of the user's 'streak' of countries found with 3 or fewer (?) clicks
  • do a 'campaign mode' where the user needs to find all countries (in a specified order)

Make the game easier for beginners

Even the easiest categories of the game are probably too difficult for beginning geographers.

One potential idea - include a selection on the welcome screen whether or not to include the borders on the satellite map (defaults to 'not').

Unclaimed/disputed territories don't return any address data upon click

Clicks on these territories do not return country/any results from the Google Maps API:

* Arunachal Pradesh (far northeastern India)
* Crimea
* Kosovo
* Palestine
* Jammu and Kashmir (far northern India) - there are a LOT of separate disputed territories up there
* South Ossetia (Georgia)
* Abkhazia (Georgia)
* North Cyprus
* Southern Kuril Islands (North of Sapporo)
* Western Sahara

Additional examples can be found on this list: https://en.wikipedia.org/wiki/List_of_territorial_disputes

To address this, choose which country you want them to belong to (or report them as 'Unclaimed Territory' and include it in the list of potential countries(you'll need to differentiate this from clicks on bodies of water)) OR approximate their locations with lat/lng and in the case that no data is returned within that approximate area, provide data accordingly.

Add relevant stats during gameplay

When a user is presented with a new target country, let the user know how many clicks it takes to find this country on average - we can likely leverage the PostHog API for this, based on an existing insight.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.