Game development software based on the Python programming language.

learn more… | top users | synonyms

13
votes
3answers
3k views

What is a good algorithm for fractal-based procedural city layout?

Background I run a minecraft server where I'm going to design a starter city of fairly large scale. I have a series of things, like rule signs and mob cages, I would like to put in buildings there. ...
10
votes
6answers
4k views

Make pygame's frame rate faster

By profiling my game, I see that the vast majority of the execution time of my hobby game is between the blit and the flip calls. Currently, it's only running at around 13fps. My video card is fairly ...
9
votes
2answers
622 views

Common pattern to scale “real units” to pixels?

This is a follow-up question to this other one. I would like to know if there is a common/typical/best pattern to scale my representation of the world (currently 160Kmx160Km) to fit it to the drawing ...
8
votes
1answer
3k views

Doing an SNES Mode 7 (affine transform) effect in pygame

Is there such a thing as a short answer on how to do a Mode 7 / mario kart type effect in pygame? I have googled extensively, all the docs I can come up with are dozens of pages in other languages ...
7
votes
4answers
8k views

Which language and tools should I choose for creating 2D games? [closed]

Recently I have returned to my childhood hobby (programming games) and found it quite enjoyable. I've been tinkering with PyGame (for Python) for a few months, made a couple of projects for ...
7
votes
2answers
2k views

Increase blitting speed?

I'm working on a 2d sidescroller in PyGame. For each map we use one texture (this is the actual size of the texture): Then we load the image with this code: sprite = ...
7
votes
3answers
953 views

PyGame QIX clone, filling areas

I'm playing around with PyGame. Now I'm trying to implement a QIX clone. I have my game loop, and I can move the player (cursor) on the screen. In QIX, the movment of the player leaves a trace ...
6
votes
5answers
2k views

Are there any good UI widget toolkits for Pygame? [closed]

Are there any good, modern widget toolkits for Pygame? I've looked at PGU, but it's apparently unmaintained.
6
votes
8answers
8k views

Alternative to pyGame? [closed]

i'm learning something about game programming from a book about "pyGame". pyGame is simple, but... python is a little complex and different from my previous knoweledge about programming. I know ...
6
votes
1answer
335 views

How do I measure the bounds of a string in PyGame?

I am trying to position some text on my screen using pygame, and knowing the size of the string would help. When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size ...
6
votes
2answers
830 views

How to write reuseable components for pygame

Is there a recommended way to write reuseable components for pygame? Simple example would be a FPS counter. Should I write a class which has an init, update and draw method and call them from inside a ...
5
votes
2answers
168 views

Pygame fails on KEYDOWN with Russian keyboard layout

When I press a keyboard button on a keyboard with a Russian layout, my application pygame game crashes with this message: UnicodeEncodeError: 'ascii' codec can't encode character '\u0444' in ...
5
votes
1answer
654 views

Separating Sprites from Models with PyGame

So I'm trying to code a game using the Model-View-Controller pattern, and therefore have a need to separate the models for my game objects with their sprite representations. The problem that I'm ...
4
votes
2answers
1k views

Why does my turn-based game loop allow the enemy to act repeatedly?

I'm trying to create a turn-based game in pyGame but hit a wall when trying to properly handle the main game loop. So I have something like this: def loop(self): while self.stategame==1: ...
4
votes
1answer
720 views

Issue with implemented Minesweeper algorithm

So I'm attempting to learn Python by way of Minesweeper. I've got experience with SDL, so I figured playing around with PyGame sounded like a fun way to learn the syntax of the language. Anywho, I'm ...
4
votes
2answers
796 views

Using Python what is the best way to perform heavy tasks in the background?

I'm generating large amounts of procedural map data on the fly, however my game engine doesn't rely on them to render the scene and I'd like to build it on in the background and pop it into the world ...
4
votes
2answers
1k views

Pygame set_colorkey transparency issues

