PyWeek Documentation

Daniel Pope

Aug 18, 2021

Competition Rules

1 The Rules 3 1.1 1. Entry is individual or team-based...... 3 1.2 2. Entries are to be written “from scratch”...... 3 1.3 3. The time limit is 1 week...... 4 1.4 4. Theme is selected by the competitors...... 4 1.5 5. Entries are judged by peers...... 5 1.6 6. Existing artwork, music and sound effects may be used...... 5 1.7 7. Your Final Submission...... 6 1.8 8. Licensing...... 6 1.9 9. Target platform...... 6 1.10 10. Code of Conduct...... 6

2 Using the PyWeek Website 7 2.1 How the heck do I write a game?...... 7 2.2 So you want to enter as an individual?...... 7 2.3 So you want to enter as a team?...... 7 2.4 Editing your personal details...... 8 2.5 Don’t want an Entry any more?...... 8 2.6 Want to change Team Leaders?...... 8 2.7 Want to join a team?...... 8 2.8 What to do before the challenge starts...... 8 2.9 What do do during the challenge...... 8 2.10 How to submit your entry...... 9 2.11 What to submit as your entry...... 9 2.12 When does PyWeek run?...... 9 2.13 When can I sign up?...... 9 2.14 How do I upload a file?...... 10 2.15 How do I post a diary entry?...... 10 2.16 What’s PyWeek all about?...... 10

3 Packaging your game 13 3.1 Zip the ...... 13 3.2 Include a run_game.py...... 14 3.3 Include a README...... 14 3.4 Building executable files...... 14

4 Writing Diary Entries 15

i 4.1 Writing Diaries...... 15 4.2 Taking Screenshots...... 15

5 Libraries 19 5.1 Graphics/Window/Sound/UI...... 19 5.2 Geometry/Vectors...... 23 5.3 Physics...... 23 5.4 Sound...... 24 5.5 GUI...... 24

6 Game Development Resources 25 6.1 Articles and tutorials...... 25 6.2 Video Tutorials...... 26 6.3 2D Graphics...... 26 6.4 3D Models...... 26 6.5 Textures...... 26 6.6 Content Creation...... 26 6.7 Music...... 27 6.8 Sound Effects...... 27 6.9 Fonts...... 27 6.10 Icons...... 27 6.11 Finding Collaborators...... 27

7 The PyWeek CLI tool 29

8 Conditions of Use 31 8.1 1. About these Conditions...... 31 8.2 2. What the PyWeek system does...... 31 8.3 3. How You Promise to Behave in this Environment...... 31 8.4 4. Copyright...... 32 8.5 6. Things for which the PyWeek Organisers will not be Responsible...... 32 8.6 7. Privacy and Security...... 33

9 Code of Conduct 35 9.1 Communication...... 35 9.2 Harassment...... 35 9.3 Artistic Freedom...... 36 9.4 If there is a problem...... 36

ii PyWeek Documentation

PyWeek is a game jam in which you must write a game from scratch, in Python, in just one week. Why participate in PyWeek? There are many reasons: • Practice your Python programming • Try programming something different • Unleash your creativity • Finish a real project • Maybe, just maybe, you could win and get all the kudos Visit https://pyweek.org/ to participate.

Tip: PyWeek is partnered with the Python Discord server. Join us in the #pyweek channel to chat with other PyWeekers and follow game progress and announcement.

Competition Rules 1 PyWeek Documentation

2 Competition Rules CHAPTER 1

The Rules

revision date 2020-02-06 The PyWeek challenge: 1. Must be challenging and fun, 2. Entries must be developed during the challenge, and must incorporate some theme decided at the start of the challenge, 3. Will hopefully increase the public body of python game tools, code and expertise, 4. Will let a lot of people actually finish a game, and 5. May inspire new projects (with ready made teams!)

1.1 1. Entry is individual or team-based

