I had a fairly interesting bug today.
When going to cast a second spell the grid targeting was hitting every previous unit and position.
I tracked it down to the fact that I made a copy of the executing object.
Now I made a copy to it so that it wouldn't interfere with the objects on the unit. So why did that cause more problems?
Because in my code for the object I would say add 3 units to a list. Because its a shallow copy it would also add it to the previous object. And you cant use deep copyies as that would duplicate the units.
However when I went to clear the list to reset it I just created a new one like self.list = []
So what it did was clear the copied variable and not the original. Thus making the copy actually made things worse as it made the copy interfere in only some ways. So I just removed the copy method and things started working again.
This is an interesting bug because I could have clearly spent less time on it and still fixed it by clearing the list. But I spent the extra time to actually remove the copy method because I knew that would cause me trouble in the future if I didn't
It should be noted though that the actions must be updated to deal with repeated use for example on my move object. This is however much more simple and better than trying to debug the copying stuff. Either could be done, but the latter is like doing security in php
Sunday, January 4, 2009
Saturday, January 3, 2009
Updates to voices
I went back and forth for a long time on how to best do conversations.
I tried just a long mp3, but the timing was too variable.
I wanted something that was simple to where a whole bunch of text doesn't have to be put in to start a conversation.
I ended up with adding a name to the scripting event and have the conversation be that in order. So the first one is convo1, second is convo2, etc.
And then to top it off I wrote
To automatically generate some espeak voices. Then you can import the list in audacity. and batch convert them to ogg files and you are good to go.
I tried just a long mp3, but the timing was too variable.
I wanted something that was simple to where a whole bunch of text doesn't have to be put in to start a conversation.
I ended up with adding a name to the scripting event and have the conversation be that in order. So the first one is convo1, second is convo2, etc.
And then to top it off I wrote
unitmap = {fighter1:"en\\en-sc+m3",fighter2:"en\\en-sc+m2",alluvia:"en\\en-sc+f3",oath:"en\\en-wm+f3",balla:"en\\en-n+f3"}
name = "convo"
y = 1
for x in convo1:
if isinstance(x, tuple):
toex = 'C:\\eclipse\\eSpeak\\espeak.exe -w C:\\eclipse\\eSpeak\\'+name+str(y)+'.wav -a 50 -v '+unitmap[x[0]]+' "'+x[1]+'"'
os.system(toex)
print toex
y +=1
To automatically generate some espeak voices. Then you can import the list in audacity. and batch convert them to ogg files and you are good to go.
Thursday, January 1, 2009
Further adventures in sound
It looks like the latest versions of pygame's music module don't work well with py2exe. So if you wanna hear the music for now the executable wont work.
Subscribe to:
Posts (Atom)