Possibility and Probability

A Python programmer with a personality thinking about space exploration

23 May 2006

A good example of data-driven Python

by Nick

Have you ever had something on the tip of your tongue, but you just couldn’t get the words out? I felt that way with a Python program I’ve been knocking around with for a while now (its an RPG that I swear I’m going to finish some day…). Every time I looked at the code I kept thinking that there must be a way to make it more data driven (like in the book Game Programming with Python), but I just kept hitting sticking points. The other day on the Pygame Mailing list, I saw this post describing a simple, elegant, data driven solution for an RPG. I was floored. This code helped me bridge a couple of different ideas together. I had read about making items flexible by making them via “instance relationships” (i.e. damage objects can inflict damage onto breakable objects). I thought it was a really interesting idea, but hadn’t really thought much about how to bring it to life. At any rate, this chunk of code was a real inspiration and I thought I would share it in case anyone else is curious about integrating data driven concepts into their code. Check it out!

tags: