It's worth noting that in the IRL Super NES/Super Famicom, that Mode 7 was natively only capable of doing linear matrix transformations (translate, rotate, scale, skew). In order to get these 3D perspectives, the console could run small graphics attribute updates at the end of every video scanline (H-DMA, horizontal blanking Direct Memory Access), changing the Mode 7 transformation matrix on each line to simulate a non-linear transform. This is also used to get different "sky" and "floor" patterns, as Mode 7 supported only one background layer; you'd draw the sky, then rapidly mirror the floor graphics into the graphics memory.
Something I want to point out - This is **not** Mode 7, this is simply a perspective projection (which, while was possible using Mode 7, was not the only purpose) Mode 7 on the Super Nintendo was a Hardware Acceleration feature that allowed a background layer to be adjusted using an Affine Transformation.
Retro Game Mechanics Explained covers this topic in his SNES series. The familiar “mode 7” perspective also depends on HDMA varying the scale factor over time as the screen is drawn.
For those who might follow along with this tutorial and write the code as it goes, note that you will not be able to get a display window to pop up (seen at 2:40 and 3:30) if you have created only a mode7 and settings file. The reason it works for them (and wasn't explained from the beginning) is because they're using PyCharm and, when they run the code in the mode7 file, their configuration is set to work off of the main file they already have coded out. Note: As of this writing, Numba is only compatible with Python 3.7-3.10, and NumPy versions 1.18-1.23. They are currently working on updating it to work with Python 3.11.
Seeing that the planes go infinitely far, the effect you coded is more in line with the Sega Saturn hardware, which had hardware support for infinite planes.
For two decades i always tout that mode7 could move a background in 3D space including 3D rotation in all directions,BUT as it turns out,a background doesn’t move in 3D space,instead a background is scewed,stretched,shrinked in whether form to fake 3D movement of it but in reality it just uses perspective correction to give the elussion of a background moving in 3D, Pretty clever, Same thing with sprite scaling trough software, Now even if a background and a sprite could,ve move in 3D space,i still would,ve considered that as fake 3D as well since everything would,ve be still flat anyway,except that it would,ve look smoother.
I hate this recent "trend" of using ai voices in videos. Please let us hear your voice, it is not a bad one I am sure, it can't be worse than the emotionless ai voices.
@@playnalisis Personally I'd still prefer a "bad" voice over an ai voice. I've done some videos before and am actually working on some and yeah it's a lot of work doing takes and retakes but its real man.
The real problem comes from the fact everyone has his own problem. Whether or not it's a lack of mic,lack of time,a very strong and pronounced accent, having the voice of a toddler etc. tho I do not like the ai voices,I don't think it's a "trend" and I think a lot of people just see ai voices as an opportunity to make videos regardless of their limitations
Demo coder here. Quite clearly explained, but so many optimizations possible... First, eliminate repeated variables (like floor_pos and cell_pos) and make all the operations in the same expression to eliminate further variables... make a sin/cosine table (or sin, sin+90) and make it integer by passing the SCALE to it and trunk (less resolution, a lot of performance boost)... Make the divisions 2-exponent where possible and convert to binary left rotations... I'd like to see how it performs with these without jit compilation.
you know they could easily sell a gimped piece of doom by just adding a second background, but scaled from the top instead to seem like a ceiling. And then the walls could be moving sprites. And the floor of course is the normal mode 7 layer.
Ah yes, the good ol Days, when Game Devs knew the Hardware and Engine they were working with. Most Devs these Days can't do anything on an engine level, they just work with the pre-made tools within the engine itself- there's a lot these Days, it's very convenient, but there's a cost which is that Developers don't actually learn anything very useful which can carry to other engines/skill-sets. I was a Game Dev for about 15-20 Years and I'm in that boat, I was part of this problem (I don't game Dev anymore outside of my own occasional personal mods). I did learn a bit of C++ and did some in depth work a bit, but it wasn't often enough to retain anything and was mostly just tinkering around until I got things to do what I wanted, I never really understood the rest of the code I was working with so I did go a bit beyond the standard these Days, but not by much and not regular enough to ever become comfortable with it. I think this is one of the big reasons we're getting so many generic/bad/buggy games these Days- overall we don't have the level of Professional in-depth knowledge in the Industry as we once did. There are many other reasons though, which add up to give us a whole lot of generic stuff.
Ok, this is very well explained and all, but the problem is that this script draws a repeating plane all the way to infinity, but what if I want to draw a plane between a set of points?
This is definitely not how mode 7 worked. Mode 7 was not "weak 3d", it was not even 3d. Perhaps an aproximation, but still does not look nor behaves like mode 7 did. In the snes, a 2x2 matrix was applied per scanline (when a scanline was finished, an interrupt is called which changes the matrix; that's how the snes was able to do it. If other consoles, like the megadrive/genesis had the ability to call interrupts at the horizontal blaking, they would have been able to achieve the same effect. Of course, this would need to be at the VDP level, and the vdp would need to have the ability to do matrix transformations quite fast).
The next improvement I'd suggest is using a plane composed of tiles, that would be closer to the real mode7, as the mode7 was a regular tile plane, composed of small tiles, that supported affine transforms during their display. Cool effects!👍
I was able to implement this into your previous DOOM-like tutorial, but it looks super janky. Like, it displays the floor and ceiling properly, and I have it use the players position and angle to move it around which also works, but it looks like its all detached from the walls. Any suggestions on how this could be fixed?
People: Pygame isn't exactly suited for 3d game develpment. Coder Space: Make a shit ton of videos on how to do 3d/pseudo 3d game development in Pygame.
Liked and already sub'd! I wish there was a way to also create HTML5 games at least from our Python scripts, especially because I have far more time to play smartphone games as opposed to PC games.
lol I don't even know how to get to the first menu that he got. How do you get GMS2 to recognize these files? Also - will this overwrite how Game Maker Studio 2 will run? I have other levels that do not use this.
"in order for the method to be executed with the performance of compiled languages" ... .ummm, python will never be executed with the performance of compiled languages. You can get reasonable performance with JIT, but it will still never compare to what you can get with a compiled language.
It's worth noting that in the IRL Super NES/Super Famicom, that Mode 7 was natively only capable of doing linear matrix transformations (translate, rotate, scale, skew). In order to get these 3D perspectives, the console could run small graphics attribute updates at the end of every video scanline (H-DMA, horizontal blanking Direct Memory Access), changing the Mode 7 transformation matrix on each line to simulate a non-linear transform. This is also used to get different "sky" and "floor" patterns, as Mode 7 supported only one background layer; you'd draw the sky, then rapidly mirror the floor graphics into the graphics memory.
Something I want to point out - This is **not** Mode 7, this is simply a perspective projection (which, while was possible using Mode 7, was not the only purpose)
Mode 7 on the Super Nintendo was a Hardware Acceleration feature that allowed a background layer to be adjusted using an Affine Transformation.
*adjusts glasses*
"well, acktually..."
Retro Game Mechanics Explained covers this topic in his SNES series. The familiar “mode 7” perspective also depends on HDMA varying the scale factor over time as the screen is drawn.
I think he/she meant "Mode 7 looking" graphics.
For those who might follow along with this tutorial and write the code as it goes, note that you will not be able to get a display window to pop up (seen at 2:40 and 3:30) if you have created only a mode7 and settings file. The reason it works for them (and wasn't explained from the beginning) is because they're using PyCharm and, when they run the code in the mode7 file, their configuration is set to work off of the main file they already have coded out.
Note: As of this writing, Numba is only compatible with Python 3.7-3.10, and NumPy versions 1.18-1.23. They are currently working on updating it to work with Python 3.11.
their ? i only hear a single dude talk
@@girlsdrinkfecktheir is singular possessive
Magnificent tutorial. Brings back memories of writing a ray-caster demo many years ago.
Incredible. Thank you. It’s simple the way you do this, but it’s also hard!
Yours are the state of the art of tutorials and their topics are so interesting. Your subscribers will increase soon.
was looking for a tutorial like this, amazing
とても参考になる興味深い解説です!
細部まで理解して、自分でも実装してみます
Such a brilliant looking effect
I always enjoy your content so much!
Nice! I am really enjoying your channel. Keep up the good work.
Seeing that the planes go infinitely far, the effect you coded is more in line with the Sega Saturn hardware, which had hardware support for infinite planes.
Just what I needed! Ty
For two decades i always tout that mode7 could move a background in 3D space including 3D rotation in all directions,BUT as it turns out,a background doesn’t move in 3D space,instead a background is scewed,stretched,shrinked in whether form to fake 3D movement of it but in reality it just uses perspective correction to give the elussion of a background moving in 3D,
Pretty clever,
Same thing with sprite scaling trough software,
Now even if a background and a sprite could,ve move in 3D space,i still would,ve considered that as fake 3D as well since everything would,ve be still flat anyway,except that it would,ve look smoother.
I hate this recent "trend" of using ai voices in videos. Please let us hear your voice, it is not a bad one I am sure, it can't be worse than the emotionless ai voices.
The problem is a lot of people do not have a good voice. And it’s very hard to do a video without takes after takes.
@@playnalisis Personally I'd still prefer a "bad" voice over an ai voice. I've done some videos before and am actually working on some and yeah it's a lot of work doing takes and retakes but its real man.
@@cheezeebutter452 there is really good Ai voice. I use it and it works
The real problem comes from the fact everyone has his own problem. Whether or not it's a lack of mic,lack of time,a very strong and pronounced accent, having the voice of a toddler etc. tho I do not like the ai voices,I don't think it's a "trend" and I think a lot of people just see ai voices as an opportunity to make videos regardless of their limitations
I agree but unfortunately ai is here to stay.
Demo coder here. Quite clearly explained, but so many optimizations possible... First, eliminate repeated variables (like floor_pos and cell_pos) and make all the operations in the same expression to eliminate further variables... make a sin/cosine table (or sin, sin+90) and make it integer by passing the SCALE to it and trunk (less resolution, a lot of performance boost)... Make the divisions 2-exponent where possible and convert to binary left rotations... I'd like to see how it performs with these without jit compilation.
Well done! Impressive channel. Love how much more you get out of pygame.
I’d love if you make a video about driving game from the driver perspective
you know they could easily sell a gimped piece of doom by just adding a second background, but scaled from the top instead to seem like a ceiling. And then the walls could be moving sprites. And the floor of course is the normal mode 7 layer.
Ah yes, the good ol Days, when Game Devs knew the Hardware and Engine they were working with. Most Devs these Days can't do anything on an engine level, they just work with the pre-made tools within the engine itself- there's a lot these Days, it's very convenient, but there's a cost which is that Developers don't actually learn anything very useful which can carry to other engines/skill-sets. I was a Game Dev for about 15-20 Years and I'm in that boat, I was part of this problem (I don't game Dev anymore outside of my own occasional personal mods). I did learn a bit of C++ and did some in depth work a bit, but it wasn't often enough to retain anything and was mostly just tinkering around until I got things to do what I wanted, I never really understood the rest of the code I was working with so I did go a bit beyond the standard these Days, but not by much and not regular enough to ever become comfortable with it. I think this is one of the big reasons we're getting so many generic/bad/buggy games these Days- overall we don't have the level of Professional in-depth knowledge in the Industry as we once did. There are many other reasons though, which add up to give us a whole lot of generic stuff.
Amazing work, I remember I played a game with similar effect 15 years ago, I think it was final fantasy but I might be mistaken.
This was incredibly helpful thank you
Super !! High level teacher updated on latest news for library !! i remeber the old demo on amiga....
чувак, ты просто клевый!!очень светлый и здравый ум! спасибо за твои труды! я тобой восхищаюсь!
ps да я русский...
great video! please continue creating tuts about interesting topics like this
Amazing video, so beautiful to see stuff that I used to implement in days in assembly, being done in a few python lines. Excellent tutorial!
I love retro style...
wow, thanks for the new video!
Ok, this is very well explained and all, but the problem is that this script draws a repeating plane all the way to infinity, but what if I want to draw a plane between a set of points?
To me, mode 7 is not just a pseudo 3D effect, it's my childhood.
Love this! Do you think you could make a tutorial on 2.5d, where you are a 2d character in a 3d environment? (Like Pokemon Diamond and Pearl)
I'll think about it
@@CoderSpaceChannel lolz!
You should make a series with nostalgic games
Hello, how put object on projected plane, i have no idea!!!
I wonder; is it possible to use this with a Wolfenstein 3d style ray cast for drawing walls?
This is definitely not how mode 7 worked. Mode 7 was not "weak 3d", it was not even 3d. Perhaps an aproximation, but still does not look nor behaves like mode 7 did. In the snes, a 2x2 matrix was applied per scanline (when a scanline was finished, an interrupt is called which changes the matrix; that's how the snes was able to do it. If other consoles, like the megadrive/genesis had the ability to call interrupts at the horizontal blaking, they would have been able to achieve the same effect. Of course, this would need to be at the VDP level, and the vdp would need to have the ability to do matrix transformations quite fast).
wow this is very interesting. I love 3D effects.
I think i know why but, why is y not 0, since were drawing a flat plane? To be more specific, what do x, y, and z represent?
The next improvement I'd suggest is using a plane composed of tiles, that would be closer to the real mode7, as the mode7 was a regular tile plane, composed of small tiles, that supported affine transforms during their display. Cool effects!👍
I was able to implement this into your previous DOOM-like tutorial, but it looks super janky. Like, it displays the floor and ceiling properly, and I have it use the players position and angle to move it around which also works, but it looks like its all detached from the walls. Any suggestions on how this could be fixed?
I think i has to do with the FOV not matching between the wall projection and the floor/ceiling projection, but I'm not sure how to remedy this.
seems to be the answer here:
gamedev.stackexchange.com/questions/176347/raycasting-with-mode7
Hmmm how can i bend the plane to make it like a sonic 3 special stage style?
I love this I'm gonna try to make a flying game via mode 7
People: Pygame isn't exactly suited for 3d game develpment.
Coder Space: Make a shit ton of videos on how to do 3d/pseudo 3d game development in Pygame.
Liked and already sub'd! I wish there was a way to also create HTML5 games at least from our Python scripts, especially because I have far more time to play smartphone games as opposed to PC games.
0:40 what's the name of this game?
Final Fantasy III
@@CoderSpaceChannel thanks
i feel as if this should be easy to add to your wolfenstein game. any tips?
This is how the seeling works in Doom
lol I don't even know how to get to the first menu that he got. How do you get GMS2 to recognize these files?
Also - will this overwrite how Game Maker Studio 2 will run? I have other levels that do not use this.
Game Maker Studio is not used in this video at all. It’s just regular Python.
What does dx, dy and focal length mean? And thx.
dx, dy - increments, one step on a 2d plane, along the x and y axes
fol_len - distance from the camera to our screen
so nice^^
Which api you use?
Pygame
You have a typo in your description, "Paygame" should be "Pygame".
thanks, fixed
@@CoderSpaceChannel Great videos, by the way. Almost makes me want to get into coding in Python!
*Nostalgic Mode7 Fans*
4:01 I tried the command and it doesn't work! Son of a program!
Sine of x (degrees) ≈ (4x(180-x))/(40500-x(180-x))
Bāshkara I approximation of sine
Just in time compilation in Python you just blew my mind lmao.
Infinite room looon like gzdoom one hahahaha
"in order for the method to be executed with the performance of compiled languages" ... .ummm, python will never be executed with the performance of compiled languages. You can get reasonable performance with JIT, but it will still never compare to what you can get with a compiled language.
wow so many clickbait youtubers out their but u hold it down
pleae can you do the first level of game like "street of rage" but in python from very begginig to end ?
Backrooms??????
Yes☠️☠️☠️☠️
you are genius :0
You are the python god! :D
я то думал, где ты пропадал, а ты вот где шляешься)
А почему ты забросил старый канал?
Почему ты перешел на англоязычный ютуб?
Потому что, там есть монетизация :)
Snes the best console
Why would anyone do this? 70 fps for doing basically nothing in a pretend 3d scene when you can get hundreds of FPS just actually doing it in 3D.
Жаль что ру видео больше нет
ew, AI generated