1

When running my Pygame 3d maze, I encountered a new error when loading it up.

Here is my error:

 Environment updated. Reloading shell...
pygame 2.6.1 (SDL 2.28.4, Python 3.11.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI3: Screen seems not DRI3 capable
MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INCOMPATIBLE_DRIVER)
libEGL warning: egl: failed to create dri2 screen

Here are all of my dependencies that are in my code:

requires-python = ">=3.11"
dependencies = [
 "panda3d>=1.10.15",
 "pygame>=2.6.1",
]

I have spent time researching what this means, but it only comes up as a Windows failure, and my PC is fine. These are related to my graphics card and my PC's bandwidth. I have run this on every computer I have used without problem.

I am using Python on replit. So this shouldn't even be pulling this error from what I know

Can anyone please tell me what this means?

Here is my main.py:

import pygame
import math
from maze import Maze
# Constants
SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600
MAZE_WIDTH, MAZE_HEIGHT = 41, 41
BLOCK_SIZE = 40
SPEED = 0.1
FOV = math.pi / 3 # Field of view
RAY_COUNT = 500 # Number of rays to cast for rendering
MAX_DEPTH = 20 # Rendering distance
MOUSE_SENSITIVITY = 0.0002 # Reduced sensitivity
class Game:
 def __init__(self):
 pygame.init()
 self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
 pygame.display.set_caption("3D Maze Game")
 self.clock = pygame.time.Clock()
 self.maze = Maze(MAZE_WIDTH, MAZE_HEIGHT).generate()
 self.player_x, self.player_y = 1.5, 1.5
 self.angle = math.pi / 4 # Player facing direction
 # # Load wall texture
 # self.wall_texture = pygame.image.load("wall.png")
 # #self.wall_texture = pygame.transform.scale(self.wall_texture, (100, 100))
 # Mouse control settings
 pygame.mouse.set_visible(False)
 pygame.event.set_grab(True)
 def cast_rays(self):
 """ Raycasting with proper fade-to-black shading and textures """
 for ray in range(RAY_COUNT):
 ray_angle = self.angle - (FOV / 2) + (FOV * ray / RAY_COUNT)
 depth = 0
 while depth < MAX_DEPTH:
 test_x = int(self.player_x + math.cos(ray_angle) * depth)
 test_y = int(self.player_y + math.sin(ray_angle) * depth)
 if self.maze[test_y][test_x] == 1:
 break # Stop at walls
 depth += 0.05
 # Fade into black instead of gray
 line_height = min(SCREEN_HEIGHT, int(SCREEN_HEIGHT / (depth)))
 shade = max(0, 255 - min(255, depth * 20)) # DARKER FADE
 pygame.draw.rect(
 self.screen, (shade, shade, shade),
 (ray * (SCREEN_WIDTH // RAY_COUNT), SCREEN_HEIGHT // 2 -
 line_height // 2, SCREEN_WIDTH // RAY_COUNT, line_height))
 # self.screen.blit(
 # pygame.transform.scale(
 # self.wall_texture,
 # (SCREEN_WIDTH // RAY_COUNT, line_height)),
 # (ray * (SCREEN_WIDTH // RAY_COUNT),
 # SCREEN_HEIGHT // 2 - line_height // 2))
 def handle_input(self):
 keys = pygame.key.get_pressed()
 if keys[pygame.K_w]: # Move forward
 new_x = self.player_x + math.cos(self.angle) * SPEED
 new_y = self.player_y + math.sin(self.angle) * SPEED
 if self.maze[int(new_y)][int(new_x)] == 0:
 self.player_x, self.player_y = new_x, new_y
 if keys[pygame.K_s]: # Move backward
 new_x = self.player_x - math.cos(self.angle) * SPEED
 new_y = self.player_y - math.sin(self.angle) * SPEED
 if self.maze[int(new_y)][int(new_x)] == 0:
 self.player_x, self.player_y = new_x, new_y
 if keys[pygame.K_a]: # Strafe left
 new_x = self.player_x - math.sin(self.angle) * SPEED
 new_y = self.player_y + math.cos(self.angle) * SPEED
 if self.maze[int(new_y)][int(new_x)] == 0:
 self.player_x, self.player_y = new_x, new_y
 if keys[pygame.K_d]: # Strafe right
 new_x = self.player_x + math.sin(self.angle) * SPEED
 new_y = self.player_y - math.cos(self.angle) * SPEED
 if self.maze[int(new_y)][int(new_x)] == 0:
 self.player_x, self.player_y = new_x, new_y
 def handle_events(self):
 lookleft = False
 lookright = False
 for event in pygame.event.get():
 if event.type == pygame.QUIT:
 return False
 elif event.type == pygame.KEYDOWN:
 if event.key == pygame.K_e:
 lookleft = True
 elif event.key == pygame.K_q:
 lookright = True
 elif event.type == pygame.KEYUP:
 if event.key == pygame.K_e:
 lookleft = False
 elif event.key == pygame.K_q:
 lookright = False
 if lookleft:
 self.angle -= 0.1
 if lookright:
 self.angle += 0.1
 return True
 def run(self):
 while self.handle_events():
 self.clock.tick(60)
 self.handle_input()
 self.screen.fill((0, 0, 0))
 self.cast_rays()
 pygame.display.flip()
 pygame.quit()
if __name__ == "__main__":
 Game().run()

Here is my maze.py:

import random
class Maze:
 def __init__(self, width, height):
 self.width = width
 self.height = height
 self.grid = [[1] * width for _ in range(height)] # Walls everywhere initially
 def generate(self):
 def carve_maze(x, y):
 """ Recursive maze generation with branching paths """
 directions = [(0,1), (1,0), (0,-1), (-1,0)]
 random.shuffle(directions)
 for dx, dy in directions:
 nx, ny = x + dx * 2, y + dy * 2
 if 1 <= nx < self.width - 1 and 1 <= ny < self.height - 1 and self.grid[ny][nx] == 1:
 self.grid[y + dy][x + dx] = 0
 self.grid[ny][nx] = 0
 carve_maze(nx, ny)
 # Ensure proper maze size for complexity
 self.grid[10][10] = 0
 carve_maze(1, 1)
 return self.grid
if __name__ == "__main__":
 maze = Maze(41, 41) # Larger maze size for a full experience
 maze_map = maze.generate()
 for row in maze_map:
 print("".join(['#' if cell else ' ' for cell in row]))
asked May 28 at 0:10
4
  • 1
    This will not work on replit as it is a web environment, your code runs remotely on a server, and using vulkan requires a GPU. It will work if you run this locally in your computer. Commented May 28 at 4:41
  • 2
    @Snoopy, Replit provides graphic environments such as Pygame template. Anyway @CloudDev, post a minimal reproducible example including your .replit and pyproject.toml files. Commented May 28 at 8:01
  • @relent95 it seems not to be working since the OP gets errors. Commented May 28 at 8:28
  • I thougt that was weird as it works on all computers but this one Commented May 28 at 17:15

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.