Questions tagged [python]
Python is a dynamically and strongly typed programming language that encourages readability.
636 questions
0
votes
0
answers
466
views
Python Generating a Shadowmap from a Heightmap
I've recently been experimenting with Python and PIL to generate heightmap images using simplex noise. The generated heightmaps are simply 2D numPy arrays with height values ranging from 0-1. I ...
0
votes
1
answer
432
views
Converting physics example to Velocity Verlet / Leapfrog method
I'm looking at the impressive video about verlet integration.
I managed to implement a sphere falling, exactly like the video up to the minute mark 2:19 in the video.
I want to use velocity verlet ...
0
votes
0
answers
197
views
How do I reduce the size of a sprite hitbox?
I am making my own pygame game, but I want to reduce the size of the player's hitbox in order to make dodging bullets easier.
...
1
vote
1
answer
86
views
Is it a good idea to solve movement of solid bodies with restrictions (e.g. connections) by shifting tangentially and projecting normally in phase sp?
I am trying to code my first 2d game with physics (in python), and so far my physics simulation works with solid bodies. I want to add connections, for example, so the player can rotate an arm and ...
0
votes
1
answer
56
views
Load in all NPC asset dependencies at once, or Just In Time during their construction?
I have an NPC class with a DialogueTree object as a field. DialogueTree objects are ...
0
votes
1
answer
663
views
for event in pygame.event.get(): pygame.error: video system not initialized
I'm going through a tutorial and trying to build a game using Python and struggling to resolve below error. Not sure what I'm missing here can someone help with it
Alien_invasion.py
...
0
votes
3
answers
2k
views
How to train a reinforcement learning algorithm in Unreal?
I know I can use ONNX plugins to use pretrained Deep Learning models in Unreal Engine 5, like style transfer, object detection, etc.
I want to build a basic reinforcement learning project and would be ...
0
votes
1
answer
974
views
Having trouble trying to figure out why pygame.sprite.Group's draw method isn't working properly, but switching to player sprite does work
Goal, Description & Scope (when encountered issue)
I was building a testing script to see how implementing different ideas (event handling, update handling, draw method) to loading sprite images, ...
0
votes
1
answer
240
views
Collisions detected prematurely, before rectangles actually touch
I am creating a game with Pygame but my collisions are registering too soon. I'm using this code to end the game when the player collides with a pipe:
...
0
votes
0
answers
24
views
Find which tiles are intersected between two points on an isometric tilemap [duplicate]
I need to be able to find out which tiles are intersected when a line is drawn between two points.
I'm currently working with a isometric perspective which makes things a little more complicated.
I've ...
0
votes
1
answer
227
views
How to move blocks down to fill the gap after clearing a row in Tetris?
I'm working on a Tetris clone. When I clear a line, my code does this:
I want to move the squares down + 1.
My code is:
...
0
votes
0
answers
85
views
Game window freezes whenever enter is pressed on textbox
I recently programmed a game in Pygame and added a text box (which I made using pygame_gui) which will send data directly to a MySQL database. But whenever I type ...
0
votes
0
answers
444
views
0
votes
0
answers
45
views
Pyinstaller compiled Harfang 3d game not working
When I run it, I get:
...
1
vote
2
answers
1k
views
How do I move an object along its local axis?
I am new to computer graphics and am trying to make a simple little game where I can move a cube around with the keyboard. I have it so you can rotate the cube with the arrow keys, and I wanted to ...
0
votes
0
answers
91
views
Emulating a Forza telemetry server and/or an OBD Bluetooth adapter (in Python)
I'm making a driving game in Pygame, and want to give a player the option to send game data to a Forza-compatible dashboard app (like SIM Dashboard) or to an OBD app (like RevHeadz). How do I do so?
...
2
votes
1
answer
5k
views
Creating a nav mesh
I'm coding a custom engine using Python and Pygame. It's a top down 2D isometric RTS and I wan't to implement pathfinding for my units.
My research has lead me to using a Navigation mesh which seems ...
0
votes
0
answers
149
views
Connecting nodes for A* algorithm
I am currently working on implementing a pathfinding module for my 2D game engine that I am writing in Python using Pygame.
Currently there are objects such as trees or buildings which can be placed ...
0
votes
0
answers
34
views
How do I move the craft, a manually drawn object from arcade library?
I'm trying to move a spacecraft across the screen. The craft is drawn with this function
...
0
votes
1
answer
66
views
This script keeps crashing
I'm using the arcade library, and this script keeps crashing. I think it's my function but idk. Definitely the script, I've run it from two IDEs and the file explorer and every time it shows a black ...
0
votes
1
answer
2k
views
How fps limiting works in pygame (specific example)
I recently wrote a program where I needed to limit the fps. After some searching I found a way via pygame built-in methods pygame.time.Clock() and ...
0
votes
0
answers
103
views
Mouse position as target, with arced (curved) shot
I am trying to write a game with artillery mortar fire I have another gun adjusting & firing
towards the mouse, but would like to switch weapons.
I am having problems with how to fire a shell up ...
0
votes
1
answer
95
views
Change screen size in PyBox2D
I would like to use pybox2d's Framework class to visualize the simulation. However, the default screen / windows size is 640 x ...
0
votes
2
answers
2k
views
Architecting server for real-time multiplayer game with Unity client
I'm thinking about developing a scalable real-time online multiplayer game. it would be an online 2D battle game. I'm an experienced software developer but this is my first experience in game ...
0
votes
1
answer
79
views
Perpendicular inelastic joint of two bodies in PyBox2d
I would like to create two objects of different density and (inelastically) weld them perpendicular together, so that the final object forms an L. Afterwards, I want to be able to assign a position ...
0
votes
1
answer
368
views
Create list of images for animation
I'm using pygame and trying to create an animation by going through a list of variables:
self.image = self.walk_right[self.index]
I have loaded the images into ...
2
votes
1
answer
740
views
Efficiently find all points within a circle
I am writing code that requires me to find all points within circle on certain parts of the screen hundreds of times per frame. I wrote a quadtree for this and have 1 method called query_circle that ...
0
votes
0
answers
933
views
Pygame lags on simple game
I am trying to build a game in pygame, however any movement feels laggy. Its not a big lag but more like a small stuttering.
I created a boiled down version to showcase this.
The code in the git below ...
3
votes
1
answer
4k
views
Efficient way to check collisions for many objects
I am making a Bloons tower defense game and I came across a problem with regards to collisions. The way my code currently works is all the current bullets on the screen(could be potentially thousand) ...
1
vote
1
answer
177
views
Model path of bullet to hit future position of balloon
I am coding a Bloons Tower Defense Game and one of the problems I have is how to shoot a projectile from a tower and have it hit a balloon that is moving along a certain path. The way I am currently ...
0
votes
1
answer
803
views
How can I make a multi-line dialog box?
I'm trying to make a dialog box with pygame, and initially everything was going well. I printed the letters sequentially on the screen and it works very well in a single line of text, but when I use <...
0
votes
1
answer
227
views
How to extract the largest mipmap of a DXT5-compressed VTF file?
I'm trying to programmatically convert the largest mipmap of a 32x32 DXT5-compressed VTF file to a PNG. Here is what the image should look like after conversion:
And here is what mine looks like:
...
-1
votes
2
answers
95
views
1
vote
1
answer
2k
views
Using collision with classes in pygame
I am trying to make some games using classes. But I got a problem when trying to make the ping pong game. I made 2 paddles and a ball but I just do not understand how should I make the collision ...
0
votes
1
answer
586
views
Python GLFW and PyOpenGL: How to update a VBO from a thread while rendering at the same time
I'm really new to this community. I'm sorry for any mistakes in advance.I'm making a game like minecraft with GLFW and OpenGL. The problem is, I just can't render a VBO while I update it from another ...
0
votes
1
answer
329
views
How to play a sound when changing the value of a tkinter scale
I'm making a settings menu for my game, and would like to know if it is possible to play a sound every time a value of a scale is changed. For example, the user changes the scale from 1 to 2, a sound ...
0
votes
0
answers
291
views
Not being able to display pygame.freetype text
I'm trying to make a game where the player has to dodge asteroids coming, and I'd like to display the lives. I looked up some tutorials and decided to settle on pygame.freetype. When I run the code ...
0
votes
1
answer
503
views
How to properly set up a lives system for a side-scroller in pygame
I have a game where the player has to dodge asteroids coming towards it, and I would like to incorporate a life system. Unfortunately, when I tried this, it still killed my player immediately. I ...
0
votes
1
answer
744
views
1920x1080 Image don't fit to 1920x1080 screen
I'm making a game with pygame and I wanted to add a background for my game. I'm trying to add a 1920x1080 background to a 1920x1080 screen, but part of the background is not visible.
My code:
...
0
votes
1
answer
1k
views
pygame only moving when moving mouse
Every time I press the left or right arrow keys it moves a little however when I wiggle the mouse around while pressing the keys the player flys across the screen for no reason. I'm following ...
-1
votes
1
answer
52
views
The vector aiming to enemy is in wrong direction
In a 2d game, I am trying to shoot at a moving enemy and the vehicle that is shooting is also moving. However, the velocity of the bullet is not in the same direction as the position of the enemy. The ...
1
vote
1
answer
131
views
Optimizing overlapping units vision calculations in RTS using PyGame
Currently I'm developing a RTS game using Python/PyGame and I got some problems with fps drops when there are many units on the screen.
Using Snakeviz profiling I found out that the function ...
1
vote
1
answer
117
views
How can I implement an algorithm to mix potions?
I would like to build something that allows me to obtain potions using two identical lists of ingredients.
...
1
vote
2
answers
4k
views
Is there a way to make a game that uses Python/pygame that will work through a web browser?
Is there any framework or method that will allow to use browser to run a 2D game made in python with pygame graphical library?
0
votes
1
answer
95
views
How to generate reliable labels for game state using Python and Pygame
I've been looking into making a small game where you would walk around and do puzzles (perhaps do some combat if I can get the basic framework going). So far, Googling for general game patterns used ...
1
vote
0
answers
2k
views
Circle and circle collision (with physics), but when lots of circles pile up things go wrong [closed]
I'm trying to make an as realistic as possible ball physics simulator. Currently, I worked out all the collisions between balls, and it works really well when there are few balls. But once you create ...
1
vote
1
answer
6k
views
Collision detection between moving objects (in pygame)
I am trying to work out how to detect and resolve collisions between moving sprites in pygame, I followed the logic of this video: https://www.youtube.com/watch?v=VpSWuywFlC8
The basic idea is that I ...
0
votes
1
answer
188
views
Converting mesh vertices to world coordinates for raycasting
My goal is to figure out if a point exists within a 3D polygon. To do this here is what I am doing:
Load obj mesh
...
0
votes
1
answer
329
views
How do I change only the angle of a certain PNG relative to the position of the mouse? (Python, Pygame)
Basically, I'm doing a game for a school project and I am not really sure how to make a player point towards the mouse pointer in a pygame tab. also if anyone has ideas of how i could point a bullet ...
0
votes
0
answers
949
views
What is a good method for 2D isometric lighting in Pygame?
I'm making my first isometric game in Python using Pygame. It's a 2D tile-based dungeon crawler, but I want to create a nice lighting system. I've made a random level generator that creates the rooms ...