[Community pygame project] Plants vs Zombies

[Community pygame project] Plants vs Zombies

Postby metulburr » Wed Jul 03, 2013 2:37 am

This is a community project. Any coder willing to help or just how to learn to program with others are all welcome. Everyone is welcome. All ideas are welcome. The repo is Plants-VS-Zombies

Wanted:
We are currenlty looking for pixel artists of whom may be able to contribute.

Current Issues:
Highscore Screen: (Coding: average, Graphics: average)
This would probably be broken into two screens. One being the name input screen; the other being the actual display screen. The input screen would appear only when the user got a new highscore (in the top 10 or so); the Display screen would appear after game completion and would also be accessible from the main menu. Scores must be persistent so they would need to be written to a file.

Menu Screen: (Coding: medium, graphics: medium)
Implement a nice looking menu screen that lets the user select from appropriate options (probably using the mouse). I think “Story Mode”, “Survival Mode”, “Highscores”, “Credits”, and “Quit” would be a good start. After a set timeout period the game should return to the “TITLE” state if no option is selected.

Title Screen: (Coding: easy, Graphics: medium/hard)
Add a Title State (replacing the placeholder). Should be a good looking screen with the game title that flashes a message saying press any key or some such. Some minor animations would be nice. This requires much more in the realm of art than coding. On key press game State changes to “MENU”.

How to contribute:
If your not too sure about github/git you can learn a gist of the commands from try_git. If you feel uncomfortable going through this process you can post your pixel art/code here on this thread and we can submit it for you. You can, of course, make a pull request to the repo itself. If your not sure where to start, and want to help, you can post your related questions here also.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Wed Jul 03, 2013 2:58 am

Firstly, I can't stress enough how much we need artwork. Concept sketches; pixel art; basically anything to get us moving.

Secondly,
Contribution Etiquette:
Since this is a team project and most (if not all) of us are unaccustomed with working with others, I thought I would make a suggestion of etiquette. Everyone who is even remotely interested in the project is encouraged to fork the repo. If you have anything that you would like to submit, all pull requests are welcome, and if upon review they seem like improvements to the current code, will be merged.

In the case of those that have direct push access to the primary repo, we of course must practice some discretion. I think in the case of changes that don't effect anyone else's work (IE adding a placeholder for a state that doesn't exist yet), pushing to the repository directly is fine. Also if your changes regard trivial things like updating spelling/out of date documentation it should be fine to push directly. In the case of pushing a change to code that someone else has already done work on, I think the best scenario would be to submit it as a pull request, and then allow the original coder the opportunity to first review the changes. If possible state your interest to work on a certain stage and add yourself as assigned to that part in the issues section. This way people stepping on toes should be minimized... maybe.

Basically I just wanted a post near the top of this thread that I can edit later :)
-Mek
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby octopez » Wed Jul 03, 2013 2:38 pm

Firstly, I can't stress enough how much we need artwork. Concept sketches; pixel art; basically anything to get us moving.

I guess you won't want to have an exact clone of Plants vs Zombies, do you? A friend of mine does graphics, maybe he might contribute --> bembulak.deviantart.com
Greetings and all the best,
Octopez

Strange women lying in ponds distributing swords is no basis for a system of government.
User avatar
octopez
 
Posts: 25
Joined: Fri Feb 08, 2013 11:26 pm

Re: [Community pygame project] Plants vs Zombies

Postby metulburr » Sat Jul 06, 2013 1:06 am

In addition to having a 2 player game, maybe we could add some originality in the process of the game. Like the usual is plants on left, zombies on right, zombies go from right to left (at least the vanilla one anyhow, i havent played the game in awhile either). Maybe to increase the complexity and "hard" mode, we can have a 4 way house defense, kind of like:
paint.jpg
paint.jpg (33.39 KiB) Viewed 2299 times
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby metulburr » Sun Jul 07, 2013 4:29 am

I am not too sure of the structure here? Is it getting more convoluted and disorganized by my current method? Mainly referring to states.story.Story()
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby DrakeMagi » Sun Jul 07, 2013 11:54 am

states.story.Story() this I get.
states = folder
story = story.py
Story() is pulling class from story.py

just like pygame.font.Font(None, 30)

