"Top Three Motivators For Developers (Hint: not money!)" is a good blog post about some motivators that I'd suggest for looking into what some people may want. Péter Török's answer about a difference in the world would fall under the purpose part of things.
I'd be tempted to think of this through a pair of different views:
Selfish -> This would be where I'd want to focus on my wants, needs and desires which could vary over time and experiences. What makes me happy or fulfilled that I do for self-gratification which could be about technical stuff, greed or who knows what else.
Selfless -> This is the area Péter Török covered pretty well in terms of making the world a better place.
For myself, mastery comes down to a few things. Practice is part of what I'll need as I want to experiment different ideas to see what works or doesn't work and so having room to allow for mistakes would be a nice benefit. A second part is getting that feedback of what worked well and what didn't work as if I'm always just working on the next thing and not having any feedback or time for reflection that may create some resentment to my mind. Lastly, there is that sense of accomplishment that comes from being able to see the difference between where I am and where I was. For example, if something now takes me just a hour or two but used to take me a week to do that is really cool.