Code-It-Yourself! First Person Shooter (Quick and Simple C++)

  Рет қаралды 1,240,440

javidx9

javidx9

Күн бұрын

Пікірлер
@Zeptonixmusic
@Zeptonixmusic 4 жыл бұрын
-So... Which game engine do you use? -It's complicated.
@dcboules9695
@dcboules9695 4 жыл бұрын
Zsh
@achtsekundenfurz7876
@achtsekundenfurz7876 4 жыл бұрын
"Where we're going, we won't need engines."
@clamato2010
@clamato2010 4 жыл бұрын
This is a basic engine
@noahnolte7288
@noahnolte7288 4 жыл бұрын
@@clamato2010 no, it's a c++ engine
@TheSecretDev
@TheSecretDev 4 жыл бұрын
@@noahnolte7288 ha ha ha ha ha *slow clap*
@MrsRollerTwister
@MrsRollerTwister 5 жыл бұрын
me: today i force command line to say hello world this guy:
@andreasrs69
@andreasrs69 5 жыл бұрын
MrRollerTwister „Easy“ „fast“
@Pau_Pau9
@Pau_Pau9 5 жыл бұрын
Is this "hello world" program of yours interdimensional portal program to transport yourself outside of bounds of our time and space?? My mind is blown!!..
@ChumX100
@ChumX100 5 жыл бұрын
echo "hello world" * computer crashes *
@technoguyx
@technoguyx 5 жыл бұрын
Ah yes. Enslaved command line
@khilarihemanshu7581
@khilarihemanshu7581 5 жыл бұрын
@@technoguyx ah , i see you're a man of culture as well
@jmanaa9969
@jmanaa9969 5 жыл бұрын
Finally, a game my shitty laptop can run
@adamhostetler7873
@adamhostetler7873 4 жыл бұрын
LMAO
@d-o-n-u-t
@d-o-n-u-t 4 жыл бұрын
Are you sure? The minimum spec is 2 kb of memory, so I can’t run it...
@skalex055
@skalex055 4 жыл бұрын
Hold in there! Its rough
@m4rt_
@m4rt_ 3 жыл бұрын
It can always run doom Annything can run doom
@FreakyGoku69
@FreakyGoku69 5 жыл бұрын
The new Doom Eternal Gameplay trailer looks dope.
@stspapergenius
@stspapergenius 4 жыл бұрын
demise ephemeral XD
@achtsekundenfurz7876
@achtsekundenfurz7876 4 жыл бұрын
In 2020, we're using ZOOM Eternal. Just killed the boss, what to do next???
@aumbhatt5339
@aumbhatt5339 3 жыл бұрын
@@achtsekundenfurz7876 It's 2021 and the one you killed wasn't the final boss....
@achtsekundenfurz7876
@achtsekundenfurz7876 3 жыл бұрын
@@aumbhatt5339 Bad news, working at Fakebook now. Good news, Zuck is definitely the final boss!
@aumbhatt5339
@aumbhatt5339 3 жыл бұрын
@@achtsekundenfurz7876 lol😆
@miscelaneasdealguem
@miscelaneasdealguem 5 жыл бұрын
You're the Bob Ross of game programming
@punkisinthedetails1470
@punkisinthedetails1470 4 жыл бұрын
Underrated comment of 2020
@punkisinthedetails1470
@punkisinthedetails1470 4 жыл бұрын
@@Jack3G decision trees or random forests?
@ericsiemienczuk7217
@ericsiemienczuk7217 3 жыл бұрын
Nah, this guy is great, but nobody in gamedev has a calmer, or warmer voice than TheBennyBox.
@SuperchargedW12
@SuperchargedW12 3 жыл бұрын
bracil poha
@ENG-CT4982
@ENG-CT4982 3 жыл бұрын
@@Jack3G yes
@davidpike766
@davidpike766 7 жыл бұрын
Your videos are a godsend for a fledgling games programmer who want's to understand the bigger picture and not just leverage what engines give you. Thanks so much, excellent indeed!
@javidx9
@javidx9 7 жыл бұрын
Hi David, Thanks for your kind words! I'm pleased you're finding the videos useful!
@iknosabuk
@iknosabuk 5 жыл бұрын
Yeah, everything starts to make more sense when you understand what happens behind-the-scenes.
@xtdycxtfuv9353
@xtdycxtfuv9353 5 жыл бұрын
javidx9 yeah thanks i really hate unity so this is helpful
@_tzman
@_tzman 4 жыл бұрын
@@javidx9 Is this how actual engines are made or you are using hacks? Don't get me wrong, I enjoyed this video very much; Just curious though!
@TimeoutMegagameplays
@TimeoutMegagameplays 4 жыл бұрын
@@_tzman Not exactly like this, though somewhat like it, take a look at his channel because he has tutorials on how to make a 3d game engine.
@brakenthemole2377
@brakenthemole2377 5 жыл бұрын
This is such an interesting approach of teaching game engine logic. I love it, subscribed.
@javidx9
@javidx9 5 жыл бұрын
Hey thanks buddy!
@Cjduyck
@Cjduyck 5 жыл бұрын
Really enjoyed this! I'm a second year Computer Science student at University right now. This amount of explanation was perfect for someone at my experience level.
@javidx9
@javidx9 5 жыл бұрын
Thats really cool to hear Rosco, thanks man!
@TheHermitHacker
@TheHermitHacker 4 жыл бұрын
I feel like a magician just revealed his best magic trick. This is awesome.
@3DSage
@3DSage 6 жыл бұрын
Thank you so much for making this video. I love how you explain everything and how simple you made this.
@javidx9
@javidx9 6 жыл бұрын
Thanks 3DSage, no problem!
@mr.coolio4321
@mr.coolio4321 3 жыл бұрын
Well if it isnt the main man himself
@ownag.e
@ownag.e 2 жыл бұрын
nah man I still didn't understand
@IAmStefanNixdorf
@IAmStefanNixdorf 4 жыл бұрын
"So you can see, it doesn't look that great" - are you kidding me? This looks awesome. I would play the hell out of a fleshed out game with this aesthetic!
@manfrombritain6816
@manfrombritain6816 4 жыл бұрын
Pencil whipped ain't far from it. Very surreal
@ajitbansal5120
@ajitbansal5120 4 жыл бұрын
Sometimes I mean “rarely” KZbin recommendations churns out gold content.. I am glad I found this ..subscribed
@yakinbama
@yakinbama 5 жыл бұрын
Dude, you are RIDICULOUS! By far the best KZbin channel I've seen. Thanks for doing this for us hobbyist-type programmers. Your work is very much appreciated!
@scatheroy
@scatheroy 6 жыл бұрын
I absolutely loved this. Elegant and wonderful solution, and goes a long way to demystifying some concepts that are very confusing for younger coders who are excited about game programming. I will absolutely share this with my students. What a great resource :) Thank you!
@javidx9
@javidx9 6 жыл бұрын
Hey thanks! In one comment you've summed up what Im trying to do with all these videos. Very much appreciated!
@ghulamfariddev
@ghulamfariddev 5 жыл бұрын
@@javidx9 Hi. My friend send me this video link . I subscribed your channel to learn from you. I love programming and am excited to have knowledge about programming. What IDE you used for coding?
@Raphipod
@Raphipod 4 жыл бұрын
Ghulam Farid Visual Studio. You can get the newest community version for free on Microsoft’s website
@jodazague8333
@jodazague8333 4 жыл бұрын
@@ghulamfariddev He is using Visual Studio
@erto6144
@erto6144 6 жыл бұрын
Came for simple ASCII tutorial... Left with a revision of Vectors :D Great video!
@javidx9
@javidx9 6 жыл бұрын
Thanks Deadlock! Never stop learning!
@achtsekundenfurz7876
@achtsekundenfurz7876 4 жыл бұрын
@@javidx9 I enjoyed your video, but I found a few minor issues with your approach. (1) Your logic is a ray-marcher, not a ray-tracer. Ray-marchers excel at very irregular shapes; ray-tracers are for regular shapes, like cubes and grids. That leaves a lot of room for expansion, e.g. columns which are really round rather than a fixed number of polygons. However, for the scope of this grid renderer, it's overkill. Criticism is easy, but improvement is hard. So I'd propose to compute how many times the vector has to be applied until it hits a grid line (not necessarily a wall), and then apply constant increments until it hits a wall. For example, if the ray vector is (0.8, 0.6), it would hit the next x grid line after another 1/0.8 = 1.25 vectors and the next y grid line after 1.666... vectors (nice decimals for an engine of a DOOM clone, don't you think???). The other coordinate is the index needed for the collision check in the map matrix. These tests could be run either concurrently (keep two running values and update the one that's closer) or separately (compute one, then check the other direction for accidental clipping, e.g. if you missed a corner). Actually, scratch the last bit; just do the one with the smaller increment, and if you hit something, check if the other direction hit something _just_ before that last increment. If you use the smaller increment, the index changes by one if at all, and there's no risk to miss anything in between. In any case, the grid lines are where the walls are, so two lines (or two columns) can cause a hit. (2) You had both an "emergency exit" based on depth (fDistanceToWall) and one based on x and y coordinates, and then a third one by putting #'s at all borders. That's overkill. You could use x and y coordinates alone; when a ray leaves the map, it won't come back. Or maybe only use the depth check if you want to render outside views of the map. (3) You can interpolate the vectors linearly from left to right edge; that avoids the "fish-eye" effect as seen at 23:02, which would be more pronounced in a graphics mode. Fewer sin/cos computations should result in a minor but measurable speed-up. (4) To detect the edges, I'd fill an array of "x , y , type" entries before drawing. x and y would be the respective coordinates of the feature detected, and type would be WallX, WallY, or null. I'd populate that array and then scan adjacent entries for differences. If two adjacent entries are different (e.g. different coordinates, as it happens from one segment of wall to the next, or different types of wall, as it happens at a corner), AND neither is null, I'd set the type of both to null. WallX and WallY would be drawn like you did, and null would be the variant with a black "wall" segment, i.e. nShade = ' '. That would eliminate the inner loop (the one that's run 3x3 times per column) and result in higher FPS. As an added bonus, the boundary is always 2 pixels wide, not sometimes 2 and sometimes 3. With REAL graphics, I'd use a different approach: compute the exact (x,y) coordinates of the hit (btw: one of them is an integer), and then compute the distance to the point where x and y are rounded to integers. That distance could then be used to shade the wall; if it's zero, black, if it's >=delta (a value around 0.02 should look OK), default brightness (modified by other factors like distance), and if it's
@saxidia919
@saxidia919 4 жыл бұрын
like it or not this man spittin fax rn
@rogershaffer8909
@rogershaffer8909 4 жыл бұрын
Simply put, this is wonderful! Many kids in the 90s would have loved to have access to your KZbin channel and knowledge.
@javidx9
@javidx9 4 жыл бұрын
Hey thanks Roger, much appreciated!
@avananana
@avananana 6 жыл бұрын
And here I am, having trouble making a Snake replica in Processing. God damn well done.
@fablestold8722
@fablestold8722 7 жыл бұрын
doesn't look great... it looks amaaaaazzziiing! beautiful work
@javidx9
@javidx9 7 жыл бұрын
:-D Thank's Norm! ASCII FTW!
@PunisherSamo
@PunisherSamo 5 жыл бұрын
For anyone who is strugling with not appearing wall after shading floor, just take a look at condition if(y < nCeiling) at time 24:20 it will be changed to y
@Nob1ej0n
@Nob1ej0n 5 жыл бұрын
Is that what it was?! I toyed around for about 10 minutes trying to figure that out. Noticed that change, made it, messed around some more, then it finally worked. I must have messed something else up in the mean time for that not to fix my problem. Also there were a couple missing includes: #include // for vector #include // for sort
@PunisherSamo
@PunisherSamo 5 жыл бұрын
@@Nob1ej0n yep that was it..I spend with this like 20 minutes...
@anonymoususer7663
@anonymoususer7663 3 жыл бұрын
Really?!? I simply changed nShade to nWallShade to shade wall and nFloorShade to shade floor and also got it to work. I figured it was nShade value confusion. 🤦‍♂️ still works! But your fix was way easier than my fix. You simply found the missing equal sign. I added in an entire extra variable.
@anonymoususer7663
@anonymoususer7663 3 жыл бұрын
@@Nob1ej0n it works fine without the vector and algorithm includes so far...until 30:27.
@anonymoususer7663
@anonymoususer7663 3 жыл бұрын
Yep it comes back into view at 33:22. He changes it to y
@justmoritz
@justmoritz 4 жыл бұрын
I found my new side project: recreating this is a different language. Not translating it, but understanding and writing it myself
@tangerian319
@tangerian319 3 жыл бұрын
Fun fact: I'm doing this project in C# using a writable bit-map as a screen with an... interesting rendered aesthetic as well.
@hakancolakoglu5796
@hakancolakoglu5796 5 жыл бұрын
19:17 I love it when he turns to the camera all of a sudden, explain and get back to work again. He is like "We'll need to do the same thing" and I cannot do anything but giving him a thumbs up because I have no idea about such coding yet it is fun to watch ahah
@skf957
@skf957 3 жыл бұрын
Very well presented, thank you. I'm just starting out with C++ and this video has helped put the "what is possible" into context.
@pdschumy
@pdschumy 5 жыл бұрын
Thoroughly enjoyed it :) ! Thanks much for posting this great video... best part I like about it is the gradual progression/improvement you show (rather than showing off the final version of the game at the get go). And for anyone trying this out along side the video : kindly note that the sin and cosine are mixed up (this can be identified by thinking about where the origin is and where the X and Y axis are). Once you fix that, all the inversions/mirror image issues get sorted out. Also one thing I changed is to use unicode characters →, ←, ↑, ↓ - instead of just a 'P' for the player (this helps with orientation).
@thelaststanding97
@thelaststanding97 3 жыл бұрын
I don't study English well so it's a bit difficult for me to understand, but after listening to it a few times, I realize that you teach really clearly and easily!!! Much respecttt!!!
@WinLoveCry
@WinLoveCry 6 жыл бұрын
This is great work; I've been involved with software for around 20 years+, yet I still found your videos informative, inspiring, and mathematically thought provoking. I've been wrestling with the physics of racing for some time (having developed 3 crude simulations), your videos have just helped me develop some of these ideas. Would love a catchup over Skype sometime! Regards,
@javidx9
@javidx9 6 жыл бұрын
Hi Jamie, glad I could help! I'd love to make a really nitty gritty top-down 2D racing simulation game. I've some algorithms I would like to show this year about racing AI, but the list of things to make vids about never gets shorter :D I checked your Monaco GP vids - nice work! I don't skype, but you're more than welcome to come and chat on the Discord server, it supports DMs too if shouting in public ain't your thing - Jx9
@TanjoGalbi
@TanjoGalbi 6 жыл бұрын
Same here. I've been a long time programmer and am finding these videos informative :)
@enricopassoni1
@enricopassoni1 3 жыл бұрын
Same here
@FrostGamingHype
@FrostGamingHype 2 жыл бұрын
same leave the exp is 2 years i made 2 game engine's and im working on the 3rd one this video was helpful to remove flicker
@hackdesigner
@hackdesigner 5 жыл бұрын
4:20 "I've got criticized but I don't care" - respect!
@xenonxi7564
@xenonxi7564 5 жыл бұрын
I see what you did there with 4:20
@minsin56
@minsin56 5 жыл бұрын
@@xenonxi7564 he used while(1) instead of while(true)
@abdulalhazred5924
@abdulalhazred5924 5 жыл бұрын
he should have used while (!false)
@Tekner436
@Tekner436 5 жыл бұрын
@@abdulalhazred5924 while(420 == 420)
@shelletonianhuman
@shelletonianhuman 5 жыл бұрын
while(0
@viktorkav8191
@viktorkav8191 5 жыл бұрын
I wish one day I can explain myself as clearly and skillfully as you do. One of the best youtubers I've seen, and the best programming teacher too. You should totally write a book!
@javidx9
@javidx9 5 жыл бұрын
lol thanks Viktor, maybe...
@vrtexxradiation
@vrtexxradiation 11 ай бұрын
@@javidx9well, 4 years later, we haven't got a book.
@NagasakiNightmare
@NagasakiNightmare Жыл бұрын
I'd just like to say thanks again for this. As a project for myself, I translated this program to Python a couple of years ago. It taught me a great deal. I plan to go through this video with my son, who is starting to learn C++ for his degree program. You're an inspiration.
@alishacrswartz
@alishacrswartz 7 жыл бұрын
I'm shook. This is the best thing.
@javidx9
@javidx9 7 жыл бұрын
+Alisha Catherine Renee Swartz err thanks?! I'm too old to know if this is good or bad. But I'll read it as positive!
@alishacrswartz
@alishacrswartz 7 жыл бұрын
it was meant positive :D
@javidx9
@javidx9 7 жыл бұрын
Well in that case, thank you very much! Cheers!
@NOBLEFILMS1987
@NOBLEFILMS1987 Ай бұрын
AWESOME 3 DIMENSIONAL GRAPHICS! THANK YOU SO MUCH FOR THIS TUTORIAL AND THE SOURCE CODE JAVID!
@damiandassen7763
@damiandassen7763 6 жыл бұрын
37:00 i have noticed a little problem. the world is rendered in mirror image. if you turn right in the game and walk foreward, the map shows that you have turned left and walked foreward. i fixed it by changing this line 199 (line 257 in github) into screen[(ny + 1) * nScreenWidth + nx] = map[ny * nMapWidth + (nMapWidth - nx - 1)]; and line 202 (line 259 in github) into screen[((int)fPlayerY + 1) * nScreenWidth + (int)(nMapWidth - fPlayerX)] = 'P'; these changes mirror the map and they mirror the player's position on the map and thus everything works correct. btw it was a helpfull and great video
@javidx9
@javidx9 6 жыл бұрын
You are correct Damian, I think this may have been addressed elsewhere in these comments. A little mistake (out of many) on my part. I'm pleased you enjoyed the video!
@Karsteski
@Karsteski 5 жыл бұрын
Thank you so much for posting this comment!
@rswindol
@rswindol 4 жыл бұрын
I fixed this by setting the fFOV variable to negative. I noticed the fix when dicking around with the fov in realtime in engine.
@vitalydushkin
@vitalydushkin 4 жыл бұрын
You didn't fix anything. Your solution just mirrors the map, which is incorrect. All you need to do is replace cosf to sinf and sinf to cosf everywhere like so: playerX += cosf(playerAngle) * 5.0f * elapsedTimeCount; playerY += sinf(playerAngle) * 5.0f * elapsedTimeCount; if (map[(int)playerY * mapWidth + (int)playerX] == '#') { playerX -= cosf(playerAngle) * 5.0f * elapsedTimeCount; playerY -= sinf(playerAngle) * 5.0f * elapsedTimeCount; } It will render everything according to map.
@UnprotectedDesignFlaw
@UnprotectedDesignFlaw 5 жыл бұрын
I wanted to do this when I started programming, never found out how. This was in back in 1998 or '99. Oh, the memories...
@moileung
@moileung 4 жыл бұрын
SAme here bro. Fuck programming. It's hard. Might as well learn to cook food and learn how to dance like Michael Jackson. My wife and son might be even be pleased.
@nonsudunk
@nonsudunk 4 жыл бұрын
@@moileung But the kid is not my son
@higtmance3641
@higtmance3641 4 жыл бұрын
@@moileung Its not hard. Its just like learning anything else
@firmware-jh5vk
@firmware-jh5vk 4 жыл бұрын
Iess exactly. It was difficult then because of the lack of how-to but still possible. I remember the tables of Turbo C/C++, good ol days.....now i feel old.
@UnprotectedDesignFlaw
@UnprotectedDesignFlaw 4 жыл бұрын
@@firmware-jh5vk welcome to the club, grab a cold one and enjoy being old like the rest of us
@blaise6355
@blaise6355 4 жыл бұрын
He also put in the title, Quick and Simple C++. Nice try
@jjhassy
@jjhassy Ай бұрын
poop
@anonymousperson420
@anonymousperson420 5 күн бұрын
It *is* simple.
@jimarious6616
@jimarious6616 4 жыл бұрын
This is a more geometrically correct way of finding the size of the ceiling and makes the depth seem more realistic: int nCeiling = ((float)nScreenHeight - (float)nScreenHeight / fDistanceToWall) / 2.0;
@jordan4220
@jordan4220 5 жыл бұрын
When using std chrono for timing something like this, use steady_clock instead of system_clock. That way the user changing the date doesn't mess things up. From experience..
@Ribby00
@Ribby00 4 жыл бұрын
Man, someone on reddit mentioned this channel and I'm glad I checked it out. This channel is a gold mine of great info!
@jonathanmoore5619
@jonathanmoore5619 4 жыл бұрын
Love the random "clunking" around... Dropping stuff etc. Beautiful. Excellent video. You're a saint 😇 for putting this stuff together. Very useful. Thanks for posting.
@javidx9
@javidx9 4 жыл бұрын
lol, we're all just human XD
@Sruggs
@Sruggs 2 жыл бұрын
I’m so glad I found this video. I’ve been doing C++ for quite some time now and I always wondered how to do some of the things explained so nicely in this video! Subscribed and liked!:)
@cigolsimons1768
@cigolsimons1768 5 жыл бұрын
Fantastic video my man! You explained everything perfectly and I followed it to the end, I have no previous experience in graphics programming but this all made sense to me.
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Cigol, thats great feedback!
@KittanBachika
@KittanBachika 10 ай бұрын
just started learning c++ a week ago and your video was my first project so thanks for the great explanation
@bernieperales9348
@bernieperales9348 4 ай бұрын
Same here lol . Did you have any trouble shading the floor?
@maxmustermann-theoutfluenc997
@maxmustermann-theoutfluenc997 5 жыл бұрын
You have given the Definition of "3D Console Shooter" a new Meaning !
@gavin3563
@gavin3563 3 жыл бұрын
you're the type of person to answer the questions on stack overflow instead of asking. you're insane man.
@ericnichols9223
@ericnichols9223 5 жыл бұрын
Amazing video! When I was a kid in elementary school in the 1980s I loved the game "The Bard's Tale" but was frustrated that you could only turn by 90-degree increments and move by unit steps. I imagined coding up an engine like this to allow smooth movement and rotation, and asked my elementary school teacher to teach me trigonometry, because I knew it was required to do the geometry required for the 3D effect. Alas, my teacher said she didn't know trig.... How I wish I had access to this video back then! It's exactly what I had imagined doing myself on my Commodore 64, back in the pre-Wolfenstein days. I agree with you -- would be neat to see if this engine could perform fast enough on old hardware like that to be playable. Anyway, thanks for your videos and your clear instruction style.
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Eric, much appreciated. I had a quick go trying this on my BBC Micro B+. I think it can do it, but I'll need to dip into assembly :D
@Originalimoc
@Originalimoc 4 жыл бұрын
This surprisingly explained why the same input on some games running at a higher FPS gives more precise control.
@TinyDeskEngineer
@TinyDeskEngineer 3 жыл бұрын
A command-line based 3D renderer is probably the only 3D renderer I'll actually be able to figure out how to make from scratch in the next 30 years. And it'll probably still take forever.
@uuu12343
@uuu12343 5 жыл бұрын
YES thank you for this, a pure c++ project that i can do using just pure c++
@jwallace6913
@jwallace6913 2 жыл бұрын
I love these. I'm going through every single code-it-yourself video and really enjoy figuring out ways to optimise and add new features to the projects. Such a blast :D thank you
@Mrwiseguy101690
@Mrwiseguy101690 4 жыл бұрын
Very cool! You can probably change the 'P' in the map to '>', '/\', '
@javidx9
@javidx9 4 жыл бұрын
Almost, though I'd use '^' for upwards, as its a single character
@Mrwiseguy101690
@Mrwiseguy101690 4 жыл бұрын
@@javidx9 Ah very true!
@mishkamcivor409
@mishkamcivor409 4 жыл бұрын
Managed to use this tutorial to write a graphical version, hopefully this new knowledge will come in handy some day
@volodymyrselevertov
@volodymyrselevertov 4 жыл бұрын
looking at this graphic in the terminal , I remember my first game shooter for sega 16 bit, that was amazing :)
@XxXKobalXxX
@XxXKobalXxX 5 жыл бұрын
I've been looking for a video like this for so long! Thank you so much!! This explained and pointed out a good number of concepts that I was interested in.
@javidx9
@javidx9 5 жыл бұрын
Great to hear Kobal!
@michaelhunt6313
@michaelhunt6313 5 жыл бұрын
I'll save you the time, he is a wizard!!!
@rdkylp
@rdkylp 5 жыл бұрын
He is like Bob Ross of coding, I love him! Relaxing, enjoyable and instructive.
@javidx9
@javidx9 5 жыл бұрын
Thank you Arda, I love Bob Ross too!
@banbazy
@banbazy 4 жыл бұрын
I am from korea. That mean I am not good english yet... :( so someday I'll understand this video! Thank you for this video
@gabe5225
@gabe5225 4 жыл бұрын
U have coronavirus
@rubenuijtde
@rubenuijtde 4 жыл бұрын
@@gabe5225 you just can't say that.
@EpicGamer-ux1tu
@EpicGamer-ux1tu 4 жыл бұрын
@@gabe5225 dude cmon :D
@banbazy
@banbazy 4 жыл бұрын
@@gabe5225 thx man.
@zt242
@zt242 4 жыл бұрын
@@banbazy hey, don't listen to him. Best of luck with learning english!
@cea_tide417
@cea_tide417 5 жыл бұрын
When finding the corners, you could use the dist to integer of x,y instead. The corners are integers, so if the place where the ray hit is close to a corner, x and y should be close to a integer too. (x,y is the location the ray hit) the ray hit at x,y Tolerance is the radius of the circle around the corner. When inside this circle, you hit the corner. DistX=min(x - floor(x),ceiling(x) - x) DistY=min(y - floor(y),ceiling(y) - y) If DistX
@UraYukimitsu
@UraYukimitsu 6 жыл бұрын
Around 10:40, since you're already calculating the sine and cosine of your angle to make the unit vector you might as well use simple trigonometry to get your distance to the wall. I would be something like (not actual code but you get the idea) distanceToWall = abs(playerX-wallX)/cos(angleBetweenRayAndVerticalAxis); //For horizontal (angle between -45° and +45° to the horizontal axis) rays or distanceToWall = abs(playerY-wallY)/cos(angleBetweenRayAndHorizontalAxis); //For vertical rays
@javidx9
@javidx9 6 жыл бұрын
Hi Ura I see what you are saying, bu the problem is I dont know where wallX and wallY are, unless I compute this for every possible wall and then sort them somehow. Also, wallX is not a single value for any given wall in this case. An alternative approach which is kind of similar to what you are suggesting is horizontal wall following, where you identify the wall on the left of the FOV, and then follow the geometry around until you fall of the right FOV. This way you can calculate the distances you need algorithmically, but you need to partition space in fun ways to make this optimal.
@desktorp
@desktorp 5 жыл бұрын
man you guys are smart
@Behdad47
@Behdad47 5 жыл бұрын
@@desktorp %87 is their experience in the field.
@robertfaubion1311
@robertfaubion1311 Жыл бұрын
Your content is so informative, challenging and inspiring. Thanks for all your hard work and keep them coming! If you are ever in Tucson, Arizona, I'll get you some authentic chile con carne on me!
@jjbb84x
@jjbb84x 5 жыл бұрын
This man could probably recreate Shin Megami Tensei (SNES) like this in a week!
@b_08_amitkumarsahu90
@b_08_amitkumarsahu90 5 жыл бұрын
What is genre of game
@spaceplex5079
@spaceplex5079 5 жыл бұрын
@@b_08_amitkumarsahu90 Rpg
@_CazaBobos
@_CazaBobos 4 жыл бұрын
I did the strafing by adding + o - pi/2 to the sin and the cos argument. Works amazingly
@Hyperdelica-Xander
@Hyperdelica-Xander 6 жыл бұрын
You are brilliant mister. Your work is quality.
@michaelfeldman2938
@michaelfeldman2938 7 жыл бұрын
Thanks for taking the time to put this together! I learned a lot seeing this style of PFS rendering on such a low level as ascii. Very informative. Will let you know if I manage to get something like this working for myself!
@javidx9
@javidx9 7 жыл бұрын
Thanks Micheal, no problem! I look forward to hearing about your project.
@johntrent018
@johntrent018 4 жыл бұрын
If this guy can create a prototype of FPS game in a terminal, I can succeed in creating my textual adventure game in terminal, actually in development.
@theali8oras274
@theali8oras274 4 жыл бұрын
Need a player ? :D
@johntrent018
@johntrent018 4 жыл бұрын
@@theali8oras274 Well, for the moment, it's still in development and I'm focusing on core functionalities (command prompt, menus, inventory, moving from a zone to another, quests system, etc...) but I'm willing to distribute my game under GPL license, so I could tell you when it will enter in Beta phases, which won't be for now... ;)
@anhelido
@anhelido 5 жыл бұрын
Thanks for the video. By simplifying the graphics part one can abstract better the representation system, so understanding concepts is easier. Great work!
@javidx9
@javidx9 5 жыл бұрын
Hey Angel and thanks! Thats what this channel is all about so welcome!
@3DSage
@3DSage 6 жыл бұрын
The hit detection and float values are a little too slow for the gba but i'm making progress. You might like to watch my latest video where I built a computer program it with toggle switches in machine code!
@javidx9
@javidx9 6 жыл бұрын
There are probably some fixed-point hacks you can do to make this all very quick. I will!
@3DSage
@3DSage 6 жыл бұрын
I got it working! It's heavily optimized with no float values and DDA detection. The hit detection is fast but misses the corners. I also have a texture problems caused by the GBA mode 4 drawing two pixels at once. This is what I have so far kzbin.info/www/bejne/on6knYx_d5yIsKc
@javidx9
@javidx9 6 жыл бұрын
Nice! I posted it on the #show-your-stuff page of the discord server
@3DSage
@3DSage 6 жыл бұрын
Great! Thank you. I didn't know about discord server.
@flightvision
@flightvision 6 жыл бұрын
I would have done the edge detection a little differently: by remembering which block index (or empty) I hit the last time. If I hit another one or empty next, I know I am at a border. Very interesting this 2D game spaces! Thanks for explaining that very well.
@javidx9
@javidx9 6 жыл бұрын
Hey thanks flightvision, this is true, but will only give you very thin borders between adjacent blocks that do not scale with proximity. This may look good if you are cel shading the maze, or be useful for secondary processing stages though.
@ScottDuensing
@ScottDuensing 5 жыл бұрын
Came here to say the same thing. Personally, I don't like the edge scaling with distance. To each their own!
@kingzeeb319
@kingzeeb319 4 жыл бұрын
If you get an error around 33:35 when trying to run the game it's because he forgot to mention that you need to add: #include #include
@anthunter1813
@anthunter1813 2 жыл бұрын
thx bro
@ComicalJit
@ComicalJit 2 жыл бұрын
Man, you're a lifesaver
@Md-sl2sy
@Md-sl2sy 2 ай бұрын
Man thank you for this I don't even want to build a command line game but ive been looking for an easy to understand raycasting tutorial
@estrobedaaxios2329
@estrobedaaxios2329 5 жыл бұрын
It looks freaking beautiful 😍
@strayedaway19
@strayedaway19 5 жыл бұрын
You are awesome !! Being a noob, I have never done this before and will give it a try. If I am successful, it would be the coolest thing I have ever coded. Thanks man for a great challenge!
@undefBehav
@undefBehav 6 жыл бұрын
genius work javidx9! this actually inspired me to set myself my own challenge to try and do raycasting in javascript using the html5 canvas. i suppose drawing on canvas some fixed-sized rectangles and shading them appropriately with respect to the length of the ray would suffice.
@javidx9
@javidx9 6 жыл бұрын
Thanks Emre, your approach seems sensible to me! Good luck with your project, and be sure to drop a link if you get something up and running!
@somebody_2837
@somebody_2837 Жыл бұрын
This is the type of legendary content I expect from youtube.
@Quonchon
@Quonchon 5 жыл бұрын
A friend of mine did a similar engine in Ti basic on his calculator when i was in high school
@cabbage4254
@cabbage4254 6 жыл бұрын
Thank you so much for providing this tutorial! I just got it working in JavaScript with shapes, not ASCII (I haven’t learned C++ yet but I plan to someday). THANKYOU! 😃
@javidx9
@javidx9 6 жыл бұрын
Hey no problem - Its great to see people taking it away from C++ as it shows that the concepts behind these things are language independent.
@maxkempf7687
@maxkempf7687 4 жыл бұрын
3:38 "cause i don't want this video to go on for half an hour"
@obik16
@obik16 4 жыл бұрын
Kind Sir, your videos and approach to coding is amazing! This is some really good quality channel.
@Bob-zg2zf
@Bob-zg2zf 5 жыл бұрын
This guy is a fkin genius
@toose8388
@toose8388 5 жыл бұрын
I think fEyeX and fEyeY are better explained as decomposing the player's direction into x- and y-vectors. They're not necessarily unit vectors unless we assume the player's direction vector also has magnitude 1, but there's no use in defining that so it's just complicating things. Anyways, this tutorial was great fun! Short and light on dependencies enough to be easily followed by beginner/intermediate C++ programmers, but also results in something quite interesting. So many tutorials out there make you go through hours of copying code only to arrive at something unimpressive. Good job
@javidx9
@javidx9 5 жыл бұрын
Thanks Matheus, Im pleased that youve identified the message Im trying to deliver with this channel, it makes it all worthwhile XD!
@lapidations
@lapidations 5 жыл бұрын
00:50 it doesn't look that great? That looks beautiful
@javidx9
@javidx9 5 жыл бұрын
lol thanks lapidations!
@willybanus7900
@willybanus7900 4 жыл бұрын
I can't believe all the things I'm learning with your videos. Many thanks.
@BrekMartin
@BrekMartin 7 жыл бұрын
I suppose top down tetris is out of the question? :D
@javidx9
@javidx9 7 жыл бұрын
:D It's funny, I do have something in the pipeline for this project. Speaking of tetris, your video has inspired me to try a tetris with the smallest memory footprint I can get - basically I'm reducing it all to bitwise ops and karnaugh maps. It's proving to be a great example of information theory, as I compress the tetromino data, naturally, the program expands. Too early for a video yet though.
@BrekMartin
@BrekMartin 7 жыл бұрын
javidx9 The program expands with C, but in a language with bit access it should be under 1k, and monochrome video memory can be the game memory. I did port a bit access Tetris fully this time, but it was too large. The complete C rewrite used little program memory and huge RAM :D the game memory is ASCII like yours, and the mono video memory is extra, such as with your PC, there's probably some huge video RAM busy representing your ASCII on a hi res monitor :D
@saeedradmehr1976
@saeedradmehr1976 6 жыл бұрын
Very well done, thanks for sharing your work, I'd never seen 3D ASCII graphics seeing this job was quite pleasant very much appreciated.
@javidx9
@javidx9 6 жыл бұрын
Hey thanks saeed! I just wanted to show what to do after hello world!
@moagnor
@moagnor 5 жыл бұрын
3:30 "... cause i don't want this video to be half an hour". No. Actually, it's 38 minutes... :) Anyway. GREAT tutorial. :) I am trying to code this on a C64.
@thomasschnettler6063
@thomasschnettler6063 5 жыл бұрын
How is it different on there? Doesn't the C64 have different libraries?
@devhonking721
@devhonking721 4 жыл бұрын
@@thomasschnettler6063 The C64 has BASIC or Assembly so it's different
@achtsekundenfurz7876
@achtsekundenfurz7876 4 жыл бұрын
6502 assembly is quite limited, too. No sin, no cos, no sqrt in hardware, no FPU at all, heck, not even an integer MUL command! 6502 is basically "Library or f### off" ! At least the CPU is faster than the clock would indicate; 3Dungeon crawl in text should be doable on C64. And by now there's probably a decent C even for C64. If there's not, there should at least be a free one for PC with C64 output.
@bodikzarebumba4911
@bodikzarebumba4911 4 жыл бұрын
I wanna say thank you a lot, i needed a nice project for a exam and now i`m writing a shooter basing on your simple game, really thx a lot
@user-lv6qm3fj2z
@user-lv6qm3fj2z 5 жыл бұрын
A new fps on consoles. That's definitely not what I was expecting :D
@gcewing
@gcewing 3 жыл бұрын
I have fond memories of Wolfenstein 3D, having reverse-engineered the level format and written a level editor for it on the Mac.
@koukiadem
@koukiadem 5 жыл бұрын
Great Video.. waiting for Fortnite in CMD
@javidx9
@javidx9 5 жыл бұрын
lol thanks Adem!
@Kamjue
@Kamjue 5 жыл бұрын
*_default dances in CMD_*
@livestreamundco2537
@livestreamundco2537 5 жыл бұрын
Lol
@breakfastboi3344
@breakfastboi3344 5 жыл бұрын
Um Ok I want code bucks
@Cole-ek7fh
@Cole-ek7fh 5 жыл бұрын
Adem Kouki nobody would do such a horrible thing.
@Aname678
@Aname678 5 жыл бұрын
I like your synthesis and approach on simple code, super clear.
@-_-O
@-_-O 7 жыл бұрын
This could be called "How to play god and recreate the universe ...part 1" :)
@jellohunter7981
@jellohunter7981 6 жыл бұрын
Adam Bradley in the next tutorial he will create animals
@djpeterson7479
@djpeterson7479 5 жыл бұрын
"If you want to make an apple pie from scratch you must first create the universe" - Sagan
@achtsekundenfurz7876
@achtsekundenfurz7876 4 жыл бұрын
When "JC" means John Carmack...
@bobkreme2175
@bobkreme2175 3 жыл бұрын
in a sense, that's what programing is all about. up to a level that people assume the whole universe is just a simulation.
@bproteau1161
@bproteau1161 5 жыл бұрын
Very, very cool! I have no experience in actually working with proper programming so i have no idea what youre doing but it is still very interesting!
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Azure!
@3DSage
@3DSage 6 жыл бұрын
I program for fun on the Gameboy Advanced and I will send you the port when I have it. :)
@javidx9
@javidx9 6 жыл бұрын
Nice, that would be awesome!
@Svabby
@Svabby 6 жыл бұрын
how do you program for the game boy? I really want to know.
@javidx9
@javidx9 6 жыл бұрын
Hi FallenWolfie, there are a few devkits you can use to compile rom images for emulators. Some are even C based so quite simple to use.
@Svabby
@Svabby 6 жыл бұрын
javidx9 thanks!
@nakano15
@nakano15 5 жыл бұрын
Thanks to this video, I discovered about the Alt key usage on visual studio.
@mattiviljanen8109
@mattiviljanen8109 7 жыл бұрын
Please correct me if I'm wrong, but I think the angle rotation direction at both casting the rays and turning the player is not correct. As the player angle increases (17:25 lines 56-60), the player turns counter-clockwise, and when the screen is rendered from left to right (9:18 line 53), the apparent direction is clockwise instead. However; as the rays are projected with increasing angle (9:18 line 56), it is calculating the map counter-clockwise, thus canceling out the error, but leaving turning the player into visually correct direction. The map and the player view don't agree, as seen in for example at 37:08 where the player passes the walls from the left side, but on the map the P passes the #'s from the right side - and that was the thing that caught my attention.
@javidx9
@javidx9 7 жыл бұрын
Hi Matti, you are kind of right. I believe the map is actually either rotated 90 degrees or reflected in x=y, from the player, and as you say, it all cancels itself out. Primarily, this is because I use sin and cos, instead of cos and sin :D So yes there is a discrepancy in there. But that's incredible attention to detail you have - thanks for highlighting it!
@Nob1ej0n
@Nob1ej0n 5 жыл бұрын
@@javidx9 Yup, swapping those fixed it. Cheers!
@justgame5508
@justgame5508 3 жыл бұрын
Where the console game engine and indirectly the pixel game engine began, also where a fantastic community started
@shawnThottan
@shawnThottan 5 жыл бұрын
You are the best. I'm dumb but I understood the whole thing!
@noiseeater
@noiseeater 5 жыл бұрын
Refreshed my math which I haven't used for ages. Thanks a lot! You're doing a great job! Hope you won't stop on this and we'll create a console version of Skyrim)
@javidx9
@javidx9 5 жыл бұрын
Hey thanks noiseater!
@snag710
@snag710 5 жыл бұрын
or at least elder scrolls arena
@hayoun3
@hayoun3 5 жыл бұрын
This guy : Quick and Simple Me : Hmm. That's good. This guy : C++ Me : Mr stark... I fEeL sO bAD...
@sweetberries4611
@sweetberries4611 5 жыл бұрын
these are tutorials for people who know C++
@MrBunnyWizard
@MrBunnyWizard Ай бұрын
Old video but pretty much all still works! Just had to add some extra libraries because they must have moved stuff around in the files since this was released! I've wanted to work on a roguelike ascii style game since I was 20 and I'm now in my 40's. I think I'll use this to learn C++ and try to make my own little roguelike engine/game!
@joseffus5432
@joseffus5432 6 жыл бұрын
Only 200 lines? Neat. John Carmack be like ;_;
@javidx9
@javidx9 6 жыл бұрын
lol joseffus, John Carmack is a legend and exceptionally talented thinker though.
@joseffus5432
@joseffus5432 6 жыл бұрын
@@javidx9 And I never doubted this; he is actually one of my idols when it comes to comp science. But imagine him having the rather high-level windows API with handles and stuff that we are nowadays "blessed with" (lol) back in the days, when smooth scrolling was a true milestone.
@teranyan
@teranyan 5 жыл бұрын
John Carmack created all these algorithms that this guy is showing here buddy. This is more pretty much a doom rendering engine that the video is presenting.
@hostiusasinhostilityhostil7853
@hostiusasinhostilityhostil7853 5 жыл бұрын
@CazMatazz "Turbonerds" - wow, I should add that to my insult collection. thnx
@Sashik
@Sashik 5 жыл бұрын
I'm not into coding, but this project looks very creative to me. Great job!
@javidx9
@javidx9 5 жыл бұрын
Hey thanks Sashik, I appreciate that!
@7Andy77
@7Andy77 5 жыл бұрын
Nice FPS dude (both, frames per second and first person "shooter" too) ;) awesome vid!
@javidx9
@javidx9 5 жыл бұрын
XD Thanks Andy!
@ENG-CT4982
@ENG-CT4982 3 жыл бұрын
@@javidx9 is this series still going?
@javidx9
@javidx9 3 жыл бұрын
Well this video had a sequel, then there was ray cast world, so yeah a bit more to go yet
Upgraded! First Person Shooter at Command Prompt (C++)
39:33
javidx9
Рет қаралды 257 М.
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 11 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,4 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 89 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 42 МЛН
Forbidden C++
33:07
javidx9
Рет қаралды 1 МЛН
I'm Coding an Entire Physics Engine from Scratch
9:19
Gonkee
Рет қаралды 1,7 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 403 М.
olcPixelGameEngine
20:17
javidx9
Рет қаралды 164 М.
The Art of Code - Dylan Beattie
1:00:49
NDC Conferences
Рет қаралды 4,7 МЛН
I coded one project EVERY WEEK for a YEAR
13:13
Carter Semrad
Рет қаралды 722 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 11 МЛН