You may either enter as an individual or as a team with as many members as you like. Individual and team entries will be judged separately and a winner announced in each category. All members of a team get to vote (though not for their own team), enter diary entries and upload files. People may join more than one team. During the challenge, competitors are encouraged to post diary entries (diaries are supplied as part of the challenge), and hang out on Discord (channel #pyweek). By signing up to the challenge, you are agreeing to abide by the system conditions of use.

1.2 2. Entries are to be written “from scratch”

The intent of this rule is to provide a level playing-field for all entrants. The short version is this: any resources you prepare before the competition must be made both available and accessible to all other entrants, regardless of whether they were created by you or by others. “Available” means that they must be published in good time, in a place where

3 PyWeek Documentation other entrants might discover them. “Accessible” means making sure others are not prevented from using them once aware of them. 1. You may not use code created before the competition except under the conditions of clause 2.2 and 2.3. This includes using the code as a point of reference. 2. You may use libraries that were created before the competition if and only if a. they have been published to a public searchable index such as PyPI, GitHub, or this handbook for at least 30 days before the competition; and, b. they are licensed under an OSI-approved open source license, or are public domain; and, . the index page (eg. README/PyPI page) contains, or links to, a documentation resource that describes the features of the library and contains thorough API documentation; and, d. the library does not contain game logic, ie. it is agnostic about theme, backstory, character types, game objects, behaviours, and so on, and requires customisation with Python code in order to define these qualities and behaviours. 3. You may use code posted in blog entries if and only if a. The blog entry was published to the Internet at least 30 days before the competition; and, b. it is specified or implied that the code is free to redistribute, eg. that it is public domain; and, c. the blog entry contains prose describing the purpose of the code; and, d. the code does not contain game logic, under the same definition as clause 2.2.d, unless the logic is provided as an example and you replace it.

1.3 3. The time limit is 1 week

The challenge starts 00:00 UTC Sunday and finishes 7 days later at 00:00UTC Sunday. Work done on entries before this time would be considered cheating. Once the time limit is up entrants will have 24 hours to upload their file(s). This is not extra development time. Failure to upload at the last minute of that additional 24 hours will be met with leniency. The server will overload if you try. You have been warned. If your game crashes it’s on your head. You should allow time for testing well before the deadline.

1.4 4. Theme is selected by the competitors

The theme of the challenge will be determined by a vote in the week leading up to the challenge. The theme exists to serve two purposes: 1. Inspire entrants at the start of the challenge, and 2. Discourage cheating. How entrants interpret the theme (whether it be cosmetically or for deeper meaning) is completely open. A shortlist of five themes will be selected by the organisers. These are drawn at random on the evening before theme voting begins. In the week leading up to the challenge, all participants get to place a preference against each of the five themes. The vote preferences are tallied, according to instant-runoff rules. The winner of that vote is announced at the point that the challenge begins.

4 Chapter 1. The Rules PyWeek Documentation

All votes will be recorded for later examination.

1.5 5. Entries are judged by peers

Judging of final submissions will be done by your peers, the other souls brave enough to grind away for 7 days and compete with you (and finish). Judging is performed by the individual competitors, so every member of a team entry gets to vote. Competitors are not allowed to vote for any submissions they are involved with (so people signed up to multiple teams can vote for none of those teams). Judges will score each game in three categories: • Fun • Innovation • Production (graphics, sound, polish) An overall score will be calculated as the average of these scores. Gold, silver and bronze awards will be given for each of these categories; the overall score will decide the overall winner of the competition. If the game did not work for a judge, they may mark the game “Did Not Work”. Their ratings in the categories above will not count towards its final ratings tally. Finally, competitors may vote that a submission be disqualified for one of three reasons: • Did not follow the theme of the challenge, • Did not work on the target platform, or • Entrant cheated. A submission that gets more than 50% disqualification votes is not eligible for any prizes, though they’ll still appear in the rankings (“do’h, if only I’d followed the rules!”)

1.6 6. Existing artwork, music and sound effects may be used

As with the use of existing codebases, the intention is that all entrants start with a level playing field in artwork too. This means you shouldn’t develop artwork beforehand that you intend to use during the challenge unless you also make that artwork freely available to all other entrants. 1. You may not directly include art, sound, music, writing or other data created before the competition, except under the conditions of clause 6.2. You may however use it as a point of reference, ie. as “concept art”. 2. You may inclue graphics, sound and music created before the competition if a. They were published to a public website that has existed for least 30 days before the competition; and, b. the work is licensed under an OSI-approved or Creative Commons license, or is public domain; and, c. you use only the files published. For example, you may not publish only PNG files but use source SVG files in your game. Any diagrams and concept art created during the theme voting week should not form part of your submission unless clearly marked as concept art. There should be absolutely no breach of licensing. You can’t just cut-n-paste in artwork from The Simpsons (TM). The Game Development Resources page has a list of resources you can use. Also check out the wiki’s game resources page.

1.5. 5. Entries are judged by peers 5 PyWeek Documentation

1.7 7. Your Final Submission

You may upload your final at any time during the challenge. You may even upload multiple final submissions. Only the last one will actually be used for judging. Your entry must include all code and data required for running, and instructions about how to run the entry. See Packaging your game for some guidelines about how to package your entry.

1.8 8. Licensing

1. You retain all copyrights to entries you upload. 2. By uploading an entry you warrant that you have the right to distribute all materials in the entry under the terms laid out in this section of the rules. 2. By submitting an entry to PyWeek you grant a transferrable, irrevocable license to redistribute, copy and run your entry without modification, and to distribute unmodified screenshots of the entry, provided no fee is charged. 3. You may include license terms in your entry; these will be considered an alternative set of terms to those defined by clause 8.2.

1.9 9. Target platform

This is a Python programming challenge. However, you may include code written in supporting languages (eg. C/C++ or Rust libraries, Javascript/HTML in web pages, and so on), if that code does not implement “game logic”. Entries must run using the latest version of Python. Entries must not require end-of-life versions of Python. See the Python Dev Guide for which Python versions are allowed. Entries should specify requirements in a requirements.txt, or otherwise must run with the latest released ver- sions of libraries. If you are the maintainer of a library, we would ask that you make all efforts to not sabotage existing users of your library. Please be diligent about backwards compatibility, providing changelogs, and versioning your releases. If you add features to your library leading up to the challenge, please take great care to ensure that other entrants have a reasonable opportunity to learn about and use these features. This includes updating the documentation and announcing the feature in a changelog or release announcement.

1.10 10. Code of Conduct

All PyWeek entrants must abide by the PyWeek Code of Conduct.

6 Chapter 1. The Rules CHAPTER 2

Using the PyWeek Website

date 2019-02-16

2.1 How the heck do I write a game?

There’s some great tutorials out there and Al Sweigart, the author of the free book Invent Your Own Computer Games with Python has compiled a list of the top 10.

2.2 So you want to enter as an individual?

You should log into the PyWeek site and go to the latest challenge in the sidebar. Then in the the sidebar you should see “Register Entry”. Click that and fill out the details. Leave the “Team Members” bit blank. Once you’ve done that, your entry will appear under your “Your entries” list. You may add diary entries and upload files or screenshots to this entry (the latter only once the challenge has started).

2.3 So you want to enter as a team?

This step should be performed by the team leader. You should log into the PyWeek site and go to the latest challenge in the sidebar. Then in the sidebar you should see “Register Entry”. Click that and fill out the details. You may fill in the “Team Members” bit now or come back and edit it later. Once they’ve done that, their entry will appear under your “Your entries” list. You may add diary entries and upload files or screenshots to the team entry (the latter only once the challenge has started). Only the team leader will be able to manage the team entry (change its name or membership listing).

7 PyWeek Documentation

2.4 Editing your personal details

Once you’ve logged in use the “Edit Profile” link in the menu to configure how your profile is displayed on the PyWeek site. Your profile image, shown in a few places on the site, is a Gravatar corresponding to your primary e-mail address. Use https://gravatar.com to upload a new Gravatar. Use the “Account Settings” link to set your e-mail preferences or change your password.

2.5 Don’t want an Entry any more?

Just ask Daniel to remove it. Mail him at [email protected]

2.6 Want to change Team Leaders?

Just ask Daniel to change it. Mail him at [email protected]

2.7 Want to join a team?

Ask the team leader of that team to add you.

2.8 What to do before the challenge starts

1. Make sure you have working versions of the libraries you’re going to use. 2. Make sure you can packages to submit as your final submission (if you’re going to use py2exe, make sure you know how to use it and that it works). 3. If you don’t have access to , Windows or a Mac to test on, contact friends, family or other competitors to find someone who is able to test for you.

2.9 What do do during the challenge

1. Plan on spending at least several hours packaging and testing your packaging. 2. Allow time for planning your game (for example 1/5 of the total time) 3. Allow time for polishing the game by adding instructions, opening menus, level transition screens, game over screen (for example 1/5 of the total time) 4. Upload screenshots and put them in diary entries! 5. Hang around in the Python Discord. Our dedicated channel is #pyweek but there will be other channels available during the competition.

8 Chapter 2. Using the PyWeek Website PyWeek Documentation

2.10 How to submit your entry

Visit your entry’s page any time during the challenge and up to 24 hours after the finish to upload your file(s). You may upload as many files as necessary, including screenshots. The server will become heavily loaded at deadline times. Given that there is an entire 24-hour period in which to upload your files after the challenge finishes there will be no leniency for failure to upload.

2.11 What to submit as your entry

Consider the advice at http://www.pygame.org/wiki/distributing We recommend you download the Skellington 1.9 package and use that as the starting-point for your game. For this challenge, 1. Always use either ZIP or TAR / GZIP to bundle your entry. 2. Always use a top-level directory. 3. You MUST include a README.txt which at a minimum indicates: • who wrote the code • who created the artwork • how to run the game • the licence for the game (the Foundation has a handy page of free software licenses) • what dependencies need to be installed • a plug for the challenge is nice :) 4. If possible, you should bundle other libs you’ve used. If it’s pure Python, then it may be bundled straight. If not, then consider including the source for the library. 5. If your entry is large (greater than 1MB) then you might want to use the pyweek uploader script to upload it, as it will handle bigger uploads better.

2.12 When does PyWeek run?

PyWeek runs every 6 months in Spring/Autumn. This usually works out to be April and September.

2.13 When can I sign up?

Registration for PyWeek opens 45 days before the challenge start date and remains open until the very end of the week-long challenge. Yes, you can sign up during the week.

2.10. How to submit your entry 9 PyWeek Documentation

2.14 How do I upload a file?

You may upload a file any time during the running of the challenge (ie. after the start date). During the judging, uploads are closed. They re-open after judging is finished, so you can then upload post-competition patches and releases. To upload a file: 1. log in, 2. select the entry you wish to upload it for in the sidebar, 3. select “Upload File” or “Upload Screenshot” in the sidebar, and 4. fill out the “Upload a File” form. See the separate section How to submit your entry for more information about submitting your entry to the site.

2.15 How do I post a diary entry?

To post an entry: 1. log in, 2. select the entry you wish to post the entry for in the sidebar, 3. select “Add Diary Entry” in the sidebar, and 4. fill out the form. Your entry will automatically be listed on the front page of the site.

2.16 What’s PyWeek all about?

Richard speaks: I created PyWeek after competing in and running several Ludum Dare 48-hour challenges. I had a few problems with the format of that challenge: 1. Being over 48 hours meant that you had to focus on the game for most, if not all of the 48 hours. This can be difficult for some of us to organise. Spreading the development over a week is much easier. 2. I wanted to be able to collaborate with friends and LD48 is a solo-only challenge. 3. There’s lots of public-domain or Creative Commons artwork and audio out there that people shouldn’t be prevented from using. Also, I suck at both drawing and musical composition :) The Python-only stipulation was partly as an experiment (to see whether we’d get more games that worked for more people than the LD48 experience) and also as a tool for promoting Python (which I think rocks, a lot). PyWeek was conceived and originally run by Richard Jones. PyWeek number 1 was run in August 2005. Pyweek 22-24 were run by Blake O’Hare. Pyweek 25-30 were run by Daniel Pope. Various other people have helped out with the website over the years, including Lucio Torre, Juan Martinez, and Lex Toumbourou.

