Re: [pygame] encrypt/decrypt zip/unzip

2014-08-26 Thread Dan Uznanski
 their reverse engineering,
 there's no point. This can be carried to absurd extremes, but you
 should offer new features that make the next release more valuable
 than reverse engineering.
 4 - Offer customization at rates so attractive that they'd rather pay
 you to build and support the enhancements.
 [...] 

 About py2exe, it is a really limited obfuscation cause it actually
 just stores the .pyc byte code files in a .zip archive. It means that
 you can unzip your .exe file and see what's inside, there's no
 protection at all. Though, the python byte code files offer a basic
 protection since you need to use some tools like uncompyle, pyretic
 or
 pycdc.

  I also clear the windows clipboard on every run of the main program
 loop thus preventing the user from taking screen grabs with print
 screen.
 This seems so wrong man, what if the user is trying to copy/paste
 anything while your program is running on the background?


 2014-08-25 23:06 GMT+02:00 Dan Uznanski duznan...@gmail.com:
  Why bother?  The average user won't care, the skilled users will
 see through
  your ruse like it's plastic wrap, and the ones who care but aren't
 that good
  will just find out what the skilled users did on the internet.
 The only
  thing you do by adding obfuscation is make it a little bit more of
 a pain
  for others to modify and improve your program, and make it a lot
 more of a
  pain for you to test your program.
 
 
  On Mon, Aug 25, 2014 at 4:04 PM, diliup gabadamudalige 
 dili...@gmail.com
  wrote:
 
  Thanks for the responses.
  Firstly I am a bit amused that everybody assumes that I am
 writing some
  kind of game. I never mentioned any game. Is it because of
 Pygame? :) :)
  I am using Pygame as my graphic interface because it is easy to
 display
  all graphics and music (with some MIDI) using Pygame.
 Incidentally I am
  writing a music teaching software.
 
  I use maketrans with a code string and then XOR the result using
 another
  string and then finally base64 it before writing it to disk. So
 all files
  look like - CSVT121rI_OQt%BIc.@lm and even if someone duoble
 click or
  change the file ext they can not open the file in anything other
 than a text
  file editor.
 
  If we keep the worst case scenarios out my majority users would
 be average
  computer users and I doubt somone taking the trouble to reverse
 engineer
  this software which is absolutely unknown. Maybe they will do so
 if it gets
  world famous ( :-) ) but then I will hire a professional team to
 encrypt it
  or I will use a dongle protection. But right now I am trying to
 close the
  files from prying eyes. When compiled with py2exe all the py
 files are
  strung together and one exe file is formed but all the assets
 remain in the
  folder with the same names inside the folder where the exe is. So
 anyone can
  simply copy the files and the text inside. But this way they have
 no access
  as the zip file is encrypted. If they crack that open then all
 the files are
  encrypted and the encrypted password is in another py file inside
 the exe.
  Isn't this some kind of protection against no protection at all?
 I also
  clear the windows clipboard on every run of the main program loop
 thus
  preventing the user from taking screen grabs with print screen.,
 These are
  taking into account THE THE AVERAGE USER.
  Considering the average user are the precautions I have taken
 fair? What
  do you think?
 
 
 
 
 
  On Mon, Aug 25, 2014 at 9:52 PM, Noel Garwick 
 noel.garw...@gmail.com
  wrote:
 
  Diliup,
 
  My understanding is that anything you load into memory can be
 dumped.  So
  if you're just using this to load all game assets at startup,
 people could
  extract the assets by duping what the interpreter has loaded
 into memory
  (the copies of the unencrypted files).
 
 
  On Mon, Aug 25, 2014 at 11:52 AM, Vincent Michel 
 vxgmic...@gmail.com
  wrote:
 
  the password is obfuscated and saved to a py file
  I'm curious about this part, how would you do that?
  Do you plan to distribute only your byte code and hope that no
 one will
  reverse it?
 
  Also, why do you need a double encryption? If you want to
 prevent people
  from browsing your package to find the end screen or whatever,
 isn't
  your first encryption enough?
 
  Anyway I think it's an interesting question, I mean, how
 important is it
  to obfuscate game data.
 
  Vincent
 
  On Mon, 2014-08-25 at 19:38 +0530, diliup gabadamudalige wrote:
   Having experimented with various methods to obfuscate image,
 audio and
   text files, store them in a zip file pw protect and then
 retrieving on
   demand  I finally did this.
  
  
   coder= a long string with a lot of characters ( written in a
 separate
   py file)
  
  
   strA = XOR(from_disk.read(), coder)
   str1 = XOR(strA,another_coder))
  
  
   encryption twice to obfuscate even more.
  
  
   with open(code_to_dir, wb) as to_disk:
   to_disk.write(str1)
  
  
   then i used win rar to write these files to disk as a pw

