Python is a dynamically and strongly typed programming language that encourages readability.

learn more… | top users | synonyms

1
vote
1answer
358 views

How can I load .obj files in the Soya3D engine?

I recently just found soya3d. I want to import .obj files, but it seems to only accept .data files. How can I import .obj files? Importing a .obj file named "house" produces this error: Traceback ...
0
votes
1answer
52 views

Mutlplayer game organization [on hold]

I'm planning to create an RPG that you can play in multiplayer. The graphics will be simple ASCII. I will do the client C and the server in Python. Having never done a multiplayer game was wondering ...
1
vote
2answers
351 views

Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
0
votes
1answer
26 views

How to change the position of a circle in pygame in three stages

I will try to explain it as well as I can excuse me if I'll fail. I have the following simple game situation: I know the coordinates of each point. So each of the green points try to hit the blue ...
0
votes
1answer
47 views

Oblique launch within a game

I'm creating a simple game in python that will follow the same logic of DDTank and Worms. The graph is formed by characters. The buildings that will be destroyed are formed by '*', players are '@' and ...
0
votes
1answer
50 views

Pygame Surfaces: which (and when) do I need to .convert()?

I'm a bit puzzled about pygame's Surface.convert(): It's common sense that I should convert a surface after loading an image to it (presumably a jpg/png/etc file), but what about surfaces that I ...
5
votes
1answer
519 views

What's the 'proper' way to get unit vectors?

My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 ...
0
votes
1answer
36 views

Efficiently tracking active instances

I'm creating a game with lots of instances. On each iteration of the game loop, I only want to deal with the ones that are near the player. Currently, I do this by constructing a list of all the ...
0
votes
1answer
128 views

How do I pass an object location into a vertex shader?

I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object. So far (despite being a beginner at shaders) I've written a vertex shader for the ...
0
votes
0answers
18 views

pygame.display.update(list) updates entire screen, not just rectangles in list

I have two "sprites", one following the mouse and one that moves with WASD. They aren't really pygame.sprite.Sprite objects, but they move like this: Paint over original position with that piece of ...
0
votes
1answer
127 views

Player & Level class structure in 2D python console game?

I'm trying to create a 2D console game, where I have a player who can freely move around in a level (~map, but map is a reserved keyword) and interfere with other objects. Levels construct out of ...
1
vote
1answer
96 views

Best practice to implement persistent data when using Tiled TMX map files?

A friend of mine and I are always talking about our current progress in learning game development. Recently, saving the game (data persistence) came up, and when I summarized how I tackled that for my ...
3
votes
1answer
444 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.
1
vote
3answers
576 views

sprite group doesn't support indexing

I have a sprite group created with pygame.sprite.Group() (and add sprites to it with the add method) How would I retrieve the nth sprite in this group? Code like this does not work: mygroup = ...
0
votes
4answers
2k views

smooth movement pygame

Hello im trying to learn more about smoother movement in games. I have created a little program to hopefully help me understand this. As far as i can tell i am suppose to track time, and update ...
1
vote
0answers
53 views

Pygame's sprite.collide_circle() missing several frames of head-on collision

I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback ...
3
votes
1answer
150 views

game mod security question

So I'm in the process of building a game in C++ for the engine and Python for behavior and moddability. One of the planned major features is that when the game client connects to a game server with ...
1
vote
1answer
81 views

Splitting Pygame functionality between classes or modules?

I am attempting to make my pygame application more modular so that different functionalities are split up into different classes and modules. I am having some trouble getting pygame to allow me to ...
0
votes
2answers
233 views

Exporting Blender bones' transform matrix

I use this simple python script to export bones transformation: bones = armature.pose.bones # for eaach bone in bones SystemMatrix = Matrix.Scale(-1, 4, Vector((0, 0, 1))) * ...
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 ...
0
votes
1answer
137 views

Chess Artificial intelligence with python and pygame [closed]

I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links? Thanks
0
votes
1answer
63 views

How to display consistent background image

Drawing a large background is relatively slow in PyGame. In order to avoid drawing BG every frame, you could draw it once, then do nothing. However, if something is overdrawn onto the surface and ...
0
votes
1answer
66 views

Bounding Box Collision Glitching Problem (Pygame)

So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, ...
0
votes
1answer
49 views

Possible to pass pygame data to memory map block?

I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus). The matrix will be 75 pixels wide and 20 pixels tall. As a side project, I thought it would be ...
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 ...
1
vote
2answers
149 views

Best way to store a large amount of game objects and update the ones onscreen

Good afternoon guys! I'm a young beginner game developer working on my first large scale game project and I've run into a situation where I'm not quite sure what the best solution may be (if there is ...
-2
votes
1answer
90 views