10 Chapter 2. Using the PyWeek Website PyWeek Documentation

The participation in PyWeek has been pretty steady since the start, with ups and downs depending on how widely the challenge is promoted (or whether I manage to schedule it particularly badly). The first challenge was announced about 3 months out, and a bunch of people registered that didn’t return for the challenge, hence the low number of finished entries. Since then registration has only been opened to new users one month from the start date. This appears to have reduced the number of unused registrations.

2.16. What’s PyWeek all about? 11 PyWeek Documentation

12 Chapter 2. Using the PyWeek Website CHAPTER 3

Packaging your game

When creating a game for PyWeek, you will want to be sure that it can be played by the most people possible. Below are some tips that you should follow.

3.1 Zip the source

According to rule 7, your game must include all source code. This is the first thing you should do. Packaging a game for various platforms (eg. using PyInstaller) is entirely optional - including the source is not. It is recommended to create a ZIP file that contains your source code. ZIP files can be read on almost all operating systems with standard software.

Tip: Check that your game runs from the ZIP file you create. A common mistake is to fail to include some file that your game depends on!

Each ZIP file should contain a top-level directory, named after your game. If you are using version numbers for your game, the top level directory should also have the same name. So if my game is Camel Breeder, I might create a ZIP file called Camel-Breeder-1.0.zip, containing a directory Camel-Breeder-1.0.