now the abbreviations and capitalizing is driving me nuts.
su for setup
pg for pygame
Surf for surface

pygame follows pep8 like a rock.
only class name have first letter capitalize
DrakeMagi
 
Posts: 72
Joined: Sun May 12, 2013 8:36 pm

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Sun Jul 07, 2013 12:02 pm

Class names and Class instances should be CamelCase.
Global constants should be ALL_CAPS.
functions,modules,variables, etc, should all be lower case separating words with underscores.
Nothing you mentioned violates any of this.

Using abbreviations is a matter of taste, but since they are still module names they should still be lower case.

-Mek

Edit:
I personally don't tend to capitalize rects, fonts, or masks, though technically they should be.
Surf is an instance of pygame.Surface and should indeed be capitalized.
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby DrakeMagi » Sun Jul 07, 2013 12:26 pm

Using abbreviations is a matter of taste.
I agree. I just almost always type mine out.
but i did find in pep8.
they say it better to class_ instead clss.

also in pep8 it said method and instance variables should follow function rules.
Method Names and Instance Variables

Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability.

Use one leading underscore only for non-public methods and instance variables.

also python is moving away from camelCase.
mixedCase is allowed only in contexts where that's already the prevailing style
DrakeMagi
 
Posts: 72
Joined: Sun May 12, 2013 8:36 pm

Re: [Community pygame project] Plants vs Zombies

Postby metulburr » Sun Jul 07, 2013 2:05 pm

now the abbreviations and capitalizing is driving me nuts.
su for setup
pg for pygame
Surf for surface

I also agree, this drives me nuts, but i continued the process because i didnt want one module to do pygame, and another to do pg, for example. And not sure why Surf is capped? But i figured it would be easier to understand if everything is the same format.

To be honest, i hate CamelCase. Words split by underscore has a lot more linux feel.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Sun Jul 07, 2013 3:01 pm

also in pep8 it said method and instance variables should follow function rules.

In this context "instance variable" refers to an attribute of the instance.

IE.
Code: Select all
class SomeClass(object):
    def __init__(self):
        self.instance_variable = 5 #I'm an instance variable

also python is moving away from camelCase.
The example you have used here is referred to in the pep8 document as mixedCase, not CamelCase, and indeed mixedCase is highly discouraged in python.

pep8 wrote:CapitalizedWords (or CapWords, or CamelCase -- so named because of the bumpy look of its letters [3]). This is also sometimes known as StudlyCaps.
[...]
Class Names
Almost without exception, class names use the CapWords convention. Classes for internal use have a leading underscore in addition.


I personally use CamelCase for variable names that are instances of custom classes (ie not builtins). Many others do this as well though I can't find anything in pep8 stating one way or another conclusively.

As for my predilection for abbreviated imports, I personally detest typing out pygame all the time or any module name that I deem commonly used enough to be a pain. If you really do oppose this practice then do as you will in your modules. I import openGL as gl and if the regular expressions module was named regular_expressions, I would surely import it as re (fortunately this is obviated).

-Mek
Last edited by Mekire on Mon Jul 08, 2013 1:51 am, edited 1 time in total.
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby Yoriz » Sun Jul 07, 2013 3:22 pm

This is from pep8
A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important.

But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!


As long you guys agree on a consistant style for the project it will be ok, if you want to deviate from pep8 in places as long as you all agree to the same style you won't be banished to hell :twisted:
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 571
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: [Community pygame project] Plants vs Zombies

Postby metulburr » Sun Jul 07, 2013 4:22 pm

As long you guys agree on a consistant style for the project it will be ok

+1

but i did find in pep8.

i dont think it matters what pep says, for example if all of us wanted to make our spacing 10 spaces, we could as long as all of us space it that much. If all of us wanted the naming conventions of setup (for example) different we will never get anything done. Lets just assign a style for tools, setup ext. and everyone use that style regardless of what you would do in your individual programs. I wouls say just leave it as is. If a module is individualized, then go a head and write it in your style.

But this is minor stuff:
pg, Surf, su as we all know what it means, and thus can use it.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby DrakeMagi » Sun Jul 07, 2013 8:01 pm

how are you guys handle xrange, range difference ?
DrakeMagi
 
