• 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.


  • Content count

  • Joined

  • Last visited

Community Reputation

277 Neutral

About mrpeed

  • Rank

Personal Information

  • Interests
  1. If I see no reason for something to be a property over a method should I favor making it a property or a method? For example, I can see no benefit in doing a "full" property over a "is_full() method", other than not having to write (). I can understand if full started as a regular variable and was expanded to a property later, but it wasn't. So in that case what would you say?
  2. Yes, I am initializing that in the __init__ method. And makes sense, I decided to remove the is_full() check from each method and have the inventory size enforced outside of the inventory class. This also removed a lot of clutter from my methods which is good. I was wondering if you can clarify when to use properties? I tend to avoid them because I feel like they are misleading. For example, @property def full(self): return len(self.items) >= self.max_inventory_size Doesn't this hide the fact that this is a method? Would a user not think this a regular variable and possibly try to assign to it? I have other methods labeled get and set throughout my code base that changes behavior within different classes. Would it be misleading to convert those to properties? Another example, would it be to misleading to make this a next_sprite property? def get_next_sprite(self): if self.current_count == self.max_count: #Time to switch sprites... self.current_count = 0 self.current_sprite = next(self.sprite_reel) else: #Increment and return the same sprite from last frame... self.current_count += 1 return self.current_sprite
  3. Makes sense to use a dict actually, not sure why I went with a list. Curious to why you decided to make this a property? Also, what's your take on using an exception? As in my second example.
  4. Here are 3 versions of a method from my inventory class that adds an item to the given inventory (or increases the items quantity). From a Python perspective, which approach would be best? Each method is followed by a sample of how I would use it in practice. I've been pretty interested in code design/architecture lately and I've been trying to get better at Python, so it may seem like a silly question but I'm just curious what you people think. Currently, I'm using approach #1, but I find it misleading that you could add an item and not actually have an item added. And if there's another approach not listed here that would be good please let me know. #1 prevent adding item if is_full(): def add_item(self, item): i = next((i for i in self.items if i.tag == item.tag), None) #Duplicate item... if i is not None: i.quantity += item.quantity elif not self.is_full(): self.items.append(item) player_inventory.add_item(item) #2 throw exception if is_full() and handle outside method: def add_item(self, item): i = next((i for i in self.items if i.tag == item.tag), None) if i is not None: i.quantity += item.quantity elif not self.is_full(): self.items.append(item) else: raise InvetoryFullException("Inventory can only hold 8 items.") try: player_inventory.add_item(item) except InvetoryFullException: pass #3 check if inventory is_full() outside of method: def add_item(self, item): i = next((i for i in self.items if i.tag == item.tag), None) if i is not None: i.quantity += item.quantity else: self.items.append(item) if not player_inventory.is_full(): player_inventory.items.append(item)
  5. Is there a way to combine all tiles into one so I can do something like self.displaysurf.blit(self.background.subsurface(gameobject), gameobject_location). How do I subsurface multiple tiles? Right now I just get a subsurface of my background image at the gameobjects locations and of the gameobjects size. I've heard of it and will definitely check it out in the future. Is Pyglet more difficult than Pygame? Is it just for graphics?
  6. I'm working on a 2D top down game in Python with Pygame. I was wondering if it is better to use one large image for a background or individual images? My problem with individual images is when I want to update a portion of the display without updating the entire display. How can I get a subsurface of multiple tiles if the location I need to update is between two tiles? Do I use layered surfaces?
  7. Ahh, this was my problem makes sense.   And thanks for pointing this out.
  8. Well for example with a move component I send in a reference of the game object so it can move the game object by modifying it's rect location. I figure for some components I need some way for the component to access members of the game object.
  9. pygame.event.pump() keyboard = pygame.key.get_pressed() if keyboard[pygame.K_UP]:     #move player... elif keyboard[pygame.K_DOWN]: #move player... elif keyboard[pygame.K_LEFT]: #move player... elif keyboard[pygame.K_RIGHT]: #move player... if keyboard[pygame.K_SPACE]: #shoot... for event in pygame.event.get(): if event.type == pygame.QUIT: #quit... elif keyboard[pygame.K_i]: #open player inventory... Currently, I'm using key to handle continuous move events and shooting and the events queue to handle events that should not be repeated if you hold down the given key. Is this sensible to do? I tried using events for player movement but I would get input lag.
  10. When exactly should I be using the pygame event module rather than the pygame key and mouse modules? Currently, I use key & mouse for most of my input and only use event to quit the program. So I was wondering if anyone can clarify the difference and the appropriate times to use event vs key & mouse.
  11. If I have a component that receives a game object (in which it's modifying) and which has it's own properties, should the properties be added to the game object or be part of the component? Does it matter? It's something I've been thinking about lately and was wondering if there would be a benefit to doing one vs the other. Code below is Python 3.   class Component:     def __init__(self, gameobject, x, y, z):         self.gameobject = gameobject         self.x = x         self.y = y         self.z = z   OR   class Component:     def __init__(self, gameobject, x, y, z):         self.gameobject = gameobject         self.gameobject.x = x         self.gameobject.y = y         self.gameobject.z = z  
  12. I am learning Python as well, and have been for the last few months. I found out that I was able to use Pycharm for the main source of my Python code. Pycharm has a similar environment to Visual Studio. Everything is organized and any errors or uncertainties in your code are color-coded. I know that Pygame is available to Python 3, but I, too, am uncertain as how to import Pygame into Python 3. I also have a very helpful Python programming book that I downloaded that is geared towards OOP and gives useful examples on creating classes, loops, etc. If you would like, I could send you the file and we can collaborate knowledge and learn more about the language together.         There is a kid on YouTube thenewboston and sendex, and they do some amazing, in depth tutorials about the backbones of game programming in Python using Pygame.     You can Install pygame from the command line via pip with the following command:   pip install pygame   than you can import it in your .py file:   import pygame   http://www.pygame.org/wiki/GettingStarted
  13. Check out this free book:   https://inventwithpython.com/pygame/chapters/   It's great for beginners and is what I used when I first learned pygame.   Also, the pygame docs have links to a few tutorials.   http://www.pygame.org/docs/
  14. So I find "perfectionism" lately hindering me in my game dev endeavors. Sometimes, I often spend too much time reworking a working solution if feel it is inadequate or if I'm aware of a better way to do it. I get carried away trying to learn the "best" way to do something instead of rolling with the punches and learning as I go along (which is probably a better approach). I also get carried away with language specific detail (is this implemented in the most "pythonic" way, for example). Basically, it boils down to a fear of doing things the "wrong" way. Is there any advice you would give to get over this mindset when it comes to developing a game? I only ask because I find my current approach a hinderance to me actually finishing a project. Thanks!