Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'elif': 0.05; 'subject:Python': 0.06; 'mouse': 0.07; '#print': 0.09; '__name__': 0.09; 'latter': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; 'windows': 0.15; "'__main__':": 0.16; 'formatted': 0.16; 'formatting,': 0.16; 'pygame': 0.16; 'pygame.': 0.16; 'stuff.': 0.16; 'tab': 0.16; 'those,': 0.16; 'unlikely': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'bit': 0.19; 'drawing': 0.19; 'fit': 0.20; 'input': 0.22; 'example': 0.22; 'programming': 0.22; 'import': 0.22; 'install': 0.23; 'this?': 0.23; 'header:User- Agent:1': 0.23; 'copied': 0.24; 'looks': 0.24; 'question': 0.24; 'handling': 0.26; 'player': 0.26; 'pass': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'appreciated.': 0.29; 'especially': 0.30; 'code': 0.31; 'closer': 0.31; 'gaming': 0.31; 'libraries': 0.31; 'class': 0.32; 'extend': 0.32; 'thanks!': 0.32; 'quite': 0.32; 'linux': 0.33; 'guess': 0.33; 'screen': 0.34; 'trouble': 0.34; 'skip:_ 10': 0.34; "i'd": 0.34; 'basic': 0.35; "can't": 0.35; 'info': 0.35; 'common': 0.35; 'possible.': 0.35; 'skip:s 30': 0.35; 'something': 0.35; 'objects': 0.35; 'requirement': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'edge': 0.36; 'idle': 0.36; 'interaction': 0.36; 'library.': 0.36; 'done': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'similar': 0.36; 'button': 0.38; 'to:addr:python-list': 0.38; 'planning': 0.38; 'heard': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'space': 0.40; 'how': 0.40; 'remove': 0.60; 'read': 0.60; 'future': 0.60; 'most': 0.60; 'tell': 0.60; 'making': 0.63; 'email addr:gmail.com': 0.63; 'kind': 0.63; 'face': 0.64; 'charset:windows-1252': 0.65; 'header:Reply-To:1': 0.67; 'of:': 0.68; 'physics': 0.68; 'press': 0.70; 'reply-to:no real name:2**0': 0.71; 'game,': 0.84; 'self.run()': 0.84; 'received:89': 0.85; 'engines.': 0.91; 'subject:Game': 0.91; 'subject:Development': 0.95 Date: Sat, 08 Jun 2013 14:52:53 +0300 From: Jan Riechers User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python Game Development? References: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> In-Reply-To: <25a7393d-f8dd-4f75-925f-89df31930d71@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: janpeterr@freenet.de List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 104 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370694642 news.xs4all.nl 15988 [2001:888:2000:d::a6]:41903 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47380 On 07.06.2013 18:53, letsplaysforu@gmail.com wrote: > I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: > > • Pygame - As far as I know it's dead and has been for almost a year > • PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > • Cocos2D - Won't install and cant find any support > • PyCap - Can't find any documentation > • Panda3D - Dead since 2011 + overkill for what I need > • PyOpenGL - Overkill > > Any help on what to do with this would be appreciated. I am making games mainly in Lua but I'd like to make one in Python for fun. I also understand that Python isn't exactly the *BEST* choice programming a game, but I have heard it is possible. Tell me if it's true. Thanks! > Hi, I only have looked closer in pygame. But before asking for an general overview of possible gaming libraries, I would start to answer the question of what kind of game you want to make and what features do you really need. For some space game for example it is most unlikely that you will face the requirement of having a bleeding edge physics engine. Especially if you make use of 2d objects versus 3d models of any type. I guess you can expand the latter to any extend here. Also it is a common thing I might guess bravely, that the basics of game programming are done similar in all game engines. - Setting up a game loop - Calculation present and future ob objects - Handling user input by using events - Redraw the screen And this is in pygame quite simply, but I also had trouble finding the right entrance to it, as you have to read a bit up on how components fit together in that library. An example basic setup looks like (with classing), I remove my code and limited it to basic event/input handling and also the drawing of a screen object in which you can add images and stuff. Sorry for the formatting, I copied from idle and formatted in my email client. #---------------------------------------- class gameApp: def __init__(self): pygame.init() self.clock = pygame.time.Clock() self.screen = pygame.display.set_mode( (640, 480), DOUBLEBUF|SRCALPHA ) self.run() def run(self): while not self.close_app: self.clock.tick(60) for event in pygame.event.get(): #print event if event.type == KEYUP: # Press tab for player info if event.key == 9: pass # Do something in tab key elif event.type == MOUSEBUTTONDOWN: if event.button == 1: pass # Left click, mouse button is pressend elif event.type == MOUSEMOTION: mx = event.rel[0] my = event.rel[1] continue elif event.type == QUIT: self.close_app = True self.screen.fill( (0,0,0) ) # Self interaction is a screen drawing object self.screen.blit(self.interactions, (0,0), special_flags=BLEND_RGBA_ADD) pygame.display.flip() pygame.quit() if __name__ == '__main__': import pygame from pygame.locals import * gameApp() #---------------------------------------- Regards Jan