Posts: 72
Joined: Sun May 12, 2013 8:36 pm

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Sun Jul 07, 2013 11:40 pm

DrakeMagi wrote:how are you guys handle xrange, range difference ?

I would say that this probably depends on how performance critical the specific piece of code is. If it is never going to be the cause of a bottle neck, then just using range is fine. In the case where optimization is important however it might be necessary to throw something like this at the top of the pertinent module:
Code: Select all
import sys

if sys.version_info[0] == 2:
    range = xrange

-Mek
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby jkbbwr » Mon Jul 08, 2013 7:06 am

Have two separate master branches. py2 and py3

tag all subsequent branches as either py2-<branchname> or py3-<branchname>

keep releases separate. Mixing version logic gets complicated quickly. This also means you can test, deploy and release far easier than having mixed logic that works on all versions, and its more optimised, less instructions and less that can go wrong.

As for range or xrange, unless you need a list, always use xrange. Simple as.
jkbbwr
 
Posts: 17
Joined: Mon Feb 11, 2013 10:25 am

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Mon Jul 08, 2013 11:34 pm

jkbbwr wrote:Have two separate master branches. py2 and py3

tag all subsequent branches as either py2-<branchname> or py3-<branchname>

keep releases separate. Mixing version logic gets complicated quickly. This also means you can test, deploy and release far easier than having mixed logic that works on all versions, and its more optimised, less instructions and less that can go wrong.

As for range or xrange, unless you need a list, always use xrange. Simple as.

Honestly this would be overkill for this project and more of a hassle than a convenience in my opinion. There is really nothing standing in the way of mutual compatibility. The range vs xrange problem, can be taken care of with two lines of code, so unless a major obstacle presents itself requiring two differently coded versions, I don't see the point here.

-Mek
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Thu Jul 11, 2013 2:02 am

I have changed all class instances to lower case (although I personally find that not knowing whether something is an instance of a custom class by the variable name lowers my code comprehension speed). The setup imports have all been changed to not use abbreviations. The Surf argument that was passed to the update functions has been changed to surface. I still import pygame as pg; if you wish to use the fully qualified version in your modules please do so. I personally think that pygame is typed far to often and an abbreviation in this case is fully justified. Hopefully we can move past this and actually get something done as a group (that was the goal after all).

-Mek
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Community pygame project] Plants vs Zombies

Postby The Merry Lurker » Mon Jul 15, 2013 12:30 am

Hey, do you guys still need art? Let me know what file-types and what kind of graphics you need, and I can whip something up.

I use GIMP to draw, and can pull of light animation (GIFs) as well.

EDIT: rrrg.. noob mistake. Not enough space to install git. <.< Sorry
Image
User avatar
The Merry Lurker
 
Posts: 5
Joined: Sun Jul 14, 2013 7:14 pm

Re: [Community pygame project] Plants vs Zombies

Postby metulburr » Mon Jul 15, 2013 4:41 am

Hey, do you guys still need art? Let me know what file-types and what kind of graphics you need, and I can whip something up.


Yes we are in dire need of graphics. We are currently just throwing in whatever we can find on a google search or already have. That would be awesome if you can contribute. I'm not 100% sure, Mekire would know the ins and outs, but i believe we are looking for .png or .jpg and spritesheets of various types of plants and their movements of swaying back and forth, shooting (or whatever their action does), and of course zombies. and their spritesheets of walking, arm movement, and what not.

For starters a basic plant like the pea shooter and sun, and one type zombie.

Im sure if i missed something, Mekire will point it out.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1123
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Community pygame project] Plants vs Zombies

Postby Mekire » Mon Jul 15, 2013 4:59 am

I would say try to stick to pngs. Animated gifs won't work but if you can do the frames, saving them all on a sprite sheet shouldn't take much more work. For the version I have been working on I need sprite frames that fit cleanly in 72x72 pixels. We also need title screen and menu screen graphics which are 800x600 px.

@Metul did you see the demo layout I threw in the Survival state (and the ultra-cute sun I made :D ).

-Mek
User avatar
Mekire
 
Posts: 829
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Next

Return to Game Development

Who is online

Users browsing this forum: Mekire, ssmith21991 and 1 guest