Getting comfortable with Python in TouchDesigner can feel like and stop-and-go process. You go through some tutorials, feel great, then you’re encountered with a project and end up overwhelmed. The problem here is that it’s hard to simulate the complexity of a project’s state machine at home, and it’s incredibly boring. One of the things I always recommend is setting mini challenges for yourself and developing your skills by building things instead of staying purely in learning-mode. Here’s some great challenges to try!
Build a game
You might be surprised that building a game is a great Python challenge but there are few things that really make you grind out the details and edge cases like a small game. Now these games don’t have to big open world MMORPGs or anything like that. Simple games are a fantastic way to challenge yourself. Think of even something as simple as tic tac toe and think about how you would manage all of the states and moves from Python and have those interact with the drawing of that game. The steps you’d have to go through would include:
- Deciding who’s turn it is and keeping track of that
- Figuring out what positions are available to have pieces put in them
- Figuring out how to get an input data stream to allow the user to place pieces
- Checking for win conditions on every move
- Checking for draw conditions on every move
- Resetting the board after a win or draw
That alone would be great Python practice because you would quickly feel the issues in the system by playing the game a few times. And you’ll have the additional challenges of making sure your Python scripts interact with the TouchDesigner environment in a stable way. This is really where you test your metal.
Here’s some good challenges to try:
- Tic tac toe
Connect to APIs for Data Driven Art
APIs are great way to test your Python chops. You’ll need to go through the process of:
- Establishing a connection to the API
- Authenticating yourself to do certain actions in the API
- Parsing the data from it’s JSON or other format
- Cleaning of the data, replacing special characters, rounding numbers, etc
And once you’ve gone through that essentially in Python then you can finally use the data in some meaningful way in the network. This ends up being a great test of not only manipulating data in Python but also managing and storing large amounts of data inside of TouchDesigner.
Great APIs to test:
- Twitter (has both search-based queries and live-streaming connections)
Get Our 7 Core TouchDesigner Templates, FREE
We’re making our 7 core project file templates available – for free.
These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.
They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.
Build reusable “blackbox” tools
One thing you might not have thought of as a good challenge on the Python side of things is making a solid and reliable blackbox set of tools. If there are visual effects you like using or connection to APIs or other processes, you can wrap them inside of a Container COMP. From there you’d find a surprising amount of Python work to fully make that tool a blackbox. That’s the important part here. You want to make the tool in a way that is bulletproof and no one will ever need to look inside. This usually involves:
- Having a solid way to initialize a tool when it first is loaded into a network
- Having a robust way to reset everything with a click of a button
- Exposing parameters as custom parameters and linking those internally
- Creating extensions for more advanced functionality and programmability by others
- Being able to quickly expose help documentation or notes for other users
Once you get through all these, you’d be surprised by how many Python scripts and processes you’ve built into even the simplest of tools! This self-test also has the benefit of resulting in a nice little toolkit that you can use on your own work and projects!
Getting your Python skills intro project-ready levels can be difficult. Not only can it be boring to practice Python but it also ends up never being the same as a real project. With the challenges laid out above not only can you have a bit of fun while practicing your Python, but you’ll be practicing those skills in ways that are similar to how you would actually use them in a project. Enjoy!