Caution: Don’t create a Zip bomb, which creates many files in the directory where you unzip it.

13 PyWeek Documentation

3.2 Include a run_game.py

Something that has become a convention in PyWeek is to have a file in your game source called run_game.py, which runs your game. This makes it easy for people to see how to run your game, no matter how you decide to structure the code for your game.

Tip: Your Python code may not be compatible with older (or newer) Python interpreters. But the judges may not guess correctly which interpreter version they should use to run your game. A good tip is to make sure your run_game.py exits quickly with an informative error if people are using the wrong Python interpreter. Put this code at the top of run_game.py (replace (3, 7) with the version you actually require): import sys

# The major, minor version numbers your require MIN_VER=(3,7) if sys.version_info[:2]< MIN_VER: sys.exit( "This game requires Python {}.{}.".format(*MIN_VER) )

(Note that this file must be compatible with all old syntax. The above code is compatible with Python 2.6 and later.)

3.3 Include a README

Include a README file in all your packages. This is the perfect place to explain: • What dependencies your game requires to run • How to build and run your game • The controls • What there is to see in the game • Copyright attributions (eg. CC-BY resources you have used)

3.4 Building executable files

Once you have created and uploaded a source distribution, you can, if you wish, try creating an executable so that people will be able to run your game without having a Python interpreter installed. The recommended tool for doing this, for all platforms, is PyInstaller. The full manual for PyInstaller is here. Older tools, such as cx_freeze, py2exe and py2app, are not recommended. These each target only one , and seem to be unmaintained (as of 2019).

