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
This is really cool man, well done. Definitely taking inspiration from your code for my own learning.
I love this aesthetic so much holy
Just checked ur code and its very well organized. trying to learn pyopengl and ur code is helping a lot!!
@Blakkis
2 жыл бұрын
Thanks. It could use more refactoring and more comments, but glad that the code itself speaks enough.
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
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
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
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
Жыл бұрын
@@miles7267 keep in mind a lot of the performance is based on just the power of ur gpu
@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
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
Жыл бұрын
Thanks.
Nice work!
@Blakkis
2 жыл бұрын
Thanks.
cool but tell me how to import a character using Opengl and Python
Nice one bro. CS 1.6 feels.
@Blakkis
3 жыл бұрын
Thanks.
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
Жыл бұрын
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
Жыл бұрын
@@Blakkis good to know, thanks! Yes I mixed up glew with glfw instead of glad.
@dankmemesstudios3987
Жыл бұрын
@@Rene-uz3eb lots of 4 letter words begining with gl :))
@XENON2028
10 ай бұрын
you should also take a look at moderngl! it is faster then pyopengl and has a simpler api while still being opengl
Ого, 3д гра на пайтоні, респект
cool blackhole in middle to goto next level
Is there normal mapping or just super sexy diffuse texture? Looks crisp
@Blakkis
Жыл бұрын
Just diffuse maps.
so, I tried to run this but the fov and a lot of stuff is messed up. and ideas as to why?
@Blakkis
2 жыл бұрын
What is your GPU?
@krzysztofwaleska
2 жыл бұрын
Same here. I have current AMD Ryzen, no graphic card.
@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
Жыл бұрын
@@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.
cool bro
@Blakkis
Жыл бұрын
Thanks.
Красиво
how run this projects ?
@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
2 жыл бұрын
@@Blakkis what about makimg it and EXE.file or an APK.file Will that work
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
Жыл бұрын
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
Жыл бұрын
@@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
Жыл бұрын
@@DarxDev you can of course do that
@Jkauppa
Жыл бұрын
@@DarxDev software shader ray caster on gpu
0:19 hello fellow counter strike player
@Blakkis
Жыл бұрын
Hello
Really glitchy for me here.
@kaua_jose
11 ай бұрын
me too
how to run it??
@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
Жыл бұрын
@@Blakkis when i launch its buged like the player is glitched in a wall or smth
@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
Жыл бұрын
@@Blakkis ok
@Henry-sv3wv
10 ай бұрын
i also have the glitchy: EndeavourOS, Radeon RX580
backrooms??? sus?!?
Who are you
@Blakkis
Жыл бұрын
My real name is Toni and i'm from Finland.
PyDust2