0

I'm using pygame with python2.7, and I have a game I want to finish up but have a problem.

I don't want to distribute the .ogg files in a way that would be easy for the player to steel, because lets face facts, ssteel sounds is what cheap knockoff games do best.

Anyway, rant aside, all of the methods I have mentally come up with so far either involve: 1. Encrypt the files and make the game unencrypt them into a new file[bad, person can just copy unencrypted file while game running] 2: using a dictionary to store them in a sounds.dat file and then write sounds to file when needed [bad, still can delete, and sounds.dat with pickle is 3 times the size, say hwaa?]

So now I'm stuck. How can I either make it so all my sounds are stored in one dat file, and pygame can still play them without blowing my game to like 10 times its size, or, how can I ensure my files are encrypted. In an ideal world, I am looking for an answer where the sounds are encrypted, and yet pygame can still play them. Thank you

ndmeiri
  • 4,878
  • 12
  • 33
  • 42
  • 2
    Are you using `pygame.mixer.music.load` to load the music files? If so, [according to the docs](https://www.pygame.org/docs/ref/music.html#pygame.mixer.music.load), it can take a file object in place of a file. Have you tried just giving it a `StringIO` (or `io.BytesIO)`? – abarnert Jul 22 '18 at 20:08
  • If your program can decrypt / read the files from somewhere, anywhere, so can ANOTHER program that copies some of your functions. There really is no point, other than making it very slightly more difficult. So don't complicate yourself too much, choose the simplest method that adds the minimal necessary complication for the user to "steal" the files, and expect them to be stolen anyway. – Ofer Sadan Jul 22 '18 at 20:09
  • 2
    Anyway, this really isn't going to be hard to defeat if anyone really does want to steal your music. The encryption key is going to be in your Python code for anyone to find. Or they can just `pdb` your game and grab the buffer out of memory. – abarnert Jul 22 '18 at 20:09
  • hi, I'm actually using pygame.mixer.Channel(chan).play – lara stardust Jul 24 '18 at 00:47
  • And my intention is to turn it into a py2exe at the end so... That would keep the key hidden unless they reverse engineered, which is a lot more effort than the casual steeler is willing to put in, I hope? – lara stardust Jul 24 '18 at 00:49

0 Answers0