I'm having a strange issue that I cannot seem to remedy. I am doing some prototyping with Pygame on a desktop running windows and a laptop running OS X. Both are running python v2.7.3 (installed via ...
4
votes
1answer
203 views

What is the proper way to maintain the angle of a gun mounted on a car?

So I am making a simple game. I want to put a gun on top of a car. I want to be able to control the angle of the gun. Basically it can go forward all the way so that it is parallel to the ground ...
3
votes
3answers
3k views

Pygame surface rotation, rect rotation or sprite rotation?

i seem to have a conceptual misunderstanding of the surface and rect object in pygame. I currently observe these objects this way: Surface Just the loaded image rect the 'hard' representation ...
3
votes
3answers
569 views

Problem in blitting a clean, crisp sprite

I am having a bit of a tooling problem...and I am unsure of how to solve it. I am currently using PyGame to try and write a simple Minesweeper clone, except my sprites that I made are hexagon based ...
3
votes
3answers
863 views

What are the usual tools for importing models and animations?

I'm a total noob with regard to game programming (though not a noob to programming) and I'm using pygame + opengl to do some experiments with a little game I've been thinking of. I've been trying to ...
3
votes
1answer
222 views

What's the difference between Pygame's Sound and Music classes?

What are the key differences between the Sound and Music classes in Pygame? What are the limitations of each? In what situation would one use one or the other? Is there a benefit to using them in ...
3
votes
4answers
490 views

When connecting a physics engine to another engine, should you do all your logic in the units used by the physics side or the rendering side

I'm currently intergrating pygame and pyBox2D, and am wondering which side is best to try to keep to in terms of game units of size. Box2D is Meters PyGame is Pixels At the moment I am thinking I ...
3
votes
4answers
245 views

What can be a game-play element in a game with Shakespeare's plays as the main theme?

I was thinking of learning about making games, so I thought of an idea about making a game on a play, since the content is already there. I actually found well parsed XMLs of Shakespeare's plays. I ...
3
votes
1answer
446 views

Any way to embed Pygame in webpages?

I have a Pygame game, and I was wondering if there was any way to embed it into a webpage to make it easily playable, or if there is a games website that accepts Pygame games.
3
votes
1answer
96 views

Pygame collision detection less frequent when objects are increased

I currently experiencing an issue in pygame where whenever i increase the number of objects e.g. platforms, rocks for a in range(150): rock = Rock(0,0) OR incresing the range which they spawn ...
3
votes
1answer
109 views

How to make a map surface object

I'm making a 2d tile based game. In pygame I could create a map like this: screen = pygame.display(resolution) map = pygame.Surface(width, height) for tile in all_tiles: map.blit(tile) ...
3
votes
1answer
187 views

Find out what word you are hovering mouse over

