You've just stepped through the process of including an API call into your local game script. Way to go!
As you know by now, you'll have to train each skill a lot to solidify your knowledge. With that in mind, you'll pick another API for your next task and incorporate its functionality into your game.
The Internet is full of data and offers a large chunk of it through freely accessible APIs. You'll find some links to aggregated API resources at the bottom of this page.
Possible API Ideas
If you're stuck coming up with an idea for an API call that you could include in your project, then you can get some inspiration from the suggestions below. Feel free to use something completely different, however! The most important part is that it's interesting for you to work with and that it adds a new aspect to your game, even if it's just a very small one, like the random name generator that you implemented earlier in this section.
You could include:
- Weather information: Create in-game weather based on the actual weather of your players and allow them to find different items depending on the weather.
- Location information: Combine location information with a real-time weather API. Ask your players where they are, then use the response of the API calls to influence the gameplay.
- Name meanings: Instead of assigning your players a random name, look up the meaning of their real name and add a fitting modifier to it, e.g., "..., the Brave".
- Word meanings: Allow your players to find items with strange names. Add the possibility to look up the meaning of these words through an API.
- Recipes: Give players the possibility to look up recipes from the food items they collected.
- Conversations: Display real-life social media conversations that your players can listen to.
- Translations: Give players a choice to read your game instructions in different languages.
Some of these tasks will be easier to implement than others, and it'll depend to a large degree on the API that you choose. To get started, pick an API that:
- is free to use
- doesn't require authentication
- has well-made and well-maintained documentation
You'll make your task more manageable if you select your API according to these criteria.
Of course, if you feel brave and curious and you have an idea in mind, then go ahead and implement it even if the API you want to use doesn't make it quite as straightforward as the Uzby API you've worked with before.
Note: If you choose to work with an API that requires authentication, make sure to keep your API key information out of your production code. You can do this, for example, by adding it as an environment variable.
The best way to learn new skills and train them is to follow your interest and keep putting in the time and effort.
Additional Resources
- API list: Free APIs
- Dev.to: 10 fun APIs to use for your next project
Once you've incorporated your new API functionality into your game code, make sure to share it on Discord.