Code-It-Yourself! Worms Part #1 (C++)

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 137

  • @researchandbuild1751
    @researchandbuild1751 6 років тому +74

    These videos are really underrated. Some of the best programming videos on youtube. Even for a professional developer they are enjoyable

    • @javidx9
      @javidx9  6 років тому +7

      Hey R&B, I see you are working your way through the back catalogue! I'm just trying to show the programming journey rather than the end result, and hopefully people can relate to it.

    • @derpythecate6842
      @derpythecate6842 3 роки тому

      The beauty lies in its simplicity as a good starting project or just something to do in your free time.

  • @churchofguestmob4498
    @churchofguestmob4498 6 років тому +11

    When my daughter was a baby back in 2000 she used to sit on my lap as I played this game for her thank you David for this wonderful video

    • @javidx9
      @javidx9  6 років тому +1

      Hi Charles, thanks man - its strange how games can really bring back strong nostalgic memories. I love it!

  • @lucaxtal
    @lucaxtal 2 роки тому +2

    I'm playing with this simple physic engine by 3 days and I'm still not tired of it. It's a really great job. Thanks for sharing this video and this serie. I'm learning a lot from you. I reimplemented it with JavaFX and the performance are great.

  • @bkucenski
    @bkucenski 5 років тому +2

    To create the holes in the landscape, you just need a list of circles created by each explosion. Then in your render function, you check the list of circles to see if the pixel resides in one of them and if so, don't draw it. You can then stick to a tile based map. You don't have to actually change the map data to render the holes in the scenery. The function to see if a pixel exists inside one of your past explosions is also used for collision detection for movement.

  • @TheFakeVIP
    @TheFakeVIP 4 роки тому +8

    I have watched every one of your videos at least twice now. Seriously, these are just plane fun to watch, to get into that logical programmer mindset.

    • @javidx9
      @javidx9  4 роки тому +3

      Hey thanks buddy! Im pleased you enjoy them, makes it all worthwhile!

  • @ulfarorarson3885
    @ulfarorarson3885 5 років тому +2

    you are THE only tutorial maker where i´m truly able to follow along all the way ... and nothing unexpecting happens on my side but not on your side ... THANX!

    • @javidx9
      @javidx9  5 років тому

      Hey thanks Ulfar!

  • @neotokyo5154
    @neotokyo5154 4 роки тому +3

    Sir, you are delivering pure gold in these videos!

  • @ozbandit71
    @ozbandit71 4 роки тому +1

    I used to be a watcher of the Handmade Hero series. Those videos, in my mind are just pitched completely wrong. Far too long and too detailed that they became boring. This series here however, seems to get it spot on. Exactly enough detail to show how things are done without being boring and videos and series that don’t literally go on for years. Keep up the good work javid9x!

  • @jackpisso1761
    @jackpisso1761 4 роки тому +3

    Priceless information in these videos.
    Thank you very much!

  • @battyhal
    @battyhal 7 років тому +5

    I can´t wait to see part #2 !!. Excellent work javidx9 !. Thank you!.

  • @chaserobin3122
    @chaserobin3122 7 років тому +2

    Good stuff man, you really have taught me so much. I always thought OOP and the std lib was anathema but Im starting to second guess myself after watching you program. Keep making vids, thanks again.

    • @javidx9
      @javidx9  7 років тому

      Hey thanks Chase, I'm pleased you're finding the videos useful. OOP can look a bit strange at first, but it is efficacious, so you write less code!

  • @SuperROFLWAFL
    @SuperROFLWAFL 7 років тому +2

    I love your work! I'm glad I stumbled across your channel. Thanks for putting time into these videos!

    • @javidx9
      @javidx9  7 років тому

      Hi Feengur, you're welcome, thanks for stumbling!

  • @NeilRoy
    @NeilRoy 7 років тому +9

    Great work. I am normally a pure C programmer, but you just may sell me on moving to C++ yet. Though I love the challenge of porting this sort of thing to pure C. :)

    • @javidx9
      @javidx9  7 років тому +6

      Hey Neil! Do it! Do it! Do it! Move to the plus-side :D

  • @amrojjeh
    @amrojjeh 7 років тому +1

    Wow, who knew that the console could be this powerful?

    • @javidx9
      @javidx9  7 років тому

      It just needs leveraging in your favor!

  • @seditt5146
    @seditt5146 7 років тому +1

    I was so excited till I looked for part 2 and seen this was posted yesterday. Im currently working on a 2d engine and your videos are helping me with some vital information. Like I did not even consider the fact that I only need to test the 180 degrees in the direction the creature is moving. This is going to cut my collision time in half thank you so much

    • @javidx9
      @javidx9  7 років тому

      Lol, thanks and you're welcome Sedit - optimisation is never obvious until somebody shows you :)

    • @seditt5146
      @seditt5146 7 років тому

      Thanks, Yeah I have tried a couple collision test, I am working on an advanced Cellular Automaton using Neural Networks but Collision detection is an issue, I tried 360 degrees, thats to slow. I was currently doing pixel test on the 8 pixels surrounding my creature but I have questions on the accuracy of this and more importantly it does not allow me to scale the creatures size like I wanted to. Doing it this way does. I even seem to be getting good results only performing collision check 90 degrees in the direction they are facing. Do you know if there are any algorithms for calculating the theta? I mean on a single pixel 180 degrees is only 4 pixel area around the source. Surely there has to be an algorithm that helps find the correct Theta over distance.

    • @seditt5146
      @seditt5146 7 років тому

      Have you ever done, or Can you do a tutorial on a simple Neural Network Back propagated through one or maybe two hidden layers?

    • @javidx9
      @javidx9  7 років тому

      lol Sedit T, my research career was focused around neural nets, I should probably put something together!

    • @seditt5146
      @seditt5146 7 років тому +1

      OMG Awesome, Can't wait, you already got a subscriber so ya don't have to try to hard lol.

  • @madPL1239
    @madPL1239 3 місяці тому +2

    Javidx9 you are awesome. I like watching your tutorials😄 This is honey for my programming soul:))) Thanks

  • @soft6418
    @soft6418 5 років тому +1

    Best programming videos ever

    • @javidx9
      @javidx9  5 років тому +1

      lol thanks soft!

  • @aryesegal1988
    @aryesegal1988 7 років тому +2

    Thanks for this! Looking forward for this series since Worms was one of my favorite games as a child :)
    As a side note, you must do a collab with Bisqwit ;)
    Keep on keeping on!

    • @javidx9
      @javidx9  7 років тому +1

      Thanks aryesegal1988, lol I don't think Bisqwit needs me! The guys one of the most talented programmers out there!

  • @TheFinagle
    @TheFinagle 3 роки тому

    As you described this my first thought was of a game I grew up with called tank wars

  • @Hyperdelica-Xander
    @Hyperdelica-Xander 6 років тому +2

    You are a wizard sir..

  • @footballCartoon91
    @footballCartoon91 Рік тому

    @14:56 so we can assign static variable of data structure from a class using a function to populate that static data structure

  • @УлянаМаційовська-щ4б
    @УлянаМаційовська-щ4б 5 місяців тому

    I was looking so long for this

  • @trolledwoods377
    @trolledwoods377 7 років тому +2

    You should call the boom function in the bouncedeathaction function, because maybe you want it to do other things

    • @javidx9
      @javidx9  7 років тому +1

      Very possibly, it starts to get a bit fiddly with the OO if I do that, but maybe a slight redesign could accommodate it. For this simple game, I'm only implementing missiles and grenades, but if you want more weapons, a different approach is probably needed. Thanks for the feedback!

  • @ПавелЧемармазович
    @ПавелЧемармазович 5 років тому +2

    Привет! Скажите пожалуйста, где вы берете идеи реализации ваших проектов? Вы сами их придумываете, или все таки это какая-то литература? По моему мнению, у вас просто шикарные работы!

  • @madPL1239
    @madPL1239 3 місяці тому

    Awesome - like always:))) Thanks for your big job!

  • @logomoniclearning6680
    @logomoniclearning6680 6 років тому +1

    javidx9 is a Legend

    • @javidx9
      @javidx9  6 років тому +2

      ...pssst - some say he's 9 feet tall and codes with 3 hands!

  • @zeldwaugh5703
    @zeldwaugh5703 4 роки тому +1

    I'm wondering if this would work to have the balls roll on curved surfaces. Kinda like pinball... seems like it could work. Guess I'll have to try it lol. Awesome vid!

  • @SpaceCake107
    @SpaceCake107 5 років тому

    At 34:00, you say that objects closer to the explosion get a larger velocity boost.
    But you set the velocity to (d / fDist) * fRadius (where d = (dx, dy)), and fDist is the length of d, so (d / fDist) is unit length, and the length of the velocity vector will always be fRadius. So the velocity boost doesn't depend on the distance?

  • @the-code-provider
    @the-code-provider 7 років тому +11

    INCREDIBLE ! :-D

    • @the-code-provider
      @the-code-provider 7 років тому

      I'm attempting to make totally alone a Tetris game, it's so fun to made :-)
      It can be very cool a tutorial of you on a tetris-like !

    • @javidx9
      @javidx9  7 років тому

      Hi Coding Addiction, you're lucky! ua-cam.com/video/8OK8_tHeCIA/v-deo.html

    • @the-code-provider
      @the-code-provider 7 років тому

      Ohhhhhhhhh ! You're so amazing, haha, thanks a lot :-)

  • @harleyspeedthrust4013
    @harleyspeedthrust4013 5 років тому +1

    Just a small thing: at 34:00 I think it would be more efficient to square the radius and compare the squared values instead of calling sqrt()

    • @rafaelfelix5060
      @rafaelfelix5060 4 роки тому

      No because you need the actual fDist to set the vector if the check passes.

    • @harleyspeedthrust4013
      @harleyspeedthrust4013 4 роки тому +1

      Yeah, so you calculate it when the check passes.

  • @TheWeepingCorpse
    @TheWeepingCorpse 7 років тому +2

    Fantastic work buddy.

    • @javidx9
      @javidx9  7 років тому

      Cheers sad and dead buddy!

  • @r1pfake521
    @r1pfake521 5 років тому +1

    Awesome videos! Btw which program/pad are you using for your notes? Looks like you are using a drawing table?

    • @javidx9
      @javidx9  5 років тому

      Thanks buddy! I use a wacom intuous 4 tablet, and OneNote light version.

  • @alejandroflorez1718
    @alejandroflorez1718 3 роки тому

    I really like C++, but it seems there are more job opportunities for C# developers. Which one should I choose?

    • @teasauce3608
      @teasauce3608 3 роки тому

      fair to say, you would get a biased response here.

  • @FrostGamingHype
    @FrostGamingHype 2 роки тому

    now i really want to know how to make those type of pixels in the console and i want to know how to construct the console window please Javid 🙏🙏

  • @saurabhmehta7681
    @saurabhmehta7681 Рік тому

    "And this may confuse the player" at 34:26 had me cracking up :D
    Also, why not update acceleration of the object, instead of velocity in the boom function?

    • @javidx9
      @javidx9  Рік тому +1

      Acceleration requires time to change a velocity, which would require being applied each frame for a duration. This is trickier to manage than just setting the velocity directly, which is fine for very large and brief accelerations, like an explosion. If the physics actually mattered in this case I'd be more considerate, but it's a cosmetic effect.

  • @tjtube263
    @tjtube263 6 років тому

    Fuck yeah, this is dope.
    I'm writing Python code.
    But this looks way more interesting.
    Way more complicated though.

  • @razvan795
    @razvan795 2 роки тому

    30:42 why to use bDead flag and not NBounceBedoreDeath == 0 or

  • @hallakim184
    @hallakim184 7 років тому +1

    Really impressive. Nice video.

    • @javidx9
      @javidx9  7 років тому

      Thanks Halla!

  • @jankutac9753
    @jankutac9753 2 місяці тому

    hi, does anyone know how to implement worms in godot or gdevelop? This sounds like it's only for consoles? thanks

  • @esben181
    @esben181 5 років тому

    This is incredible

  • @tenzintest331
    @tenzintest331 3 роки тому

    beautiful and clean tutorial ;)

  • @matteoguglielmetti9492
    @matteoguglielmetti9492 7 років тому +4

    GG dude

    • @javidx9
      @javidx9  7 років тому

      Thanks Matteo!

  • @immolator6666
    @immolator6666 5 років тому

    This. Is. Awesome!

  • @aleksandarfranc1094
    @aleksandarfranc1094 5 років тому

    any tutorial suggestion for better understanding of bresenham's algorithm??

  • @srikanthn6404
    @srikanthn6404 5 років тому

    Dear sir please make video on Intel realseans 3D depth camera for robot navigation in visual studio

  • @marcelb4299
    @marcelb4299 7 років тому +2

    Can you do a tutorial about how to acces hardware, please? I love your work!

    • @javidx9
      @javidx9  7 років тому

      Hi Marcel, Thanks! Hardware is a big topic! Any hardware in particular you're interested in?

    • @obsoletepowercorrupts
      @obsoletepowercorrupts 7 років тому +1

      @Mrcel B, In MSWindows, you'd pay attention to the (HAL) Hardware Abstractoin Layer, but if you are new, a handy way to access some hardware (believe it or not) is via the web-browser these days, if you are after an easy way to do it. That is a very "friendly gentle" way to get into it, albet at a performance overhead, and some of it shares some similarities wiht Adobe Flash ActionScript (which despite being a bit "meh" is an easy way to learn for beginners).
      However, if you want more difficult or abstruse hardware, you may wish to look at the similarities between various languages, ranging from that of small "maker boards" like the Raspbery-Pi (or Intel equivalent), to Objective-C for Apple, and then look at Microsoft's Visual Studio's way of doing things which are similar to Objective-C. Beyond that there are some very difficult types of hardware programming that can be done but those are things like working with video processing (even before the invention of 3D graphics cards for most domestic computers).
      To get into that, you'd want to compare programming for something like an arduino with a Raspberry-Pi. This will allow you a gentle way to discover the mathematics behind bit-twiddling and the Discrete Cosine Transform used in video (whereby the DCT is most famously mathematics that can be done by pen and paper via the Cooley-Tukey FFT algorithm, and then computers in binary use Butterly Algorithms via what is known as twiddle factors). I would look at Brek Martin's "freedom platform" and other videos if I were you. So, considering you'd look at the Fourier Series and Fourier anaysis and Fourier Transforms, you'd want to look at arduino projects where people make a MP3 player graphic-Equaliser as they separate a signal into its harmonic series using fourier anlysis and then populate an array (or maybe a dynamically-linked-list) to make the "bars" of treble and middle and bass etc.
      As a small digression, there is the topic of file systems like ZFS and how linked-lists can make a objects as graph nodes in a super class. Mount a filesystem on a hard-drive is hardware.
      If you wish to study the mathematics (of FFT- which is hard btw), you'll want to look at all of the GCSE maths and how that goes into, vectors, "K-Graphs" and Quadratic Equations, wich lead into A-Level maths Polynomials (which are used in Cyclic Redundancy checks btw) and the Calculus and differential equations. Also look at "impossible" numbers like "i" used in negative square roots for when you are dealing with waves. Then and only then will you handle some Fourier Analysis or FFT.
      But quite honestly, beyond the Raspberry Pi (ARM cpu) and Intel equivalent boards with their pertaining languages (or even .net mono etc) or using custom boards with C-Sharp, I'd suggest you look at Amiga Hardware coding when you get to that "bit more confident stage" (as it is "fun" and not a nightmare) but aren't into abstruse Fourier Mathematics by then.
      The channel "Wei-ju Wu" has recently updated his video series on "Amiga Hardware Programming in C" so search that in quotes exactly. Also see the ScoopexUS channel regarding amiga coding.

    • @marcelb4299
      @marcelb4299 7 років тому +1

      javidx9 maybe the soundcard to start small?

    • @marcelb4299
      @marcelb4299 7 років тому +1

      ObsoletePowerCorrupts thank you for your response! It helped me out a lot!

    • @javidx9
      @javidx9  7 років тому

      One of my first videos ua-cam.com/video/tgamhuQnOkM/v-deo.html was programming a sound synthesizer from scratch in windows. Part 4 of that series talks about how the underlying technology works. On a windows/linux machine you are only really ever going to access hardware via an API.

  • @unnamedindividual7135
    @unnamedindividual7135 5 років тому

    can somebody help me? where to start? i dont understand anything from this tutorial? where should i begin? i mean which video. thanks all. i think im missing some references...

  • @Bob-zg2zf
    @Bob-zg2zf 5 років тому

    I LOVE THESE!

  • @bbdnuh1028
    @bbdnuh1028 6 років тому +1

    hey javidx9 I have a question I don't understand c++ that much only know about small things but will I still benefit if I follow your code without knowing what some does?

    • @javidx9
      @javidx9  6 років тому +2

      Hi BBDNuh, sure you will - as much as possible I try to make videos that are not about the language, but more about the algorithms and thinking behind the solutions. My videos dont really use any advanced C++, but should introduce some useful ideas and techniques you might not have seen before.

  • @mmsbludhound873
    @mmsbludhound873 5 років тому +3

    Anyone here remember gorilla.bas?

  • @byronk-j
    @byronk-j 6 років тому +1

    Im really struggling with running this for myself because i dont understand how to get the olcConsoleGameEngine.h file to which the code can reference, and how to define the vector function. pls help

    • @javidx9
      @javidx9  6 років тому

      Hi Byron, you can get the files you need form my github here github.com/OneLoneCoder/videos As for the vector function, that should be included as part of the C++ standard library, are you using a very old version of C++?

    • @byronk-j
      @byronk-j 6 років тому

      Thats exactly what i thought because ive used the function before but its the 2017 version of Visual Studio. Is there a library i havent imported or somehing?

    • @javidx9
      @javidx9  6 років тому

      Ahh I see what might of happened - I used to include in olcConsoleGameEngine, but I've since removed it, so if you #include in your main program you should be ok :S

  • @mansursgmn
    @mansursgmn 6 років тому +1

    I love you

  • @thegrabbler622
    @thegrabbler622 6 років тому

    Hey man, great tutorial as usual I really like where this one is going with the OOP. I'm having problems again with the Console Game Engine tho. I think it has to do with the size of the console, as if i set it to 256x160 it throws an exception at line 273 of the olc header file as soon as i run it. If i construct the console 50x50 then it runs but the actual window is longer than it is wide (i.e. not 50x50) any ideas why this might be?

    • @javidx9
      @javidx9  6 років тому

      Hi Yankee, sorry I missed this one, This sounds to me like you are constructing a console larger than your desktop resolution. What pixel sizes are you specifying, and what is your display resolution? As for the distorted winsow size, this is likely because your windows is a specific version which causes problems :D In the header file, you can specify the font to be "raster", and this should correct the aspect ratio.

  • @aleksandarfranc1094
    @aleksandarfranc1094 5 років тому

    I am new to this channel and today i started with this project. Any recommendation for better understanding material, engine, ... Maybe there are some easier videos/projects on this channel to go through them first??

    • @javidx9
      @javidx9  5 років тому +1

      The tetris, snake and first person shooter videos are pretty simple

    • @aleksandarfranc1094
      @aleksandarfranc1094 5 років тому

      @@javidx9 Thanks. What about asteroids and perlin noise?

    • @javidx9
      @javidx9  5 років тому

      @@aleksandarfranc1094 lol, i have videos on those too!

  • @aleksandarfranc1094
    @aleksandarfranc1094 5 років тому +1

    Anyone see the purpose of bStable variable in this tutorial or it will be in next part?

    • @lizardrain
      @lizardrain 2 роки тому

      it seems to be unused.

  • @skyhorn9070
    @skyhorn9070 7 років тому +1

    wonderful

    • @javidx9
      @javidx9  7 років тому

      Thanks Skyhorn!

  • @robertboran6234
    @robertboran6234 7 років тому +2

    Nice !!

    • @javidx9
      @javidx9  7 років тому

      Thanks Robert!, you woudn't happen to be RobIII on the discord server would you?

    • @robertboran6234
      @robertboran6234 7 років тому

      No

  • @idiakosesunday3806
    @idiakosesunday3806 6 років тому

    Can anyone tell.me.how this isn't throwing an error with the PerlinNoise function. Where is it included

    • @javidx9
      @javidx9  6 років тому

      Hi IdiakosE, How do you mean it isnt included? @6:24

    • @idiakosesunday3806
      @idiakosesunday3806 6 років тому

      Ooh my bad, was expecting an include. Didn't see the definition

  • @berry966
    @berry966 6 років тому +4

    Who is that one guy that dislikes all your videos? Lol

    • @javidx9
      @javidx9  6 років тому +12

      I know! I must have a nemesis!

  • @orangasli2943
    @orangasli2943 2 роки тому

    @8:39
    how to delete pointer inside a function

  • @trueverdicts685
    @trueverdicts685 5 років тому +1

    99.7% likes to dislikes ratio!

  • @OneSaile
    @OneSaile 4 роки тому

    Make a video using a quadtree

  • @chriswinslow
    @chriswinslow 6 років тому +1

    This reminds my of an episode of the ITV kids show "Bad Influence!" where the programmer created a dynamic platform level in the game Earthworm Jim 2 see it here ua-cam.com/video/b7Z-t-38VFo/v-deo.htmlm22s

    • @javidx9
      @javidx9  6 років тому

      Oh man, I remember that show! I had a proper Violet Berlin crush lmao :D

    • @chriswinslow
      @chriswinslow 6 років тому

      javidx9 haha yeah she was alright but fit body

  • @Twafflejc
    @Twafflejc 7 років тому +2

    Can i make this little game on other languages?

    • @javidx9
      @javidx9  7 років тому +1

      Hi Raposo, sure you can! The syntax will be different, but fundamentally the algorithms and ideas are the same.

    • @BrekMartin
      @BrekMartin 7 років тому +1

      I can definitely second that. The value in these videos is the fact that ideas are conceptually explained such that the platform is irrelevant. The only limitation that has occurred to me so far is the language must have float variables.

    • @seditt5146
      @seditt5146 7 років тому

      Floats can be avoided in many cases by making the number huge and treating it like a decimal is in there somewhere. I have never seen a lang without FP but still my statement stands. I am working on a program now in which I need precision but instead of using floats I am using a max value of 10000 when I really just need a percentage. I just treat it as a percentage and if needed I can divide it appropriately to get the true float value

    • @BrekMartin
      @BrekMartin 7 років тому

      Sedit T I had 8 bit pic microcontrollers in mind, for which the largest variable is a 16 bit word, so no large numbers, and integer only. There are still ways around it, but it becomes difficult. That might sound like a fringe case, but I have been following OLC tutorials to write some of the programs for microcontrollers.

    • @seditt5146
      @seditt5146 7 років тому

      Yeah I see your dilemma, most you can get is 32768 signed int that way which if treated as a decimal would significantly limit the value you were able to achieve down to a few thousand even with a single decimal. Attempting to get 2 decimal places would limit you to a few hundred and so on if one wanted to treat the last few numbers as the decimal. Workarounds my friend... workaround everywhere lol, I'm sure you'll figure it out. IDK much about your project but what about allocating multiple words for a single number giving a much wider range to work with.

  • @giancarloandrebravoabanto7091
    @giancarloandrebravoabanto7091 5 років тому

    if you wanna teach, you should use a pure language that doesn't contain any libraries neither frameworks. like Javascript make its better for understanding the algorithm