I am thinking of making a simple game with Unity. The aim would be to keep a person healthy by feeding it well balanced food and drinks.

Rather than hard codding every single type of food or drink I can think of I was thinking of letting the player choose any type of food he wants and then screen the internet for it's calorific value, saturated fat, sugars etc ...

This would make the game much more enjoyable than being limited by the foods I can think of.

I was wondering how you would go about doing that ? Could I use an API to extract data from google or wikipedia.

I noticed that when you type "[food] calories" in Google you get a return from the Wikipedia page like this:

enter image description here

Obviously, there is a way of extracting the data from Wikipedia and I could automate the searchs by taking the player's entry as a string and running a search with it.

How would one recommend going about this ? Also, is it safe ?


  • 1
    \$\begingroup\$ I suggest you do the searches yourself and have your game clients connect to your own database. And record all the searches done by your clients to guide you on how you could improve the content of the database. You could even try to partner with companies like 'My Fitness Pal' and use their calorie counter database :P \$\endgroup\$
    – Vaillancourt
    May 25, 2017 at 12:08
  • \$\begingroup\$ Thanks, this is meant to be a personal hobby project to get use to querrying the internet for info. \$\endgroup\$
    – Sorade
    May 25, 2017 at 12:10
  • \$\begingroup\$ You might want to look into what the Google API offers you. Keep in mind that it has rate limits. If you decide to scrape data from Wikipedia, keep their license terms in mind. \$\endgroup\$
    – Philipp
    May 25, 2017 at 12:11
  • 1
    \$\begingroup\$ Remember, just because something is in a game doesn't necessarily mean a game developer is the relevant expert to ask about it. Very few game developers are also experts in online nutritional databases. If you want to know about what APIs exist that you can query for food information (and what licenses may govern use of that data) you'll likely do better asking on a nutrition / food science site. \$\endgroup\$
    – DMGregory
    May 25, 2017 at 15:41


You must log in to answer this question.

Browse other questions tagged .