How to Make a First Person Shooter like Wolfenstein 3D
HTML-код
- Опубликовано: 29 сен 2024
- Creating a Wolfenstein 3D clone using Python and OpenGL. Python 3D Game Tutorial.
The main stages of creating a 3D Game in the style of a retro First Person Shooter in Python.
Used: Pygame, ModernGL, PyTMX, PyGLM, Numpy
Source Code:
github.com/Sta...
#coderspace #wolfenstein #python #opengl
These AI voices are so unnatural.
They kind of make you feel uncomfortable, don't they?
But if you think about it, would you also express such childish criticism towards a mute, disabled or otherwise disadvantaged person (this includes the lack of training in a foreign language)?
Those who saying "I can't be good as him"
I guess he has years of experience or Maybe this game took him days/months (because see the time gap between this and his last video) so that means he did alot of research
I presented this game in Community Posts 3 months ago. It took about a week to create.
@@CoderSpaceChannelwould you mind sharing which community?
take a look at the Community tab on this channel
So very interesting... I wish I could understand at least a quarter of what you're doing.
А туторы по Vulkan будут?
I dont get how programmers can get as smart as this guy as one myself ill never be this good i doubt
I believe you can do it if you had the same years of experience
@@Vextrove thank you bro thats inspiring
Whether you get this good or not is almost 100% up to you. You may have a lot to learn, but all the resources are out there! Don’t let anyone tell you you’re not smart enough. You just have to put in the hours.
@@PeranMe Yeah, I'm not gonna get this good with pygame + open gl, because honestly.... I'd rather develop games in a more straightfoward way. (either a 2d game with pygame, or in the case of a 3d game like this one, just using a game engine.)
Yeah you will just keep doing it big dawg 💪💪💪
Time to start coding again
How’s it going?
You made a common mistake made by many indie developers. The aspect ratio for the interface. You have hardcoded it to be for 16:9 screens. Often this is done for convenience while in the initial steps of making the game but is left there as it becomes harder to change the more you build code around it. Always start from the point of view that you do not know the aspect ratio and code from that from the start of the project. That way, when you introduce the ability of the user to select the screen resolution they want to play in it will not affect your HUD or menus in any way even if the aspect ratio is 21:9 (becoming more common with gamers using curved screens) or even wider!
I won't call that a mistake, just a recommendation for bigger games. We can't think about every future use case. It's okay to hardcode some stuff for a few elements, we have only so much time.
@@intron9 Well, it is a mistake but not because it's not thinking about future case as you put it. Current case is that there are a multitude of aspect ratios in common use, 4:3, 16:9, 16:10, 21:9 to name the 4 most common (though it's rare now to find anyone still using 4:3). Programming a game to respond to aspect ratios correctly from the start of the project not only ensures support for those mentioned ratios but also any unforeseen future ones.
For example, the game "theHunter: Call of The Wild" had it's map hard coded for 16:9 for ages before they were able to figure out how to fix it for other aspect ratios. The problem there was the placing of waypoints because it could not figure out where the mouse pointer was actually pointing to on the map! Seems a simple fix but it took them a long time because hard coding makes the rest of the code dependant on it too and so harder to change later down the line.
But, even though it's more common in indie games it's not limited to them! Red Dead Redemption 2 had a weird bug on my 16:9 2K system (before I upgraded to 21:9) where it seemed to be rendering the world at 18:9 then squashing it width ways to 16:9 while overlays like the mini-map were correct at 16:9. When I reported it to their tech support I was told it was my HDMI cable even though I told them I was using Display Port! Very poor response! Especially when a cable can not change the aspect ratio of the game world while keeping 2D overlays unaffected! In fact, I've never heard of a cable changing the aspect ration of a display signal at all!! Funny how it got fixed mysteriously in the next major update! LOL
@@TanjoGalbi So ... when are you ready to show your game with all of those specifications implemented?
I can't wait to see it. Thank you!:)
@dieSpinnt TanjoGalbi raised a valid point and offered constructive criticism for all viewers to consider. He also responded respectfully to a reply. Regarding the topic at hand, whether or not @TanjoGalbi has a reference code is irrelevant. He was simply sharing his perspective and presenting arguments he felt were important. Unfortunately, your response reflects an inability to engage with the objective points of the discussion. You should reflect on that, though I suspect you may unfortunately lack the self-awareness to do so.
To see Python reach such speed is astonishing. How is it possible? Is it the hardware, the C libs (numpy, opengl,...)? Magic! Love your stuff dude
In the original Wolfenstein 3D the doors opened horizontally. They only open vertically in the secret doom level due to how doors worked in Doom 2
Yeah in Doom floors and ceilings could change in height.... walls/doors couldn't move horizontally. Also in Doom 2 the Wolf3D door handles were on the side... in your game the handles are near the floor....
There's an unused linedef (124?) that was intended for horizontal doors in Doom 2.
@@revolverocelot6587handy for source ports
cool vid. fyi, don't make a relationship between player and camera. there is no need. just have the camera follow the player
This would have been a cool video if you didn't ruin it with text-to-speech.
yea, and the sound effects he uses for the game sound goofy.
also the rat npc looks weird and isn’t even necessary, if you ask me.
Great video, one type of problem ive always had with both these types of engines and raycaster engines is rendering halfblocks/slopes etc. Could you make a video about this?
Can‘t play doom on a pregnancytest anymore😢
The artificial voice for the narration keeps me away from the content, sorry.
@@knight5370no he is spot on. It really is distracting
They kind of make you feel uncomfortable, don't they?
But if you think about it, would you also express such childish criticism towards a mute, disabled or otherwise disadvantaged person (this includes the lack of training in a foreign language)? Of course, your criticism is absolutely valid. Nobody is forcing you to watch this content. Bon Voyage!:)
Thanks again for the content and in-depth explanations! I always look forward to your videos
Amazing brother!!! Do you plan to increase it, add multiple floors, stairs, diagonal walls, powerups, episodes, bosses and more?
One year ago, you made a video about DOOM (Wolfenstein) game in Pygame. Is there any difference between this and that version?
That one was more native, this one uses opengl
The other one was made using raw pygame with raycasting, meaning the rendering is done entirely via the CPU, and the game is actually 2d, so much so that the ground in that game is not a texture, but just a colored rectangle.
This one actually uses the GPU (Hence why it's so much more complicated to work with) but that means it's no longer pseudo-3d but ACTUALLY 3d, which means you no longer need to rely on raycasting to render the textures, and you can more easily remove the limitation of only being able to aim horizontally. Also since you're using the GPU, you can optimize it more, since it's no longer just using the CPU for everything.
I've taken a look at the repo and I must say that's pretty good written code. I like how you organized the classes. This is very neat, congrats!
Wow! How could I learn game concept like you. I'm always impress with your knowledge. I try to understand some concept watching gaming videos, but I think I need some books to learn too.
I'd be lying if I said I wasn't disappointed that this wasn't the next episode of recreating the original doom engine, but you don't owe us anything (so do what you want) & this is still awesome and interesting.
Why using dictionaries instead of arrays/lists for map data?
really brilliant video, you are very good at what you do
bro please make a full tutorial... noob python devs like me are unable to make all of this from scratch by our own xD
I have never been able to find a good tutorial about how to implement GL graphics on pygame :(
Even a expert python programmer can't understand this, you need mathematical knowledge and knowledge about rendering and all
The OpenGL 3D Engine series has actually been extremely valuable to me for learning about OpenGL with pygame. But I also spent a LOT of time afterward just testing things in a simple pygame app with an OpenGL context to figure out how they work, what can break certain things and why, etc... Alot of the math involved is still completely foreign to me though.
Will you make a whole game? Where can I buy it?
finally some good pygame content
that's why I like this channel
This is brilliant beyond compare! Love your tutorials. When I tried to run the code, the shaders generate an error saying “slot unavailable for layout location” and TypeError: 'NoneType' object is not subscriptable. In context of understanding what’s happening at a deeper, any help would be much appreciated.
Thanks for Borderlands music.
skybox for outdoor levels, double sided triangles to get rid of the vertex order/culling. just use pixel shader that renders scatter light reflection cache fast, ie the whole scene but fast approximation.. use sprite rendering for bounce scatter lighting 360 degree fast image renders, similar to g-buffer but for scatter lighting.
instance the per pixel fast reflection cache object light emission/reflection approximation spheres, even textured with object spheremap if you so choose
Try plane-triangle scan line at once z-buffered line-texturing rendering on old slow systems, simply multi-threadable also.
ahem, moderngl does not install with recent build tools 143 for visual studio. I dont like bugged installers, pip install moderngl.
THANK YOU SO MUCH I FINALLY FINISHED IT
🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳
Zaaaaaamn that looks more difficult than rocket science 😳😳😳
nice, but crashes on me, the assets have no sprite folder,idk,every modules are fine,anyway I'm Impressed, in this video , I'm still new in coding python btw
Empty folders were not added to the repository. Fixed, try again
got it,thanks@@CoderSpaceChannel
I did the first part of the voxel engine for this tutorial but now there's all this new stuff which I don't understand how to add now
We want tutorial for it
Thanks 🙏🏻
I have a question
What is the name of map making app?
Why don’t you speak with you’re own voice?
Can you create a 3D phisycs engine?
He already posted a video on that topic
What's up with the AI voice on these?
Awesome vid! I have 1 question: why the main class deal with the opengl context initialization instead of engine class?
I'm relatively new to this. I'm on the journey of making a 3d game opengl with the absolute bare-minimum stuffs in Java, but I watched this video and is just what I'm looking for, but in python.
The way that I'm currently doing this in short is:
Main class:
main(){
new Engine().run();
}
Engine class:
public void run() {
init();
loop();
clean();
}
private void init() {
// init window
// init opengl context
// init shaders
// load model and create gameobject (example: a character with a texture)
// init controller stuff
// init projection and view matrices
}
private void loop() {
// init time
while {
// start time
// update method
// render method
//window class: swap buffers and poll events
// show fps ups on screen
}
}
private void clean() {
// clean buffers object and finish game
}
Is this organization code correct? I'm trying to apply best practice and all the code thanks!
Probably just coding style. Python tends to throw it all in main, while Java style would go for an extra screen and OpenGl context class, injected everywhere one needs it. Generally seperation of tasks is a good idea
The main class seems to be for initializing the display, which includes the initialization of the OpenGL context, and running the engine. The engine deals with the game itself. This approach seems very clean and easier to manage
WOW, new video
Absolutely amazing!
HELP!!! How do I create a parser
Can you please make a video that we will just follow just to replicate this "Einstein-like" work?
Pleeeeease?
This video is a symbiosis of two tutorials, about creating a voxel engine and a video about raycasting. Creating a level is like one layer of voxels, and the main game logic is taken from the tutorial about raycasting
Sooooooo good.
Python has so much potential...
It has for sure. But not really for those types of applications. it’s sooo sloooooow
Well done indeed! Looks very nice and well made!
That Borderlands 2 music in the background sent me straight back to 2012.
Hello, how come the accuracy of the enemies shooting is around 5% in my case? Txh
Just resolved the deps, and the HUD sprites in the game are huge, there are no door sprites I can see, which is why I can't move through the gaps I guess if the door is "closed", and the console keeps pumping out: "libpng warning: iCCP: known incorrect sRGB profile" - what am I missing?
Warnings were a red herring, it was using Intel graphics instead of Nvidia, why would the Intel graphics cause some of the images to not display? It is an i7-9750H with integrated UHD 630 Graphics, should be man enough to display an image? IT was the HUD images were massive in the centre screen, enemies and other sprites and doors, all other textures were present.
Same problem... Did you solve it?
@matricesingolare9150 yes it was using on board graphics instead of my graphics card, not sure why that affects it but that solved it for me.
@@Wilksey37 thank you!!!
Just a question about some design choices. I get it that no swastika was used. The original version was banned in Germany for that reason. But why do you display my murderous and evil ancestors as rats?:) That is dehumanizing and waters down an important historical lesson: Everyone of us is able to do the worst and unthinkable atrocities. Just some "gamification" is needed, like a hateful ideology paired with bad environmental or economical conditions plus some kind of reward for you.
But thank you for the video!:)
Rats are enemies unique to the SNES port of Wolfenstein 3D. Mutant rats were added to the game in order to replace dogs, because of the strong censorship of the port.
@@CoderSpaceChannelyou could’ve just used dogs, lol
As always, good work!
Я жду от тебя туториал по Python , только ты можешь объяснить мне python.
Было бы круто если бы ты снимал ещё на русском языке, я английский не понимаю но судя по проектам ты красавчик
Looking beautiful m8! Congrats on the performance, given it running python on cpu side. Also cool that you've used OpenGL. These days Vulkan has been very compelling.
Why is the sprite sheet a txt file not a png one in github
run the game and the sprite sheet will be automatically generated
thank you man
It's awesome. Waiting for Quake.
I really love these videos and they are helping me a great deal on working with my own engine
Amazing work, would be interesting to add a way to adjust the ceiling and floor height and perhaps add slopes to the levels.
Can we get a assimp and modern tutorial
You deserve a million subscribers for sure!
This is pretty cool. Is your code open source and available to play with?
yeah, it's open source, MIT license
it doesn't work, i had to remove the doors
they don't automatically open
@@eifclub978 Press F
how to open doors?
F
What will this run on?
Shift the word.
Sorry but you are 30 years too late.
Impresive! Very Nice!
wow
Pretty impressive, although honestly, I doubt I would have the patience to implement such a game in such a low level way, and instead would probably resort to a game engine. (Which again, only makes your approach even more impressive.)
Any plans to do a Doom game tutorial in Vulkan?
תודה!
Thank you too!
I'm on a journey to code a software rasterizer that can run decently well for old looking game graphics and still be written in python and use software to code the rasterizing algorithms. Thus far with the use of numpy I can draw a triangle every frame at around 1000 fps when pygame's triangle algorithm can do it in 2500 fps. The difference is huge but that one uses highly optimized code and basic GPU parallelization. These videos help me figure out how to do this better each time. Thanks for the work.