theory behind rotation of a 3d cube using mouse

I want to rotate a 3d cube using mouse in python/pygame. Could someone explain the theory behind rotating a 3d cube by mouse? I dont understand how angleX, angleY and angleZ are affected by mouse ...
1
vote
1answer
89 views

How do I make a sprite move to another position using vectors

Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using ...
8
votes
4answers
2k views

What library for octrees or kd-trees? [closed]

Are there any robust performant libraries for indexing objects? Objects would have bounds themselves, rather than being represented by points; and an object could therefore be in more than one ...
0
votes
0answers
13 views

How do I distribute my game with Py2exe or PyInstaller? [duplicate]

I just developed a game with Python and I want to use Py2exe and Pyinstaller to turn it into a stand-alone python file or .exe that can run on computers without python installed. How can I do this?
2
votes
1answer
268 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 ...
1
vote
1answer
66 views

How can I rotate my picture using Pygame?

I wanna make the Dragon on the picture rotate softly to the left when he flys to the left and rotate to the right when he flys to the right and up and down also. How can i do that with the keys w a s ...
0
votes
1answer
38 views

Pygame proble, moving picture

Thats my problem on the Picture...The stripes How can i fix that? My Code: import pygame, sys from pygame.locals import * pygame.init() sound = pygame.mixer.Sound('start.wav') sound.play() size ...
0
votes
0answers
108 views

How to rotate a line in 3d space?

I am trying to figure out direction vectors of the arrowheads of an arrow. Basically I'm given a normalized direction vector (u,v,w) and I need the normalized direction vectors of the its two arrow ...
1
vote
1answer
58 views

When is messaging/observing preferable to 'built-in' functionality in game objects?

In working on a Python/Pygame project I recently came to an impasse which couldn't be solved elegantly via my previous methodology - using wrapping functions as an Observer pattern - and it was ...
0
votes
0answers
55 views

How to find the Y coordinate of a line moving up and down with given specific X coordinate?

I start with a horizontal line and I run midpoint displacement algorithm to generate some mountains, then I want to place some pillars on top of the mountain by randomly choosing the X coordinate, but ...
0
votes
1answer
77 views

WebSockets and Python/PyGame

I am looking to start development on a game that will have the server be written in Python/PyGame and the front end be in HTML5. What I would like to do is, with as minimal impact as possible, open ...
0
votes
1answer
45 views

PyGame2Exe doesn't include spritesheet?

My directory for my Pygame program looks something like this: [Parent directory] lib engine Various .py files graphics spritesheet.py ...
2
votes
1answer
149 views

Picking random monster cards from a deck

What is the best way to go about making user defined classes (monsters, items, loot, armor, weapons, spell types, etc) and then calling them later during an encounter? Looking at the entire card list ...
1
vote
1answer
87 views

Midpoint Displacement 1D - How to properly reduce my random number range?

So I'm trying to implement this http://www.gameprogrammer.com/fractal.html#midpoint algorithm, to generate myself a terrain. In the tutorial is said: OK, before we go into 2D fractal surfaces, you ...
1
vote
0answers
95 views

Speeding up point-in-polygon for Python

In researching collision detection methods for non-Rect-like objects I came across point-in-polygon -- specifically, the even-odd rule. The one presently on Wikipedia claims it is written in Python, ...
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 ...
0
votes
1answer
65 views

How to spin an object on its own axis?

I'm trying to spin up my own 3D vector graphics engine, so I'd like to do this without an existing library. And I don't seem to be able to find the math for the correct approach in rotating an object ...
2
votes
3answers
445 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
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 ...
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 ...
0
votes
1answer
279 views

Texturing a PyOpenGL 3D Cube with PySDL2

So, I've just started learning OpenGL with PySDL2, and I've created a class that will create a cube to the window that I've created with PySDL2. What I'd like to do now, is to figure out a way to ...
24
votes
2answers
2k views

Random/Procedural vs. Previously Made Level Generation

What the advantages/disadvantages of using random/procedural generation vs. pre-made levels? There seems to be few that i can think of, other than the fact that items may be a problem to distribute ...
0
votes
2answers
418 views

Pygame - CollideRect - But How Do They Collide?

I'm having some trouble figuring out how I can handle collisions that are specifically colliding on the top or bottom a rect. How can specify those collisions? Here's a little code snippet to give ...
1
vote
2answers
602 views

Bullet physics in python and pygame

I am programming a 2D sidescroller in python and pygame and am having trouble making a bullet go farther than just farther than the player. The bullet travels straight to the ground after i fire it. ...