Coding Challenge #86: Cube Wave by Bees and Bombs

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

КОМЕНТАРІ • 435

  • @multiapples6215
    @multiapples6215 6 років тому +604

    Ok, the reason why the isometric view is off is because you did the rotates wrongly.
    Replace:
    RotateX(-QUARTER_PI)
    RotateY(ma)
    With:
    RotateX(ma)
    RotateY(-QUATER_PI)

    • @TheCodingTrain
      @TheCodingTrain  6 років тому +166

      Thank you!!! (Actually I think I it should be. . . )
      rotateX(-ma);
      rotateY(-QUARTER_PI)

    • @joaovitordossantos9949
      @joaovitordossantos9949 6 років тому +38

      YES
      The wiki for iso view refers to plane rotation while the p5 function rotates around the said axis

    • @TriatomicKey52
      @TriatomicKey52 6 років тому +33

      Thought it was abit wacky when he called x vertical

    • @TheCodingTrain
      @TheCodingTrain  6 років тому +78

      Yeah, so painful for me to watch this back!

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

      Glad to help ^_^

  • @RetroGamingClashOfClans
    @RetroGamingClashOfClans 4 роки тому +78

    15:24 lmao every programmer 30 min after enthusiastically starting a new project;

  • @goobi8617
    @goobi8617 5 років тому +223

    This dude can literally create anything with his mind

  • @DenisRezendeD
    @DenisRezendeD 5 років тому +52

    Nobody: ...
    This guy: Translate();

  • @steeperdrip9188
    @steeperdrip9188 6 років тому +186

    So happy that you've gotten back to graphical coding challenges

  • @jackdaddypfc
    @jackdaddypfc 6 років тому +330

    As some one who taught himself assembly language on a commodore 64, may I say you are exactly what aspiring young programmers need. Good work sir.

    • @Roundtablist
      @Roundtablist 6 років тому +15

      I did the same thing on an Apple ][ and I thoroughly agree. Dan has helped me try to restore some fun to my coding. To approach it with the same sense of wonder and excitement that motivated me to push through the incredibly difficult thing I was trying to do back then.

    • @reyariass
      @reyariass 6 років тому +5

      I salute you both. I don’t know what I would do without today’s IDEs and their auto-completion. Probably a whole lot of single syntax typing then testing immediately after to see if did something spectacular.

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

      where ddi you guys learn to code by yourselfs?

    • @KayOScode
      @KayOScode 6 років тому +3

      I did all of the above and built 3d render engines from scratch. Im talking from scratch meaning no libraries, not even a graphics api.

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

      Father Mark I guess you are from Ireland. Gee, how well I remember Father Mark's repetitive quotes: "Drink, drink drink!"..."Girls, girls, girls!" ...."Feck, feck, feck!"

  • @BirinderSingh
    @BirinderSingh 4 роки тому +47

    WebGL: can't handle 2d, runs 3d perfectly.
    "My powers are massive, not catered to your lowly tasks... "

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

      Webgl can, p5js can't

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

      the rect() function in webgl p5.js actually draws so many triangles that webgl starts lagging when the triangles move to each other

  • @jaronfeld123
    @jaronfeld123 6 років тому +54

    Lmao "Rotate 45 degrees..." PI/8
    That was funny

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

      it was 22.5 instead of 45 lmao

  • @aditya95sriram
    @aditya95sriram 6 років тому +89

    Please, please do more from Bees and Bombs. Some of those are really mind-boggling and I have no clue how he does them in processing.

  • @terraflops
    @terraflops 2 роки тому +5

    wow, i enjoyed this so much, i watched it and coded along, only took me 2 hours (yes, i know about the source code being available but wanted to code it)

  • @mariogamer929
    @mariogamer929 5 років тому +6

    Holy cow. you can program so fast! I made the same thing in C++ and OpenGL, and it took me nearly a day. Most of the time I'm just thinking what to do next in my code, and you just keep going somehow. How do you do that?

  • @alvaroplol
    @alvaroplol 6 років тому +13

    Using distance to do the offset is genius. I'm adding that to my toolbox.

  • @emmettdja
    @emmettdja 4 роки тому +4

    2:11 "so if we just let h equal 100..." and there you go. all done.

  • @ilustrado7291
    @ilustrado7291 6 років тому +84

    SHIFFMAN IS THE NEW BOB ROSS

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

    12:37 ah, the Unity forum, one of my most frequently visited websites xD

  • @mdtanvirislam3408
    @mdtanvirislam3408 6 років тому +15

    26:20 Larry David reference xD

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

    13:56 It looks like a very low resolution 3D Game (The ones from scratch)

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

      Late but the push()/pop() resets the matrix (the translate()) after each iteration of the for loop. - Joel

  • @stio_studio
    @stio_studio 2 роки тому +1

    I have made orthographic projection in scratch. (I made it without knowing it)

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

    You should have made it in a rainbow color in order to honour your old channel name! Keep up the good work!

  • @driziiD
    @driziiD 3 роки тому +1

    orthographic projection: flashes back to all my TD (Technical Drawing) classes in secondary school

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

    I actually tried to improve the version.
    editor.p5js.org/lavagod/present/M2tExTqYd

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

    Instead of working on each block individually, you could have create and animated f(x) = (sinx, sinx, constant), then use the method used for Riemann Integral (creating blocks under the curve of each sinus function).
    Edit: Then mirror it on one axis.

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

    Super exciting to see you doing these real time coding, I learn a lot from you and, specially important, I get a lot of inspiration

    • @armanterrell7215
      @armanterrell7215 3 роки тому +1

      Seriously right? Sometimes I think I can't move forward. Then I see a video like this knowing I NEED to move forward because this looks HELLA fun.

  • @DavidKarlsson
    @DavidKarlsson 6 років тому +32

    I really enjoy these videos but I dislike that you use P5 in everyone of them. It's hard to tell if something is a P5 function or something that's regular JS/Canvas/WebGL and if it isn't, it's difficult to know how you'd do the same thing without libraries. I don't think P5 is something I could use a lot in production.

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

      David Karlsson Exactly

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

      Why couldn't you use P5 in production? If you go to the Processing web site they have an entire archive of projects currently in production! I myself have used it for when producing online games!

    • @KayOScode
      @KayOScode 6 років тому +3

      Yes, he should be using the modern pipeline of opengl in c++. Would be much easier to follow

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

      You can make all the functions he uses in whatever language you prefer if it doesn't have it already. I know I already want to steal that map function to use it in java, as I'm not aware of a class or anything that does it.

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

      When I used to follow his videos (now I just watch them, I already pretty much finished making stuff I wanted to) in pure javascript (no frameworks, libraries at all, just pure, built-in browser javascript), it took some work to setup some things but it wasn't really that hard...
      It's not hard at all to tell if something is P5 or not, you're just not experienced enough to know what JavaScript has or doesn't have...
      I don't even like this language, I just enjoy HTML5 Canvas, since they just work, and you can probably even build 2D games with them, nor I use it that much and I had no problems following his videos, maybe you should just learn more instead of complaining?

  • @ritikkhatri
    @ritikkhatri 6 років тому +73

    29:19 !!!!! XD

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

    Your laughing style is amazing ... I like it ..

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

    idk why you keep changing the well-named variables to single letters lmao

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

      Yea, Processing devs need to stop using too many abbreviations in their variables

  • @houseofgrindstone
    @houseofgrindstone 6 років тому +17

    Okay, I admit.. you nailed it.
    ...as usual. :)

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

      No he didn't...but close!

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

    Is there a youtube channel like this but with other programming languages? Python for example? This channel is so cool.

  • @generic_programmer
    @generic_programmer 6 років тому +3

    8:55 What purpose does the push() and pop() fill?

    • @Meoiswa
      @Meoiswa 4 роки тому +2

      They create a "block" of instructions that all get sent together to the Graphics Layer, thus reducing the number of "housekeeping" operations it has to perform.
      It's also commonly used to "temporarily" apply transforms/rotates, and have them all "revert" with a pop.

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

    you made me want to try this out myself, but in c++ XD

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

    I really get the urge to make a hacky 2d css transition version of this

  • @danielmatthews12312
    @danielmatthews12312 6 років тому +3

    I cant believe how few lines of code it takes to make that first ocelating movement

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

    Greetings from Laponia

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

    when i had this script:
    let angle = 0;
    let w = 24;
    function setup() {
    createCanvas(400, 400, WEBGL);
    }
    function draw() {
    background(100);
    noStroke();
    ortho();
    //translate(width / 2, height / 2);
    rectMode(CENTER);
    rotateX(angle);
    translate(0, 50, -50);

    //rotateX(angle * 0.25);
    let offset = 0;
    for (let y = 0; y < height; y += w) {
    for (let x = 0; x < width; x += w) {
    push();
    let a = angle + offset;
    let h = map(sin(a), -1, 1, 0, 100);
    //fill(255);
    translate(x - width / 2, y - height / 2, 0);
    normalMaterial();
    box(w - 2, h, w - 2);
    //rect(x - width / 2 + w / 2, 0, w - 2, h);
    offset += 0.1;
    pop();
    }
    }
    angle += 0.1;
    }
    it didn't stop

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

    It took me so long to figure out how to make it spherical vs the shape of a sine wave. You see a lot of people saying to "just square the offset" but that didn't immediately click for me. The solution was to simply square both the distance and the max distance, doh. Update your offset to this and it looks just like the original: let offset = map(d * d, 0, maxD * maxD, -PI, PI)

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

    Increase frequency and amplitude of the waves, while decreasing the time step... IE larger and more frequent waves, but with a slower change

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

    1/sqrt(2) = cos(45)

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

    hmm...this looks difficult

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

    you don't need to use a 3d engine, you could just draw a ton of rectangles from that back corner, sweeping from "left" to "right", back to front, to avoid some rectangles going over some that shouldn't be covered

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

    I think the offset of the corner parts needs to be te same as the offset on the middle part, also the max offset should be the width of the whole thing minus the base height...

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

    Please please please make minecraft like game in p5.js

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

    Which IDE does he use? I still use p5.js web editor but I want to use an IDE. Can someone recommend please?

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

    Do you realise that the movement is backwards compared to the gif? It’s almost completed!

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

    it would be so easy to just rotate it by 45° and it would be isometric

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

    First thing ever in codingtrain I dont understand. Pop and Push should be on something. But here they are used inside the sketch and not on an object??? On what are they used

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

    You just explained a sine wave to me better than anyone ever did, in like 30 seconds!

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

    *ORTHOGRAPHIC PERSPECTIVE*

  • @PhilippeHenrique
    @PhilippeHenrique 6 років тому +25

    OMG! You are amazing

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

      Philippe Henrique "you is" 😂😂😂😂😂😂

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

      I just realized now the mistake

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

      The proper grammar for that is "I just now realized my mistake."

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

      ophello thanks for the correction

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

    actually i know 0% of p5.js and anything you are doing in p5 and 3d but i enjoy watching you anyway..

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

    I sat here for 30 minutes hopping to learn something well i did and that is that I’m rly bad at coding compared to him

  • @SpeckyYT
    @SpeckyYT 6 років тому +3

    Best part: 30:00

  • @roshanpawara8717
    @roshanpawara8717 6 років тому +5

    Great job sir. But yo gotta tell us that for how long have you been in this coding thing coz you just calculate stuff so quickly.
    You are the "Coding Flash"!

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

    Its an orthographic projection but a isometric view. Isometric view is that the lines going in the back are 1:1 in length and 30 degrees angle going to the back

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

    So I'm up to 9:22 when switching from 2D to WEBGL and the boxes borders/lines aren't showing. This is my first time doing anything with WEBGL lol help!!
    var angle = 0;
    var w = 24 ;
    function setup(){
    createCanvas(1700,400, WEBGL);
    }
    function draw (){
    background(175);
    //translate(width/2,height/2);
    rectMode(CENTER);
    //rotateX(angle*0.4);

    let offset = 0;
    for (let x = 0; x < width; x+= w){
    push();
    let a = angle + offset;
    let h = map(sin(a),-1,1,0,100);
    fill(255);
    translate(x-width/2,0,0);
    box(w);
    //rect(x-width/2+w/2,0,w-2,h);
    offset += 0.1;
    pop();
    }
    angle += 0.1;
    }

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

      Can you ask this at forum.processing.org? It's easier for me and others to help that way (you can share code there easily!).

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

    Gid. I love watching him code. Even though I haven't started learning JavaScript yet and a lot of what he does confuses me a bit, his code looks so AMAZING. Mine is all jumbled and stuff and I only put space between my code when I'm done with a concept completely, he does when he's done with a thought, and that doesn't usually look good, but this guy pulls it off and it looks amazing! Lmao

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

    Please do more audio stuff!

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

    You could use only 1/8 of the sin operations by mirroring.

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

      Nice tip!

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

      Yeah! I was thinking similar.
      Good point.

  • @AB-Prince
    @AB-Prince 6 років тому +3

    For an ofset centered around zero, you could square the numbers so they eminate from the origin

  • @8xnnr
    @8xnnr 5 років тому

    Is it possible to learn and get a job as a software engineer without college?

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

    Whats the difference between void setup() size(x, y); and setup() {
    createCanvas(x, y);}?

    • @TheCodingTrain
      @TheCodingTrain  6 років тому +3

      One is Processing, one is p5.js, see: ua-cam.com/video/AmlAiKsiy0o/v-deo.html

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

      thx a lot!

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

    rightnow my other computer is calculating the 10000031th prime number. It was an accident! (kinda)
    What app you using? Do you have a tutorial on p5? Sorry for the questions.

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

      it was taking too long!

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

    Today I post videos about basic voxels then daniel went and posted this today.... now I feel compelled to try to implement this sort of effect with voxels. Guess I'll be up late tonight... :P

  • @esquach
    @esquach 6 років тому +5

    Isometric was right. I always think of "orthographic" as from the front/back, sides, top/bottom...

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

    What's the command you're doing to re-format the code?

  • @boyiscola
    @boyiscola 5 місяців тому

    That’s a pretty good LD impression!

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

    Hey Dan I have been following you for awhile and I must be an idiot for not figuring this out by now. But how are you building this on a local server? I've looked at the github repos and still can't figure out how you run these projects off your local server.

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

      I believe this one is using processing.org which is a standalone desktop app (written in Java), but for my web / local server workflow you can check this out:
      ua-cam.com/video/HZ4D3wDRaec/v-deo.html

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

    This guy is fantastic,kudos to him!

  • @N0D0hNuts
    @N0D0hNuts 3 роки тому +2

    You know someone is a real programmer when you type the same word over and over doing mistakes because your mind is going faster than your hands

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

    my god, thhis is free tutorial... damn love it

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

    It's amazing ! You are the amazing programmer !!! :O

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

    Daniel you should check out the subreddit www.reddit.com/r/dailyprogrammer/ and do some challenges from there, too, and submit them :D

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

    That looked like a jellyfish at the end

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

    directionalLight(255, 255, 255, 0, 1, 0); This is for top down light.
    directionalLight(255, 255, 255, 0, -1, 0); is for bottom up

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

    What programing language is that ? Can someone help me, please ? It looks so familiar. It's like C++

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

      It's using a javaScript library called p5.js, look it up.

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

    it can be done witout javascript ! .... just make a cube with css ( 6 planes that has transform: rotate3D and translate3D ) ... and then asign an 3d animation to the container ... at last , set the animation-dlay property for each item ....
    so everything ( 3d stuff , animation , etc ) just performs by browser itself

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

    I stop programing a long time ago. But look at you doing this UA-cam . Make me remember my past and the exitment when i finish a program :). THANK YOU.

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

    Awesome video...you are the best

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

    I have no idea what he's doing but it looks cool.

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

    Can someone help me?
    The boxes that have been drawes have no black-colored edges. They have the same color as the box. And when I try my program on the Website of P5 everything works how it should. what can I do?

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

    Thx for using dark backgrounds..

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

    Can you upgrade, simplify or convert my version of KAREL 3D in WebGL with Three.js to p5.js?

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

    My slightly modified version of this challenge, working code: github.com/Steve0929/WaveCube

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

    Tweak the amplitude and quantization (reduce the # of cubes over the same area, increase the amplitude), perform rotations mentioned below and done ...

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

    Honestly you could have eased your life with just implementing a radial wave function (ripple-effect) and just height of that as it progresses over time. Then you would have been able to get rid of this handselected offset, and would have gotten a sinus shaped flow.

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

    can someone help me i cant get the rectangle to show ??

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

    you can do it in a simpler way such as
    making all the boxes (4*4) and one in the middle who have all the script
    it will detect how mush far is the other boxes and their high will be angle*(offsent+distance)

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

    I was thinking of a completely different approach. I learnt programming in Fortran, so the first thing for me is almost always going for arrays. Like you could make an array that stores a position for every little box and then assign a dynamic value of height to each value of that array? I know pretty much anything about p5 and processing, but I do want to learn!

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

    Just started a coding camp and found your channel. You're brilliant friend. Absolutely brilliant, thank you for sharing your knowledge and your thought process while breaking down the code!

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

    sheesh. ur honestly mad. i want to code when im older but i have no idea how i could ever learn half as much as you know

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

      Try either of these playlists to start from scratch!
      ua-cam.com/users/shiffmanplaylists?view=50&shelf_id=14&sort=dd
      ua-cam.com/users/shiffmanplaylists?view=50&shelf_id=2&sort=dd

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

    In my first look in the thumbnail i thought it was Rubik's cube

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

      OMG!!!! I GOT HEART IN CODING TRAIN FOR THE FIRST TIME!!!!

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

    How did you set up atom with the browser and how to do it on windows . Because i love using atom plz help

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

      This workflow video might help! ua-cam.com/video/gJa6wri8YNQ/v-deo.html
      (Full playlist: ua-cam.com/play/PLRqwX-V7Uu6Zu_uqEA6NqhLzKLACwU74X.html)

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

    Au début le bitcoin était révolutionnaire il apportait notamment la technologie blockhain. Maintenant il y a d'autre altoins bien plus intéréssante tel que Ripple,Ethereum, Monero, IOTA, DAHS etc basé ou non sur la blockchain. Sinon bonne vidéo .

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

    You should have rotated about x by quarter pi not minus quarter pi that way you wouldn't have had to throw those negatuve2 numbers into the ortho function

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

    cool.......this is the type of thing I dig most........& they should almost always all use WEBGL

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

    Coding along, I add ortho() and and my boxes disappear, comment it out and they reappear. Why?

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

    The magic angle variables equals 60. It'd be exactly the same as in bees n bombs. That will fix the perspective

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

    Omg just set your z clip planes to posetive and negative infinity

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

    this is great, I'm trying to do the same you did but in Unity and with c#. good practice

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

    My sugesstion is to make a kind of a splix.io game) This would be funny)(using p5.js)