14 Chapter 3. Packaging your game CHAPTER 4

Writing Diary Entries

Writing diary entries is important so that PyWeek remains a social event. It is intended that entrants learn from and support each other.

4.1 Writing Diaries

It is recommended to write at least one diary a day, including a screenshot of your progress. This will be interesting to other PyWeek participants, but will also give you the chance, once the competition has ended, to look back and see how your game evolved over the course of a week. Screenshots can be uploaded to the PyWeek website via the “Upload File” link on the Entry page.

4.2 Taking Screenshots

While you can take screenshots using a generic screen grab tool, it’s not always quick and easy - it can require switching focus away from your game. You can take more and better screenshots if you set up a key - I suggest F12 - to save a new screenshot under a unique file name. Fortunately doing this from Python code is pretty formulaic.

4.2.1 Pygame

Pygame can directly save a surface as an image. The code to do this just needs to be dropped into your event handling. import datetime import pygame

(continues on next page)

15 PyWeek Documentation

(continued from previous page) def screenshot_path(): """Get a path to save a screenshot into.""" now= datetime.datetime.now() return now.strftime('screenshot_%Y-%m-%d_%H:%M:%S.%f.png')

# in your event loop for event in pygame.event.get(): ...

if event.type == KEYDOWN: if event.key == K_F12: pygame.image.save(screen_surface, screenshot_path())

4.2.2

In OpenGL, you have to read back the colour buffer to an image and save that. As you generally don’t want the colour buffer’s alpha channel to be saved if it has one, there are a couple of OpenGL calls to force every pixel to be read as opaque. Pyglet can handle reading and saving the colour buffer though. import datetime from pyglet import gl from pyglet.window import key def screenshot_path(): """Get a path to save a screenshot into.""" now= datetime.datetime.now() return now.strftime('screenshot_%Y-%m-%d_%H:%M:%S.%f.png')

... def on_key_press(symbol, modifiers): """This is your registered on_key_press handler.

window is the pyglet.window.Window object to grab; here we assume this is a global. """ if symbol == key.F12: # disable transfer alpha channel gl.glPixelTransferf(gl.GL_ALPHA_BIAS, 1.0)

image= pyglet.image.ColorBufferImage( 0,0, window.width, window.height ) image.save(screenshot_path())

# re-enable alpha channel transfer gl.glPixelTransferf(gl.GL_ALPHA_BIAS, 0.0)

16 Chapter 4. Writing Diary Entries PyWeek Documentation

4.2.3 ModernGL

For ModernGL the raw OpenGL calls are wrapped in an object-oriented API. You will need a library to convert the raw image data to a graphics file format. The buffer data will need to be vertically flipped. Here is the code to do that using Pygame: import datetime import pygame.image import pygame.transform def screenshot(ctx: moderngl.Context): """Take a screenshot.""" now= datetime.datetime.now() filename=f'screenshot_ {now:%Y-%m-%d_%H:%M:%S.%f}.png'

# You can use this code to take a screenshot of any FBO but # the default framebuffer, ie. the screen, is ctx.screen. fbo= ctx.screen

# Read RGB data back from the screen data= fbo.read(components=3)

# Make an RGB Pygame Surface surf= pygame.image.fromstring( data, (fbo.width, fbo.height), 'RGB' )

# Vertically flip the image surf= pygame.transform.flip(surf, False, True)

# Save Pygame surface to a file pygame.image.save(surf, filename)

And instead using Pillow: import datetime from PIL import Image def screenshot(ctx: moderngl.Context): """Take a screenshot.""" now= datetime.datetime.now() filename=f'screenshot_ {now:%Y-%m-%d_%H:%M:%S.%f}.png'

# You can use this code to take a screenshot of any FBO but # the default framebuffer, ie. the screen, is ctx.screen. fbo= ctx.screen

# Read RGB data back from the screen data= fbo.read(components=3)

# Make an RGB PIL image img= Image.frombytes( 'RGB', (continues on next page)

4.2. Taking Screenshots 17 PyWeek Documentation

(continued from previous page) (fbo.width, fbo.height), data, )

# Vertically flip the image image= image.transpose(Image.FLIP_TOP_BOTTOM)

# Save Image to a file img.save(filename, format='png')

18 Chapter 4. Writing Diary Entries CHAPTER 5

Libraries

5.1 Graphics/Window/Sound/UI

5.1.1