I want to be able to pop up something when the user hovers over particular words that are on a label in pygame. Can anyone give me a good (or even bad) idea on how to implement this (doesn't have to ...
3
votes
1answer
199 views

pygame.Rect around circle

I'm trying to make a pong game in pygame, but I can't figure out how to put a ball circle, which I can create with pygame.draw.circle into a pygame.Rect object so i can use the colliderect function to ...
3
votes
2answers
1k views

PyGame custom isometric engine : caching or not?

Sorry if this question about is a bit broad. In the game I'm making, I need an isometric view with some altitude, which means players can go behind a hill, and be partly or totally hidden. To avoid ...
3
votes
1answer
343 views

Pygame: circular motion with Bresenham's algorithm

I'm trying to figure out a way to move an object in a circular path. I read about Bresenham's circle algorithm, but all the codes available online draw an entire circle. For my game, I want it so ...
3
votes
1answer
186 views

Pathfiding for groups of agents

How can we refine this path search method to make group movement more elegant? I'm trying to make a RTS-style game, using a 2d tiled gameworld. I have implemented an A* pathfinding algorithm which ...
3
votes
1answer
195 views

How do I create a selection rectangle?

I have a basic prototype working with health, resources and units. The problem is: How do I select multiple units? I have an idea of making an rectangle which dynamically extends with the mouse ...
3
votes
1answer
400 views

Adding lighting pygame

I have created a day and nigh cycle in a game of mine by drawing a rectangle over the screen and having it's alpha change constantly. However, I obviously want to add some lighting to the game. Is ...
3
votes
1answer
380 views

Pygame performance issue for many images

I've made a script for generating a game world based off of image pixel data. Trying to make a python map editor My progress so far has resulted in a program which loads an image and draws sprites ...
3
votes
2answers
1k views

Pygame surfaces and their Rects

I am trying to understand how pygame surfaces work. I am confused about Rect position of Surface object. If I try blit surface on screen at some position then Surface is drawn at right position, but ...
3
votes
1answer
423 views

Meaning of offset in pygame Mask.overlap methods

I have a situation in which two rectangles collide, and I have to detect how much did they collide so so I can redraw the objects in a way that they are only touching each others edges. It's a ...
3
votes
1answer
868 views

Fatal Python error: (pygame parachute) Segmentation Fault when using PyGame and cx_Freeze

I'm using cx_Freeze to package my PyGame game. I'm running Ubuntu Linux, so I used the source package. However, I got the following error when I run cxfreeze game.py: Fatal Python error: (pygame ...
2
votes
4answers
2k views

RPG movement holding down button

I've been writing a simple top down mini RPG in python. My problem is that when I move the player I have to repeatedly tap the arrow key. Each time I tap the key the player moves 5 PX in the ...
2
votes
1answer
406 views

How to march tiles together like in Terraria?

I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way ...
2
votes
2answers
288 views

Grouping surfaces in pygame to get an object with two movement points

I would like to create a simple tank using pygame. One would drive the tank by controlling he velocities of two caterpillar tracks. They should be the two single movement points of the vehicle. I'm ...
2
votes
1answer
275 views

Howdo I load a GIF animation in pygame?

How can I load a GIF animation in pygame? With a web search, I found a severely outdated library called GIFImage. I tried it to do it with 2 pictures but I'm getting stuck because I'm a beginner. I ...
2
votes
1answer
308 views

How do I get hardware accelerated graphics and shaders in PyGame?

I have created several simple games with PyGame, but until now, I have focused on mechanics rather than graphics. The graphics in my games have been extremely rudimentary, consisting of basic shapes ...
2
votes
2answers
561 views

How do I detect multiple sprite collisions when there are >10 sprites?

I making a small program to animate the astar algorithm. If you look at the image, there are lots of yellow cars moving around. Those can collide at any moment, could be just one or all of them could ...
2
votes
3answers
447 views

Detecting Units on a Grid

I am making a little turn based strategy game in pygame, that uses a grid system as the main map to hold all the characters and the map layout. (Similar to Fire Emblem, or Advance Wars) I am trying ...
2
votes
3answers
611 views

Pygame window becomes unresponsive when I click it

I'm new to programming, python and pygame. This is some code I wrote to draw random colored rectangles on an 800 x 600 canvas. It does what I expected it to do but becomes unresponsive if I click ...
2
votes
2answers
7k views

Pygame How To Use Collision?

Can someone tell me how to implement collision in Pygame? For example I have a sprite called A and another one called B. How do I detect if they collide in Pygame?
2
votes
1answer
66 views

Get a random vector

I'm trying to make a small pariticle-like simulation, and I'm trying to make each parrticle go a random direction from one point (mouse pos). The problem is I don't know how to get the random vector ...
2
votes
1answer
577 views

Pygame Tile Based Character movement speed

Thanks for taking the time to read this. Right now I'm making a really basic tile based game. The map is a large amount of 16x16 tiles, and the character image is 16x16 as well. My character has its ...
2
votes
3answers
484 views

Complex collisions in pygame

I've seen many tutorials for simple rectangle or circle-based collision detection with pygame. But how can I do more complex collisions with arbitrary polygons? Is the only option pixel-based ...