Re: [pygame] encrypt/decrypt zip/unzip

2014-08-25 Thread Dan Uznanski
Why bother?  The average user won't care, the skilled users will see
through your ruse like it's plastic wrap, and the ones who care but aren't
that good will just find out what the skilled users did on the internet.
 The only thing you do by adding obfuscation is make it a little bit more
of a pain for others to modify and improve your program, and make it a lot
more of a pain for you to test your program.


On Mon, Aug 25, 2014 at 4:04 PM, diliup gabadamudalige dili...@gmail.com
wrote:

 Thanks for the responses.
 Firstly I am a bit amused that everybody assumes that I am writing some
 kind of game. I never mentioned any game. Is it because of Pygame? :) :)
 I am using Pygame as my graphic interface because it is easy to display
 all graphics and music (with some MIDI) using Pygame. Incidentally I am
 writing a music teaching software.

 I use maketrans with a code string and then XOR the result using another
 string and then finally base64 it before writing it to disk. So all files
 look like - CSVT121rI_OQt%BIc.@lm and even if someone duoble click or
 change the file ext they can not open the file in anything other than a
 text file editor.

 If we keep the worst case scenarios out my majority users would be average
 computer users and I doubt somone taking the trouble to reverse engineer
 this software which is absolutely unknown. Maybe they will do so if it gets
 world famous ( :-) ) but then I will hire a professional team to encrypt it
 or I will use a dongle protection. But right now I am trying to close the
 files from prying eyes. When compiled with py2exe all the py files are
 strung together and one exe file is formed but all the assets remain in the
 folder with the same names inside the folder where the exe is. So anyone
 can simply copy the files and the text inside. But this way they have no
 access as the zip file is encrypted. If they crack that open then all the
 files are encrypted and the encrypted password is in another py file inside
 the exe.
 Isn't this some kind of protection against no protection at all? I also
 clear the windows clipboard on every run of the main program loop thus
 preventing the user from taking screen grabs with print screen., These are
 taking into account THE THE AVERAGE USER.
 Considering the average user are the precautions I have taken fair? What
 do you think?





 On Mon, Aug 25, 2014 at 9:52 PM, Noel Garwick noel.garw...@gmail.com
 wrote:

 Diliup,

 My understanding is that anything you load into memory can be dumped.  So
 if you're just using this to load all game assets at startup, people could
 extract the assets by duping what the interpreter has loaded into memory
 (the copies of the unencrypted files).


 On Mon, Aug 25, 2014 at 11:52 AM, Vincent Michel vxgmic...@gmail.com
 wrote:

 the password is obfuscated and saved to a py file
 I'm curious about this part, how would you do that?
 Do you plan to distribute only your byte code and hope that no one will
 reverse it?

 Also, why do you need a double encryption? If you want to prevent people
 from browsing your package to find the end screen or whatever, isn't
 your first encryption enough?

 Anyway I think it's an interesting question, I mean, how important is it
 to obfuscate game data.

 Vincent

 On Mon, 2014-08-25 at 19:38 +0530, diliup gabadamudalige wrote:
  Having experimented with various methods to obfuscate image, audio and
  text files, store them in a zip file pw protect and then retrieving on
  demand  I finally did this.
 
 
  coder= a long string with a lot of characters ( written in a separate
  py file)
 
 
  strA = XOR(from_disk.read(), coder)
  str1 = XOR(strA,another_coder))
 
 
  encryption twice to obfuscate even more.
 
 
  with open(code_to_dir, wb) as to_disk:
  to_disk.write(str1)
 
 
  then i used win rar to write these files to disk as a pw protected zip
  file with store as the comp. method.
 
 
  the password is obfuscated and saved to a py file
 
 
  Retrieving the files from inside the zip file was the only hitch as
  the python extract routine took a long time.
 
 
  this was solved by a great package at
  https://pypi.python.org/pypi/czipfile#downloads
 
 
  retrieval time increase by nearly/more than/almost 200 %.
 
 
  I would like to have your input on the above.
 
 
 
  Diliup Gabadamudalige
 
  http://www.diliupg.com
  http://soft.diliupg.com/
 
 
 **
  This e-mail is confidential. It may also be legally privileged. If you
  are not the intended recipient or have received it in error, please
  delete it and all copies from your system and notify the sender
  immediately by return e-mail. Any unauthorized reading, reproducing,
  printing or further dissemination of this e-mail or its contents is
  strictly prohibited and may be unlawful. Internet communications
  cannot be guaranteed to be timely, secure, error or virus-free. The
  sender does not accept liability 