Website http://pygame.org/ Documentation https://www.pygame.org/docs/index.html Pygame is principally bindings for SDL (Simple DirectMedia Layer) for Python. As such it has limited support for GPU-accelerated rendering, and any support for rotation, scaling, or alpha-blending sprites is limited. It is one of the oldest Python game libraries, dating from around 2000. Add-ons: • pygame-text - simple text rendering in Pygame, with a range of layout and styling options • PGU - a collection of utility code for working with Pygame, including a complete UI framework and basic HTML rendering. • thorpy for pygame GUIs • Albow - widget set for GUIs

19 PyWeek Documentation

5.1.2 Pygame Zero

Website https://pygame-zero.readthedocs.io/en/stable/ Pygame Zero is “training wheels for Pygame”, intended to make it simpler for complete beginner to create games in Python using Pygame. Even so, it also has a number of feature additions such as a built-in event loop and tweening.

5.1.3 Pyglet

Website http://pyglet.org/ Documentation https://pyglet.readthedocs.io/ pyglet provides hardware accelerated rendering for sprites, drawing text, audio playback, and joystick support. Sprites can be static or animated, rotated, scaled, and support transparency. pyglet is built on OpenGL, so the full OpenGL bindings are also availble for use in 3D games. FFmpeg is optionally supported for compressed audio and video playback.

20 Chapter 5. Libraries PyWeek Documentation

5.1.4

Website http://python.cocos2d.org/ Documentation http://python.cocos2d.org/doc/index.html Cocos2D, built on Pyglet, offers higher level primitives, such as scene transitions and sprites on which animations can be queued.

5.1.5 Arcade

Website http://arcade.academy/index.html Also built on Pyglet, this is a higher-level games framework with extensive documentation and examples. The author has written a corresponding book on learning to program with Arcade.

5.1.6

Website http://kivy.org/ Kivy is a cross-platform multimedia UI system built on OpenGL ES. As such it can be used for building games, though it is not specifically designed for this purpose.

5.1. Graphics/Window/Sound/UI 21 PyWeek Documentation

5.1.7

Website https://www.panda3d.org/ Documentation https://www.panda3d.org/manual/ Panda3D is a 3D engine for Python or C++, developed by CMU in partnership with Disney.

5.1.8 Pyxel

Website https://github.com/kitao/pyxel Pyxel is a deliberately restricted engine for retro games. It includes sprite, tile, sound and music editors, and a packaging tool to produce standalone executables.

5.1.9 Wasabi2D

Website https://github.com/lordmauve/wasabi2d Documentation https://wasabi2d.readthedocs.io/en/stable/ A powerful 2D graphics engine with coroutines and shaders, built on ModernGL and Pygame.

5.1.10 Ursina

Website https://www.ursinaengine.org/ A 2D/3D engine built on top of Panda3D.

5.1.11 PursuedPyBear

Website https://ppb.dev/ Documentation https://ppb.readthedocs.io/en/stable/ An education-friendly 2D game framework built on PySDL2.

22 Chapter 5. Libraries PyWeek Documentation

5.1.12 Others

• pysdl2-harness - some simple classes to make working with pysdl2 easier. Somewhat inspired by pyglet and trying to hide all the “ugly” stuff of SDL2 • ModernGL - a PyOpenGL replacement

5.2 Geometry/Vectors

• pygame.math- Mutable 2D and 3D Vector classes implemented in C. • wasabigeom- Immutable 2D Vector class and other 2D geometric primitives, implemented in . • pyrr - comprehensive suite of 3D geometry operations based on numpy, including Vectors, Matrixes, Quater- nions and more. No 2D. • euclid- Mutable 2D and 3D Vector and geometry classes, in pure Python. • vec- Immutable 2D Vector class that preserves polar/cartesian coordinates, implemented in pure Python.

5.3 Physics

5.3.1

Website http://www.pymunk.org/en/latest/ Documentation http://www.pymunk.org/en/latest/overview.html Pymunk is a complete 2D physics engine with a very Pythonic API and good documentation. Pymunk is based on Chipmunk, a fast physics engine written in C.

5.3.2 Lepton

Website https://github.com/lordmauve/lepton Documentation https://pythonhosted.org/lepton/ Particle physics and rendering for OpenGL and Pygame.

5.3.3 Others

• PyBox2D - 2D physics. This is now much less well maintained than PyMunk, and the documentation is lacking.

5.2. Geometry/Vectors 23 PyWeek Documentation

5.4 Sound

• pyfxr - a library for generating sound effects directly in Python code, and a GUI to explore the sounds you can generate. Compatible with Pygame, Pyglet, and more.

5.5 GUI

• pyimgui - Python bindings for the dear Imgui UI framework - works with several OpenGL based frameworks and also Pygame.

