PYGLMaze - Python + OpenGL Example Game

Ғылым және технология

This is a example 3d maze game written in Python + OpenGL to provide "minimal" game with few additional stuff, such as: shadow mapping, post processing effects, simple collision/physics.
the object is to get to the other end and touch the "magical" blackhole.
the maze is randomly generated each time the game is booted up, but in the "labyrinth.py" file, you can add fixed seed if you want the same maze everytime.
the "main.py" checks for required libraries at the starts and provides the pip commands that need to be run.
Lots of refactoring to the code could be done.
GitHub : github.com/Blakkis/PyGLMaze
See reddit: / 3d_fps_maze_game
And yes, I'm still working on my C++ Jase Engine.

Пікірлер: 62

  • @user-nk9fx6zn2l
    @user-nk9fx6zn2l3 ай бұрын

    This is really cool man, well done. Definitely taking inspiration from your code for my own learning.

  • @AntechamberAE
    @AntechamberAE9 ай бұрын

    I love this aesthetic so much holy

  • @wilykary
    @wilykary2 жыл бұрын

    Just checked ur code and its very well organized. trying to learn pyopengl and ur code is helping a lot!!

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    Thanks. It could use more refactoring and more comments, but glad that the code itself speaks enough.

  • @miles7267
    @miles72672 жыл бұрын

    How did you get such good performance from it? All my experience with anything even minorly complex in python is that it has been very slow

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    There's not much of Python code running. I haven't profile anything yet, but the wall check collision (which is done against all walls in the scene, is probably the biggest performance drain) Now the graphics side of things. With OpenGL, you can utilize GPU to do all the heavy lifting.

  • @miles7267

    @miles7267

    2 жыл бұрын

    @@Blakkis yeah I imagined that once you had loaded everything onto the GPU that would be pretty quick, but I was wondering how everything else would go so quickly. Are you loading in new vertex data each frame, or just doing transforms to preloaded vertex buffers?

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    @@miles7267 Everything is loaded during initialization. Only debug lines (if being used) require updating VBO (Vertex buffer object) per-frame. There's only few "glDrawArrays" and "glDrawArraysInstanced" calls which is really cheap with simple geometry and the lighting calculations here a pretty much non-existing (Only calls to texture sampling for shadow mapping). Modern GPUs are insanely fast and a "game" like this is just a breakfast for them.

  • @ZyfoAI

    @ZyfoAI

    Жыл бұрын

    @@miles7267 keep in mind a lot of the performance is based on just the power of ur gpu

  • @smanzoli

    @smanzoli

    Жыл бұрын

    All Python libs ate written in C... in dumb tests (pure fool loops, unreal stuff) Python is slow... in REAL complex codes, Python is really fast, because most of time it's not running Python. Anyway, for pure Python stuff, for a long time now, you can jit compile it an get it 50x faster, close to unoptimized C++ And Mojo is comming

  • @flcordis
    @flcordis2 жыл бұрын

    Wow, i got a College work to made a OpenGL game... but i'm very noob on that stuff, i will study your code and change some texture and try to add a IA, like a monster if its possible, very nice job dude, thanks!

  • @Blakkis

    @Blakkis

    Жыл бұрын

    Thanks.

  • @atibyte
    @atibyte2 жыл бұрын

    Nice work!

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    Thanks.

  • @notlocal6925
    @notlocal69252 жыл бұрын

    cool but tell me how to import a character using Opengl and Python

  • @pajeetsingh
    @pajeetsingh3 жыл бұрын

    Nice one bro. CS 1.6 feels.

  • @Blakkis

    @Blakkis

    3 жыл бұрын

    Thanks.

  • @Rene-uz3eb
    @Rene-uz3eb Жыл бұрын

    I took a look at pyopengl and was a bit dismayed with it using glut, which is not being maintained. Do you see any problem using Cython to create a openGL engine wrapper that uses a modern window lib like glfw or glew?

  • @Blakkis

    @Blakkis

    Жыл бұрын

    To my understanding GLUT is part of the library only if you don't provide any other way of window creation/handling. All the examples that i have done utilizes pygame (or SDL) for window creation/handling. Thus no need for GLUT stuff at all. There does exist GLFW python wrapper which should work with the PyOpenGL as well. GLEW is not a window lib, it's a "OpenGL Extension Wrangler" which helps determining which extensions are available and handles the setup of GL function pointers.

  • @Rene-uz3eb

    @Rene-uz3eb

    Жыл бұрын

    @@Blakkis good to know, thanks! Yes I mixed up glew with glfw instead of glad.

  • @dankmemesstudios3987

    @dankmemesstudios3987

    Жыл бұрын

    @@Rene-uz3eb lots of 4 letter words begining with gl :))

  • @XENON2028

    @XENON2028

    10 ай бұрын

    you should also take a look at moderngl! it is faster then pyopengl and has a simpler api while still being opengl

  • @denajser
    @denajser10 ай бұрын

    Ого, 3д гра на пайтоні, респект

  • @mtalhakhalid1679
    @mtalhakhalid1679 Жыл бұрын

    cool blackhole in middle to goto next level

  • @Mushele
    @Mushele Жыл бұрын

    Is there normal mapping or just super sexy diffuse texture? Looks crisp

  • @Blakkis

    @Blakkis

    Жыл бұрын

    Just diffuse maps.

  • @mumblety
    @mumblety2 жыл бұрын

    so, I tried to run this but the fov and a lot of stuff is messed up. and ideas as to why?

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    What is your GPU?

  • @krzysztofwaleska

    @krzysztofwaleska

    2 жыл бұрын

    Same here. I have current AMD Ryzen, no graphic card.

  • @StarFury2

    @StarFury2

    Жыл бұрын

    @@Blakkis Also just tried it, have the same problem with messed up screen. Few textures stretching all over the screen as you move the mouse is all I see. RTX 3000 series GPU.

  • @Blakkis

    @Blakkis

    Жыл бұрын

    @@StarFury2 in the "main.py" can you try to comment out/remove "self.post.begin()" and "self.post.end(seconds, self.camera)" and see if that helps? Honestly I have no idea what might be causing it. Bug in the code?, Misbehaving drivers? i have tried my 2060, 1080 and 680 cards and i cant get the same weird result.

  • @chorok7896
    @chorok7896 Жыл бұрын

    cool bro

  • @Blakkis

    @Blakkis

    Жыл бұрын

    Thanks.

  • @100p33
    @100p333 жыл бұрын

    Красиво

  • @user-qi7ij2bk1g
    @user-qi7ij2bk1g2 жыл бұрын

    how run this projects ?

  • @Blakkis

    @Blakkis

    2 жыл бұрын

    You can download the project from github and run the "main.py". It check if you have the necessary libraries installed and if not, it prints out the pip commands needed to install them.

  • @kingleo429

    @kingleo429

    2 жыл бұрын

    @@Blakkis what about makimg it and EXE.file or an APK.file Will that work

  • @Jkauppa
    @Jkauppa Жыл бұрын

    if you do z-buffer 2d ray-cast with dda pass-through vertical line draw, you dont even have to call opengl, you can do it closely in same way as wolf3d works, and how doom should have been rendered, also with same method bounce lighting steps, for indirect shadows and lighting, and, shoot to the lights from the surface intersections for basic pixel lighting, shadow or light

  • @DarxDev

    @DarxDev

    Жыл бұрын

    fam if you're gonna go for an fps camera that has pitch control and shadow mapping, you might as well just use opengl and make a full renderer instead of a ray caster

  • @Jkauppa

    @Jkauppa

    Жыл бұрын

    @@DarxDev do you like ray tracing, there is a point why rays are cast and not just raster spammed, on cpu/gpu, no matter which processing platform

  • @Jkauppa

    @Jkauppa

    Жыл бұрын

    @@DarxDev you can of course do that

  • @Jkauppa

    @Jkauppa

    Жыл бұрын

    @@DarxDev software shader ray caster on gpu

  • @jktech2117
    @jktech2117 Жыл бұрын

    0:19 hello fellow counter strike player

  • @Blakkis

    @Blakkis

    Жыл бұрын

    Hello

  • @lovin_it.
    @lovin_it. Жыл бұрын

    Really glitchy for me here.

  • @kaua_jose

    @kaua_jose

    11 ай бұрын

    me too

  • @youyoujimWithoutV
    @youyoujimWithoutV Жыл бұрын

    how to run it??

  • @Blakkis

    @Blakkis

    Жыл бұрын

    download/clone the project and run "main.py". It checks if you have the necessary libraries and provides the pip commands to download them if you don't have them.

  • @youyoujimWithoutV

    @youyoujimWithoutV

    Жыл бұрын

    @@Blakkis when i launch its buged like the player is glitched in a wall or smth

  • @Blakkis

    @Blakkis

    Жыл бұрын

    @@youyoujimWithoutV Some people have reported it as well, but i'm unable to debug it since i can't reproduce it on any of my machines.

  • @youyoujimWithoutV

    @youyoujimWithoutV

    Жыл бұрын

    @@Blakkis ok

  • @Henry-sv3wv

    @Henry-sv3wv

    10 ай бұрын

    i also have the glitchy: EndeavourOS, Radeon RX580

  • @fykskyle5526
    @fykskyle5526 Жыл бұрын

    backrooms??? sus?!?

  • @eprst0
    @eprst0 Жыл бұрын

    Who are you

  • @Blakkis

    @Blakkis

    Жыл бұрын

    My real name is Toni and i'm from Finland.

  • @lifeisstr4nge
    @lifeisstr4nge9 ай бұрын

    PyDust2

Келесі