So I picked up a copy of the Generative Design book, and I’ve been trying to recreate the Intelligent Agent script (P.2.2.2) as a pure TD OPs network. It’s not so easy. Yes, I downloaded the .toe file that recreates it with Python, but my thought was that TD is meant to be a visual programming language, so it should be able to replicate simple programs like this one using the built-in OPs, right?
I am wondering if there is something fundamentally different about programming with nodes that makes it impossible (or just a bad idea) to make complex behavior using OPs? Like the way the script steps through and executes each line of code, or how parts of the script loop back and change itself.
So, I guess what I’m doing is trying to maximize my general TouchDesigner skill before I start using Python to solve everything. But maybe that’s not necessary…
Generally our procedural networks (by themselves) are optimized for one way data flow, but scripts and higher order languages have a natural advantage in implementing loops, recursion and feedback.
You can setup feedback using Feedback CHOPs, or Execute DATs that push data back to the start of a network on specific events, etc, if you want to stay away from scripting solutions.
Replicator Components, and Copy SOP stamp() functions probably are our closest analog to loops and iterations.
Hope that helps,
Rob.
Thanks, Rob, that definitely helps me understand the sandbox I am playing in a little bit more.
Here is a followup question to all you python experts: Do you find that, knowing python, you tend to use it for most things in your TD projects? Or do you still find it useful to use OPs networks to build?
I use Python for just about everything, but I also use OPs for tons of things. I think you should definitely learn Python, it’s an extremely readable programming language supported by quite a number of programs as their scripting language. You’ll quickly realize what tool is the best tool for the job at hand.
Thanks for your input! I guess my priority should be to go through these exercises and learn how the python scripts are working, rather than to worry about how to accomplish things in the non-programmer’s world that I am more comfortable with.
Ya, the CodeAcademy courses are pretty good if you’re just starting Python, as well as being easy to jump in and out of quick sessions, although they’re based on Python 2.7 instead of Python 3, so you’ll run into little things that you’ll have to change to make what you learn work in 3, but not that much.
There is a simpler Python example project in the 088 shared component section of the forum that might be easier getting you started off using Python to talk between OPs in simple steps, then you can build from there.
If you can do everything easily in Python already, why not? Consider TouchDesigner your modular real-time IDE that can also be used to make other graphical and 3d things really quickly that you wouldn’t want to do in Python alone. In my mind the goal is the get to the end goal as quickly and efficiently as possible, whatever the means!
I am having trouble with the passing of information from chops into a simple bit of python and out into chops again. or maybe a table.
I have put together some complex python code in the past. The challenge for me rite now being new to touch designer is how to move information from one for to another.
some tasks i would love to see an example file cover is simple things like…
Listen to 2 chops when value A is less than B return -1, equal return 0 and return 1 when A is grater than B. Then export this information to a chop.
write to some tables via python.
Another question is with python, using python dictionarys to store data, having the ability to listen to chops and write to chops… is the need for DAT operators greatly reduced?
I am stuck at this beginning stage where i don’t know quite how to relate to touch designer not understanding how to flow in and out of the processing languages and not getting the momentum to make the art i want. Coming from 9 years of houdini it is hard to be lost in something that is so close to what you know but not quite.
I find the documentation confusing and non intuitive to learn, but i am open to blaming to not being in the rite head space for TD.
At first I tried to solve this with the chop execute dat. However I wasn’t able to get both channels coming into the valueChange() at once. So i mangled the expression chop to do the bidding. Like houdini, many ways to skin a cat.
This also demonstrates a handy way of putting your logic into functions that are easier to write than one liners. pythonexample.toe (3.99 KB)