24 Chapter 5. Libraries CHAPTER 6

Game Development Resources

Last reviewed 2019-02-17 We asked PyWeek users for their suggestions for game development resources. The following is an attempt to curate the suggestions.

6.1 Articles and tutorials

• Fun and Games in Python - a history of PyWeek, Pygame, Pyglet and more, with analysis on what makes games fun • How to be Successful at PyWeek • Some Game Development Tips & Tricks • How to fail at PyWeek(slides) • PyGame wiki chock full of tutorials, game resources, distribution advice and more. • Big List of Indie Resources • Big List of Game Design • Game Mechanics Explorer • Amit’s Game Programming Information contains a huge resource on game design and implementation • Game Accessibility Guidelines • A Whole Lot of PyGame Examples • Red Blob Games has superb interactive tutorials on a number of topics. • On frame rates, vsync and gameplay simulation. • Pixel art tutorials • Al Sweigert’s Video Game Mechanics Mixer.

25 PyWeek Documentation

•“Designing a retro pixel-art tile-set” • Evaluating Game Mechanics For Depth - This article is probably one of the most useful I’ve ever read and is great for evaluating whether a game idea is good or not in advance. • Nice writeup of various approaches to 2D platformer games.

6.2 Video Tutorials

•“Juice It Or Lose It” - an awesome presentation about making games more fun with very simple ideas. • Great video about good game design as illustrated by the Mega Man series (caution: contains swearing)

6.3 2D Graphics

• Kenney has a vast library of cute 3D sprites, as well as 3D models and sound files. • OpenGameArt has 2D art, 3D models and textures. • Game Icons - a collection of icons representing video game tropes.

6.4 3D Models

