• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Zyndrof

Members
  • Content count

    214
  • Joined

  • Last visited

Community Reputation

163 Neutral

About Zyndrof

  • Rank
    Member
  1. Hi there! My short term goal is to create some kind of side scroller game in Python using Pygame. I wonder what basic skills are needed before atempting this task. What kind of programming knowledge/understanding do I need? How can I practise these techniques? Thank you!
  2. One thing you should think about is using much more whitespace to make your code more readable. A very short example: class main(): def Main(): while True: print "Hello" class somethingElse(): def haha(): while True: print "Haha" class ... ...is less readable than: class main(): def Main(): while True: print "Hello" class somethingElse(): def haha(): while True: print "Haha" class ... Ofcourse I don't make a point in my example. But try it in your code and see a difference :)
  3. Quote:How much do you pay? I don't pay you anything, I don't need the help that badly that I'm willing to pay a large some of money on it. But I do want to learn, and having someone to close at hand is great. I don't know yet how much I will contact you, but I promise I will try to solve the problem myself at first, and keep trying after I've contacted you. I have experienced the "kick" of solving a bad ass problem myself, and I prefer it that way. But not knowing exactly what a sprite is or why function calls aren't behaving the way I expect them to (since I have experience in some other languages, e.g. PHP) causes some problem when I think I need them.
  4. Hello there! I've been programming for about a year, and recently I moved into Python using Pygame. I have a lot of experience from web development, e.g. PHP, but little understanding of OOP. This causes me some trouble and I would like someone that's able to help me through MSN messenger when I have some quick questions or easy errors that I don't fully understand. All I ask is that you are competent in OOP and have experience with Python and Pygame. And even though I'm usually a fast learner it wouldn't harm if you where pedagogical. :) Thanks! /Zyndrof
  5. Restart: I did a function for this that caused me some problems. When a user won, the game restarted after the 2 seconds I wanted it to, BUT the last selected field wasn't filled. So I diched that code, at least for now. About filling the entire board: I didn't even think of ending the game in the occurance of a tie. Will look into that.
  6. Thank you! I will take that into account and rewrite the game so that it can have more than three rows. You could for example have four or five rows.
  7. Hi! I just finished my first complete pygame application and I'm pretty happy with the way it turned out. But, I feel it loads very slow and before I start my next project I would like you to help me review my coding style and give some tips and pointers on what to look out for, what to keep doing and so on. Well, you've got more experience than I do, so I just post my code of 273 lines and you can browse it if you like. Oh, and it's a Tic-Tac-Toe game ^^ Thank you! :) # Import and initialize pygame import pygame pygame.init() # Set up the window SCREEN = pygame.display.set_mode( ( 302, 302 ) ) pygame.display.set_caption( "Tic-Tac-Toe" ) BACKGROUND = pygame.Surface( SCREEN.get_size() ) # Keep track of what fields are marked and which ones # are not. SEL_FIELD = ["", "", "", "", "", "", "", "", ""] # Who is playing? PL = "1" # Is the game over? GAMEOVER = False def createFields(): FIELDCOLOR = (255, 255, 255) FIELDSIZE = pygame.Surface( ( 100, 100 ) ).convert() # Create and draw the upper row FIELD1 = FIELDSIZE FIELD1.fill( FIELDCOLOR ) SCREEN.blit( FIELD1, ( 0, 0 ) ) FIELD2 = FIELDSIZE FIELD2.fill( FIELDCOLOR ) SCREEN.blit( FIELD2, ( 101, 0 ) ) FIELD3 = FIELDSIZE FIELD3.fill( FIELDCOLOR ) SCREEN.blit( FIELD3, ( 202, 0 ) ) # Create and draw the middle row FIELD4 = FIELDSIZE FIELD4.fill( FIELDCOLOR ) SCREEN.blit( FIELD4, ( 0, 101 ) ) FIELD5 = FIELDSIZE FIELD5.fill( FIELDCOLOR ) SCREEN.blit( FIELD5, ( 101, 101 ) ) FIELD6 = FIELDSIZE FIELD6.fill( FIELDCOLOR ) SCREEN.blit( FIELD6, ( 202, 101 ) ) # Create and draw the bottom row FIELD7 = FIELDSIZE FIELD7.fill( FIELDCOLOR ) SCREEN.blit( FIELD7, ( 0, 202 ) ) FIELD8 = FIELDSIZE FIELD8.fill( FIELDCOLOR ) SCREEN.blit( FIELD8, ( 101, 202 ) ) FIELD9 = FIELDSIZE FIELD9.fill( FIELDCOLOR ) SCREEN.blit( FIELD9, ( 202, 202 ) ) def clickedWhatField( ( POSX, POSY ) ): # Recives the x and y position of the cursor and # returns the fieldname. global PL, GAMEOVER # Who is playing? CURRENT = PL if POSX >= 0 and POSX <= 100: if POSY >= 0 and POSY <= 100: FIELD = 1 elif POSY >= 101 and POSY <= 201: FIELD = 4 elif POSY >= 202 and POSY <= 302: FIELD = 7 elif POSX >= 101 and POSX <= 201: if POSY >= 0 and POSY <= 100: FIELD = 2 elif POSY >= 101 and POSY <= 201: FIELD = 5 elif POSY >= 202 and POSY <= 302: FIELD = 8 elif POSX >= 202 and POSX <= 302: if POSY >= 0 and POSY <= 100: FIELD = 3 elif POSY >= 101 and POSY <= 201: FIELD = 6 elif POSY >= 202 and POSY <= 302: FIELD = 9 # Send the information if not GAMEOVER: markField( CURRENT, FIELD ) def markField( PLAYER, FIELDNUMBER ): # We need global access to the player tracker global PL, SEL_FIELD, SCREEN # Assign the field to the current player. FIELD_IS_SET = SEL_FIELD[ FIELDNUMBER - 1 ] if len( FIELD_IS_SET ) == 0: SEL_FIELD[ FIELDNUMBER - 1 ] = "PL" + PLAYER # Set up variables PLACEMENT = 0 LOCATION = "" if PLAYER == "1": LOCATION = "data/player1.png" PL = "2" else: LOCATION = "data/player2.png" PL = "1" # Set the placement variable if FIELDNUMBER == 1: PLACEMENT = ( 0, 0 ) elif FIELDNUMBER == 2: PLACEMENT = ( 101, 0 ) elif FIELDNUMBER == 3: PLACEMENT = ( 202, 0 ) elif FIELDNUMBER == 4: PLACEMENT = ( 0, 101 ) elif FIELDNUMBER == 5: PLACEMENT = ( 101, 101 ) elif FIELDNUMBER == 6: PLACEMENT = ( 202, 101 ) elif FIELDNUMBER == 7: PLACEMENT = ( 0, 202 ) elif FIELDNUMBER == 8: PLACEMENT = ( 101, 202 ) elif FIELDNUMBER == 9: PLACEMENT = ( 202, 202 ) try: IMAGE = pygame.image.load( LOCATION ).convert() SCREEN.blit( IMAGE, PLACEMENT ) # Did anybody win? checkWin() except: print "Couldn't load image" def checkWin(): """ Checks if there is a winner and in that case, show it """ global BACKGROUND, GAMEOVER WINNER = "" # Check if player 1 has three in a row. if SEL_FIELD[0] == "PL1" and SEL_FIELD[1] == "PL1" and SEL_FIELD[2] == "PL1": WINNER = "PL1" elif SEL_FIELD[3] == "PL1" and SEL_FIELD[4] == "PL1" and SEL_FIELD[5] == "PL1": WINNER = "PL1" elif SEL_FIELD[6] == "PL1" and SEL_FIELD[7] == "PL1" and SEL_FIELD[8] == "PL1": WINNER = "PL1" elif SEL_FIELD[0] == "PL1" and SEL_FIELD[3] == "PL1" and SEL_FIELD[6] == "PL1": WINNER = "PL1" elif SEL_FIELD[1] == "PL1" and SEL_FIELD[4] == "PL1" and SEL_FIELD[7] == "PL1": WINNER = "PL1" elif SEL_FIELD[2] == "PL1" and SEL_FIELD[5] == "PL1" and SEL_FIELD[8] == "PL1": WINNER = "PL1" elif SEL_FIELD[0] == "PL1" and SEL_FIELD[4] == "PL1" and SEL_FIELD[8] == "PL1": WINNER = "PL1" elif SEL_FIELD[2] == "PL1" and SEL_FIELD[4] == "PL1" and SEL_FIELD[6] == "PL1": WINNER = "PL1" # Check if player 2 has three in a row. if SEL_FIELD[0] == "PL2" and SEL_FIELD[1] == "PL2" and SEL_FIELD[2] == "PL2": WINNER = "PL2" elif SEL_FIELD[3] == "PL2" and SEL_FIELD[4] == "PL2" and SEL_FIELD[5] == "PL2": WINNER = "PL2" elif SEL_FIELD[6] == "PL2" and SEL_FIELD[7] == "PL2" and SEL_FIELD[8] == "PL2": WINNER = "PL2" elif SEL_FIELD[0] == "PL2" and SEL_FIELD[3] == "PL2" and SEL_FIELD[6] == "PL2": WINNER = "PL2" elif SEL_FIELD[1] == "PL2" and SEL_FIELD[4] == "PL2" and SEL_FIELD[7] == "PL2": WINNER = "PL2" elif SEL_FIELD[2] == "PL2" and SEL_FIELD[5] == "PL2" and SEL_FIELD[8] == "PL2": WINNER = "PL2" elif SEL_FIELD[0] == "PL2" and SEL_FIELD[4] == "PL2" and SEL_FIELD[8] == "PL2": WINNER = "PL2" elif SEL_FIELD[2] == "PL2" and SEL_FIELD[4] == "PL2" and SEL_FIELD[6] == "PL2": WINNER = "PL2" # Did anybody win this time? if WINNER == "PL1": # Create a label FONT = pygame.font.Font( None, 36 ) TEXT = FONT.render( "Player 1 wins!", 1, ( 10, 10, 10 ) ) TEXTPOS = TEXT.get_rect() TEXTPOS.centerx = BACKGROUND.get_rect().centerx TEXTPOS.centery = BACKGROUND.get_rect().centery SCREEN.blit( TEXT, TEXTPOS ) # End the game GAMEOVER = True elif WINNER == "PL2": # Create a label FONT = pygame.font.Font( None, 36 ) TEXT = FONT.render( "Player 2 wins!", 1, ( 10, 10, 10 ) ) TEXTPOS = TEXT.get_rect() TEXTPOS.centerx = BACKGROUND.get_rect().centerx TEXTPOS.centery = BACKGROUND.get_rect().centery SCREEN.blit( TEXT, TEXTPOS ) # End the game GAMEOVER = True def main(): # Set up the background information global BACKGROUND BACKGROUND = BACKGROUND.convert() BACKGROUND.fill( ( 0, 0, 0 ) ) SCREEN.blit( BACKGROUND, ( 0, 0 ) ) # Create the fields createFields() # Create key variables to set up the main loop KEEPGOING = True CLOCK = pygame.time.Clock() # Set up the main loop while KEEPGOING: # Set frame rate CLOCK.tick( 30 ) # Event handling for event in pygame.event.get(): if event.type == pygame.QUIT: KEEPGOING = False elif event.type == pygame.MOUSEBUTTONDOWN: clickedWhatField( pygame.mouse.get_pos() ) # Refresh the screen pygame.display.flip() # Only run the program from within main if __name__ == "__main__": main() [Edited by - Zyndrof on August 2, 2007 7:14:17 AM]
  8. Aha, I see. Thank you :)
  9. Hi! Short question: I have a vriable defined on module level, in a function at the same level i have an if-statement that reads from that variable. When done I want the variable's value to change, so I set the new value and it works inside that function. But the next time the loop runs my function, the value of the variable is the default again. My code looks somewhat like this: [source lange="python"]var = "1" def lookIntoVar(): if var == "1": print var var = "2" else: print var var = "1" Why is Python behaving this way, and how do I solve my problem?
  10. Well, I'm going to the university to study economics. The latest cutting edge technology is really not required. Programming is mainly a hobby for me. Therefore I don't want to learn a hundred different programming languages. I'm happy with one for each task, and Python seems simple and is cross platform and maybe it doesn't require any special installations on the users computer? Can I create for example a .exe file containing all the information that is needed for a Windows user to run my game without having either Python or pygame installed?
  11. I have set up Eclipse and it seem to work. But it doesn't get code completion for pygame. What do I need to set up for this to work?
  12. Hello there! I'm in the need of a free Python IDE that supports code completion or intellisence. I would like it very much if it supports extensions as well, like pygame and wxpython extensions. I have found great use of intellisence when programming in Visual Studio and Zend Studio and feel handicapped without it. I would also like support for projects. Thanks in advance!
  13. Hi there! After a while of using Python I have came to wonder what power Python really posesses in the art of game development. I have noticed that Python programs run pretty slow, at least the ones that uses wxPython. What kind of games can you make and which ones are not recomended? How easy is it to to 3D in Python? Does the no-variable-declaration usually become a problem in larger applications or is it something one can live with? Can I use Pygame for a side-scroller game or is this really not recomended (this is what I've read), 'cause if I do 2D I really want to create side-scrollers and nothing else. Thank you in advance!
  14. Quote:Original post by Paige Hi, two quick questions. Are all these videos exclusively for C++? And they are C++-only, how hard is it to transfer your knowledge from a C++ video to C#? Thank you. ~Paige Check out the webcasts from MSDN.
  15. Well, I'm working mainly in PHP at the moment, so case-sensitivity isn't any problem. It's just that I have my own way of writing code, and function names allways start with an uppercase letter, whilst variables never do.