Re: [pygame] Importing Graphics

2012-10-07 Thread Dan Uznanski
Pulling out graphics from files for older games can be hard - they're
often in hand-rolled compressed formats, depend on palette data that
isn't present in the same place as the actual images, etc, etc, etc.
I can't give proper general advice, because there are so many ways it
was done, but if all else fails you may get some mileage out of
chopping up screenshots.

Once you have images in a more portable format (I highly recommend png
because it's lossless and handles all sane situations well), you can
use them at your leisure using image.load.

And then you have another problem: copyright law.  Most games with art
you might want to use don't have a Creative Commons or other license
you can take advantage of to distribute /their/ art with /your/ game.

You'll probably find that rolling your own (simple) art will do you
more good, and will teach you more about how games are made so you
know what to ask for later when you do have an artist to ask for.

On Sat, Oct 6, 2012 at 3:25 PM, Owen Rexian outrex...@gmail.com wrote:
 there is no image.make_jazzy() method unfortunately, for good graphics you
 need a good artist.

 this 2d lighting style is cool though
 http://www.youtube.com/watch?v=GI63eeaXbWs


 On 6 October 2012 17:47, Ian Mallett geometr...@gmail.com wrote:

 On Sat, Oct 6, 2012 at 4:13 AM, shane shanevansh...@yahoo.com wrote:

 Hi

 thanks for all the imput, kinda browsed through the beginnings and its
 reasonably straight forward if you creating simple games such as hangman
 etc
 - just need to get to grips with the different meanings - and do a lot of
 practice

 but i see the graphics are very basic so how does one do decent graphics
 -
 im not talking quake quality but something a bit more believable - like
 lets
 say Simcity - and can graphics  from shareware etc be imported

 Do you mean like pygame.image.load(...)?




Re: [pygame] newbie who is lost asking for rescue party

2012-10-04 Thread Dan Uznanski
get python 2.7.3 32bit and pygame 1.9.1 built against 2.7.

On Thu, Oct 4, 2012 at 2:14 PM, SHANE VAN STRAATEN
shanevansh...@yahoo.com wrote:
 Hi

 no just downloaded it did not open it as when i was on site saw all these
 other files









 pygame-1.9.1.win32-py2.7.msi 3.1MB
 pygame-1.9.1release.win32-py2.4.exe 3MB
 pygame-1.9.1release.win32-py2.5.exe 3MB
 pygame-1.9.1.win32-py2.5.msi 3MB
 pygame-1.9.1.win32-py2.6.msi 3MB
 pygame-1.9.2a0.win32-py2.7.msi 6.4MB
 pygame-1.9.1.win32-py3.1.msi 3MB
 pygame-1.9.2a0.win32-py3.2.msi 6.4MB
 (optional) Numeric for windows python2.5 (note: Numeric is old, best to use
 numpy) http://rene.f0o.com/~rene/stuff/Numeric-24.2.win32-py2.5.exe
 windows 64bit users note: use the 32bit python with this 32bit pygame.

 There are some pre release binaries for 64bit windows, and for python 2.7 at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

 and as i said was advised to use the 2,7 version

 so thats when i kinda got confused and then there were other files om anothr
 page that said they had no scource code like the file i downloaded

 -- so as you have gone through what i must learn and im not looking to
 make a smash game more rpg  and small to start and get expierence what do
 you suggest if you had to start from the beginning

 i also got advice to download the latest version but then is it as supported
 as version 2.7

 Shane
 From: Owen Rexian outrex...@gmail.com
 To: pygame-users@seul.org
 Sent: Thursday, October 4, 2012 1:08 AM

 Subject: Re: [pygame] newbie who is lost asking for rescue party

 Not 100% sure what the problem is...

 So you have downloaded the binary, opened it up, and then what?

 On 4 October 2012 00:05, shane shanevansh...@yahoo.com wrote:

 Hi

 totaly a newbie in every sense

 was told to download 2.7 version but even when i go to instruction page i
 get lost again please some help

 i downloaded python-2.7.3 exe (15.5mb) what else do i need and where di i
 get it because there is a heck of a lot of files that i dont know what they
 mean or their purpose and it also talks of no scource code?

  *Windows Binary Installer*
 This is probably the most popular method of installation. If you are running
 on windows, it is highly recommended you use this form of installing. The
 installers come with with nearly everything you need, and have an easy point
 and click installers.
 The first thing you will need is an installation of Python. Python binary
 installers make it easy to get this done. Pygame binaries usually come for
 the latest 2 releases of Python, so you'll want to be fairly up to date.
 Once that is in place, you want to download the appropriate windows binary.
 From the pygame downloads page you can find the .EXE file you need. This
 will automatically install all of pygame and all the SDL dependencies. The
 windows binaries have filenames like this;
 http://www3.telus.net/len_l/pygame-1.8.0release.win32-py2.5.msi;. This
 would be the installer for pygame version 1.8.0, for Python version 2.5. You
 shouldn't have trouble finding the correct binary from the Windows section
 of the download page. http://www.pygame.org/download.shtml.
 You will also probably want to install the windows documentation and
 installation package. This will add easy links to the different
 documentation and games that come with pygame. The installer for this is
 found next to the other windows binary downloads. The filename looks like
 this; pygame-docs-1.8.0.exe. And this would install the documentation and
 examples for pygame-1.8.0
 One other thing the windows binaries are missing is the Numeric or numpy
 Python packages. You can easily install this separately and it will allow
 you to use the pygame surfarray module. This module is optional, so there
 is no need to do this. There are binary installers from the Numeric download
 page. http://sourceforge.net/project/showfiles.php?group_id=1369. A Numeric
 for Windows python 2.5 can be found on the download page:
 http://www.pygame.org/download.shtml.
 Numpy is newer than Numeric, so you should probably use that... however both
 are not entirely compatible. Instead of numpy you can also use PixelArray,
 which is built into pygame




 --
 View this message in context:
 http://pygame-users.25799.n6.nabble.com/newbie-who-is-lost-asking-for-rescue-party-tp209.html
 Sent from the pygame-users mailing list archive at Nabble.com.






Re: [pygame] Monospaced fonts are meant to be mono-spaced, right?

2012-05-14 Thread Dan Uznanski
Are you accounting correctly for non-integer character width?  If it's
always the same letter /position/ that's giving you trouble, then it's
possible that the width of the character is not an integer in that
size, and your text renderer may be accounting for that in ways that
your own program is not.

On Mon, May 14, 2012 at 9:25 AM, Nicholas Seward
nicholas.sew...@gmail.com wrote:
 The letters may be different lengths.  However, the letters should be
 spaced equally.  For example,i will be shorter than w but hit
 and hot should be the same length.

 On Mon, May 14, 2012 at 5:25 AM, Sam Bull sam.hack...@sent.com wrote:
 Before I go and file a bug against Ubuntu, can somebody confirm I'm not
 being stupid.

 For my input boxes, the cursor position depends on a monospaced font.
 This means I check the length of a rendered letter (e) using the font,
 and then set the cursor position as a multiple of this length.

 This worked fine before, but in Ubuntu 12.04, it no longer seems to be
 monospaced. Getting the length of the character e on my system gives
 me 9 pixels, but it seems that some characters, such as h, are 10
 pixels, which starts offsetting my cursor position and messing up my
 input box.

 The line I use to load the font is:
        pygame.font.SysFont(FreeMono, Monospace, 16)

 That should definitely return a monospaced font, right?

 And, the line used for getting the width is:
        mono_font.render(e, False, (0,0,0)).get_size()[0]

 Is this a bug, or am I doing something stupid?



Re: [pygame] [ROOKIE] Best way to manage jump movement

2012-04-20 Thread Dan Uznanski
If you want the merest touch of the jump key to cause a full strength
jump, just kick up the vertical component of the character's velocity
vector (ensuring of course that the character is not already jumping,
etc) and apply gravity normally.  If you want a longer keypress to
give a higher jump, the way I've always heard of is velocity change,
plus lowering the character's magnitude of gravity during the
keypress.

The big big important bit here is that the character has a velocity
and gets acceleration applied in his update call.  You'll also want
is_jumping and is_airborne flags; the former tells you whether you
should apply the gravity reduction, the latter whether it should be
checking for jump commands.

On Fri, Apr 20, 2012 at 4:58 PM, NesKy xavipotr...@gmail.com wrote:
 Hello everyone,

 I've been for some days trying to develop a canabalt-like game
 (http://www.canabalt.com/), saving distances... I've got the way to manage
 scroll, buildings appearances, distance between them, etc.

 Where I'm getting stucked is making the jump movement, and I left this for
 the last thing to do. What I'm trying to do is a basic jump movement where
 the more time you're pushing the button the more time you're jumping, with a
 limit of course. The player is always on the same x coordinate, so he only
 has to change the y in the way we want.

 So, the way I learned to manage all of this is with a player class and
 some methods to define actions (jump, prone, animation,...). Well, at this
 point I'm getting frustrated trying to do this with this tools. The only
 thing I achieve is jumping with the player MEANWHILE the key is pressed.
 And here is the thing: I cannot find the way to make the player jump with
 A TOUCH of a key.

 Thanks for your time (and sorry for my English! xD)


[pygame] Pygame crashes reliably when clicking away.

2012-03-17 Thread Dan Uznanski
I've started building a little pygame program.  Unfortunately I've
been having a huge problem: the second time I click out of the window
on another thing that completely obscures the pygame window, using
pygame.event.get() crashes with a segfault.

I'm running Windows XP/32 latest on 2009 mac pro hardware, Python
2.7.2, Pygame 1.9.1.

Here's code:

#---begin code---
import pygame
from time import sleep, time

start = time()
pygame.init()

SCREEN_SIZE = (640,480)

screen = pygame.display.set_mode(SCREEN_SIZE)

while True:
 for event in pygame.event.get():
   if event.type != pygame.MOUSEMOTION:
 print %0.3f % (time() - start), event
   if event.type == pygame.QUIT: exit()
 sleep(0.01)
# ---end code---

And here's logs of one attempt:

#---begin logs---
D:\vorndaC:\python27\python.exe cheese.py
0.156 Event(17-VideoExpose {})
0.156 Event(1-ActiveEvent {'state': 1, 'gain': 0})
1.344 Event(1-ActiveEvent {'state': 2, 'gain': 0})
5.938 Event(17-VideoExpose {})
5.938 Event(1-ActiveEvent {'state': 6, 'gain': 1})
5.938 Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})
7.109 Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})
Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support team for more information.
#---end logs---