• Models by Quaternius • Poly has many CC low-poly models (but it also has other 3D content created by Tilt Brush and other tools, which are not useful in games.

6.5 Textures

• CC0Textures.com - public domain PBR texture sets • Texture Haven

6.6 Content Creation

• Pyxeledit is a pixel art, tile map, tile set and sprite sheet editor of awesomeness. It’s inspired by Pixothello but is improved in many ways (not the least of which is it’s cross-platform.) • Pixen is a really nice pixel art app for OS X but it doesn’t have the same awesome tileset creation mode as Pyxeledit. • Tiled Map Editor • A collection of links to game assets and various game-dev related tools.Here’s a list of art asset creation tools

26 Chapter 6. Game Development Resources PyWeek Documentation

6.7 Music

• http://ccmixter.org/ • Royalty free music by inkaudio • Random music generator • Filmmusic.io creative commons music

6.8 Sound Effects

• Freesound

6.9 Fonts

• The Font Library

6.10 Icons

• Icons for everything - royalty free icons (over 1 million, it claims)

6.11 Finding Collaborators

• Teamups

6.7. Music 27 PyWeek Documentation

28 Chapter 6. Game Development Resources CHAPTER 7

The PyWeek CLI tool

There is a pyweek command-line tool available on PyPI which makes it easier to download and rate the entries. Install it with: pip install pyweek

To download the entries, use: pyweek download

For example: pyweek download 27

29 PyWeek Documentation

30 Chapter 7. The PyWeek CLI tool CHAPTER 8

Conditions of Use

revision date 2020-09-16

8.1 1. About these Conditions

1.1 Welcome to the PyWeek challenge system. If you use this online software, created by the PyWeek Organisers, you must agree to the following terms and conditions. 1.2 These conditions may be updated from time to time. This agreement is governed by the laws of Victoria, Australia where the PyWeek Organisers are located.

8.2 2. What the PyWeek system does

2.1 The PyWeek system is an online software environment which facilitates the running of the PyWeek challenge.

8.3 3. How You Promise to Behave in this Environment

3.0 When using the PyWeek website you agree to abide by the Code of Conduct, which describes appropriate forms of communication and forbids harrassment of any kind. 3.1 This agreement is a . Under this license, only one person is allowed to log in under a single username and password. You must never provide your password to anybody else. 3.2 You must not assume the identity of another living person. 3.3 Material posted to your home page must not infringe another person or organisation’s copyright, patent, trademark or trade secret. It must not be defamatory, libellous, unlawful or incite unlawful behaviour, obscene, invasive of another person’s privacy, harmful of children, hateful, harassing, racially or ethnically objectionable, abusive, threatening, harmful, fraudulently deceptive, in breach of confidentiality, or in contempt of court.

31 PyWeek Documentation

3.4 You may not use this software environment for ‘spamming’ or activities associated with spamming, nor share or transmit files that are corrupt, have viruses or which will do harm to the usability of anybody’s computer. 3.5 Everything you post to your home page is your sole responsibility. Including, but not limited to program code, images, sound or video material. As the PyWeek Organisers do not review or screen any of the material that is posted to the web using the PyWeek system, we can take no responsibility for any of this content – yours or other people’s.

8.4 4. Copyright

4.1 All software and content in the PyWeek system is copyright and is protected by international copyright laws.

8.4.1 4.2 Your Copyright

4.2.1 The copyright of all material posted to a PyWeek home page is owned by the person posting the content, or the organisation which has given a person permission to post content on that organisation’s behalf. 4.2.2 Permissions to copy or republish any material posted to the web through this site can only be secured by con- tacting the copyright owner directly.

8.4.2 4.3 Other People’s Copyright

4.3.1 As a part of this agreement, you agree to respect other people’s copyright. Material owned by other people or organisations can only be used with their permission, or within the bounds of ‘fair use’, or when a particular piece of content is in the public domain.

8.5 6. Things for which the PyWeek Organisers will not be Responsi- ble

6.1 The PyWeek system is continuously evolving environment. The PyWeek Organisers may at any time and without notice modify or discontinue all or part of its service. You agree that the PyWeek Organisers shall not be liable to you or anybody else if this happens. 6.2 The PyWeek Organisers will not take any responsibility for lost content or temporary lack of access due to technical failure. We recommend that you maintain your own backup of any material of importance of value to you, independent of and separate from the PyWeek system storage facilities. 6.3 The PyWeek Organisers do not warrant that its software will be error free, continuously and permanently available and secure. Access to material generated by the software is at the user’s own risk, and the PyWeek Organisers take no responsibility for damage done to the user’s computer system, or content stored on that system, as a consequence of access to the software or content stored using the software. 6.4 We do not guarantee the accuracy or legality of any content posted to the web or published using the PyWeek system. As a consequence, we will not accept any claims made against us in relation to this content. 6.6 The PyWeek Organisers will not take any responsibility for the use of your account by other people, with or without your permission, and expressly forbids you from permitting another person to use your account or giving them your password. 6.7 You agree to indemnify the PyWeek Organisers against any claims that may be made against us as a consequence of the way you have used this software environment, and any related costs if we are required to deal with these claims.

32 Chapter 8. Conditions of Use PyWeek Documentation

8.6 7. Privacy and Security

7.1 The PyWeek Organisers respect the privacy of the users of its software and the visitors to the sites generated using the software. No personal or contact data will be passed on to any other person or organisation without your permission, or unless we are required by law. The PyWeek Organisers may from time to time contact all users of the PyWeek system on matters connected with PyWeek challenges. 7.2 All contact details entered during registration will be kept private. 7.3 The PyWeek system may require that “cookies” are enabled on your web-browser. Data which is collected using cookies will not be used to track individuals.

8.6. 7. Privacy and Security 33 PyWeek Documentation

34 Chapter 8. Conditions of Use CHAPTER 9

Code of Conduct

We want all users to have an enjoyable experience whe participating in the PyWeek challenge and community. All users are expected to abide by this Code of Conduct. If necessary, the PyWeek organisers will act to enforce it.

9.1 Communication

All entrants are expected to show respect and courtesy to other users of the PyWeek.org website. All communication should be appropriate for a general audience, which may include children and people from many different backgrounds. Sexual language and imagery are not welcome. Please be thoughtful when making jokes or discussing sensitive topics or issues that are likely to have a strong personal effect on some people. If in doubt, ask for advice or simply moderate your expression.

9.2 Harassment

PyWeek is dedicated to providing a harassment-free experience for everyone, regardless of gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, age or religion. PyWeek will not tolerate harassment in any form, or language, imagery or behaviour that are: • sexist, racist or exclusionary • intimidating or threatening • insulting or unpleasant Harassment can include any unwelcome behaviour directed at another person.

35 PyWeek Documentation

9.3 Artistic Freedom

PyWeek is a creative competition, and this Code of Conduct will be considered more generously in the context of PyWeek entries, where the entry would not cause serious offence to any potential player, registered with the PyWeek site or not. For example, it may be possible to show a limited amount of abusive behaviour, imagery or language in a game if • it is not explicit or graphic • it is justified by setting, or an immersive plot • it is not aimed at a real individual • it is not expressed as the view of the entrants • realistic consequences are presented If in doubt, avoid these topics in your entries.

9.4 If there is a problem

If you are troubled by the behaviour of another user, or are concerned that another user may be in distress, please contact or . Your concern will be heard in confidence, taken seriously, and dealt with according to a documented procedure for handling code of conduct reports. We will investigate promptly and if necessary will take appropriate action. This could include: • banning a violator of the Code of Conduct from PyWeek • passing on details of the incident to authorities We will provide you with a written statement of the outcome, whatever it is.

36 Chapter 9. Code of Conduct