Re: [pygame] Pygame crashes reliably when clicking away.

2012-03-17 Thread Dan Uznanski
After some poking I fixed it.  Had to nuke Python /and/ Pygame to do
so, which was no fun, and I'm still disappointed because I have no
idea what actually went wrong.

Dan

On Sat, Mar 17, 2012 at 3:51 PM, Dan Uznanski duznan...@gmail.com wrote:

 I've started building a little pygame program.  Unfortunately I've
 been having a huge problem: the second time I click out of the window
 on another thing that completely obscures the pygame window, using
 pygame.event.get() crashes with a segfault.

 I'm running Windows XP/32 latest on 2009 mac pro hardware, Python
 2.7.2, Pygame 1.9.1.

 Here's code:

 #---begin code---
 import pygame
 from time import sleep, time

 start = time()
 pygame.init()

 SCREEN_SIZE = (640,480)

 screen = pygame.display.set_mode(SCREEN_SIZE)

 while True:
  for event in pygame.event.get():
   if event.type != pygame.MOUSEMOTION:
     print %0.3f % (time() - start), event
   if event.type == pygame.QUIT: exit()
  sleep(0.01)
 # ---end code---

 And here's logs of one attempt:

 #---begin logs---
 D:\vorndaC:\python27\python.exe cheese.py
 0.156 Event(17-VideoExpose {})
 0.156 Event(1-ActiveEvent {'state': 1, 'gain': 0})
 1.344 Event(1-ActiveEvent {'state': 2, 'gain': 0})
 5.938 Event(17-VideoExpose {})
 5.938 Event(1-ActiveEvent {'state': 6, 'gain': 1})
 5.938 Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})
 7.109 Event(5-MouseButtonDown {'button': 1, 'pos': (356, 479)})
 Fatal Python error: (pygame parachute) Segmentation Fault

 This application has requested the Runtime to terminate it in an
 unusual way.
 Please contact the application's support team for more information.
 #---end logs---