I made a triangle! - SM64 in Scratch part 1

395,135
0
Published 2023-08-20
The first step in making Mario 64 in Scratch is to draw triangles.


Scratch project: scratch.mit.edu/projects/818568990/
Scratch profile: scratch.mit.edu/users/randomguy48/

Desmos graph: www.desmos.com/calculator/bcoginrx66


Song credits:

Awe - PrototypeRaptor
   • Awe  

Origin - Geoplex
   • Geoplex - Origin  

Disfigure - Blank for NCS
Song: Disfigure - Blank [NCS Release]
Music provided by NoCopyrightSounds
Free Download/Stream: ncs.io/blank
Watch:    • Disfigure - Blank | Melodic Dubstep |...  

Imperium - Geoplex for The Arcadium
   • Geoplex - Imperium  
soundcloud.com/thearcadium/geoplex-imperium

Rejoice - Phaera for The Arcadium
lnk.to/phaerarejoice

All Comments (21)
  • @Randmguy48
    I’m thinking of doing a smaller video where I respond to your guys’ fantastic comments. Let me know if your interested. Many people have given feedback and ways to improve the performance of my triangle renderer. Let me know if I should go over them in a video. :) Edit: I will do this AFTER the next video
  • @SammySamSams
    >comes to scratch >decides to recreate sm64 in it >makes a trangle >refuses to elaborate >leaves
  • @win_ini
    remember 2 things: a - level is not the only thing to render, there are coins, stars, enemies, NPCs, and even the player! b - scratch has something called turbo mode.
  • @TechJolt3d
    I remember when pen used to be a default part of scratch and not an extension lol. Seriously though, this is kind of insane. I myself have just started to go into opengl rendering, and you've used math to make a software renderer in scratch. Seriously cool stuff
  • @ajb16384
    I made some improvements to your math. The radius of the incenter of a triangle is equal to its area over its semiperimeter (half its perimeter). Its area can be calculated by evaluating |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / 2. Assuming a, b, c are the distance between x2-x3, x1-x3, and x1-x2, in respective order, The semiperimeter is (a + b + c) / 2. Dividing the area and the semiperimeter, both sides are divided by 2 so we take multiply both sides by 2, to get the final form: |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / (a + b + c) Also something you seem to do often is finding the point on a line that's closest to another point, here's how you can do that. Start with the line defined by points p1, p2 and outside point p which you want to find the closest point on the line to define t = p2 - p1 find the value (p dot t) / (t dot t) interpolate between p1 and p2 using that value and you have your closest point :) Sidenote: t dot t is the same as the square of the magnitude of t or t.x² + t.y² Also, in the part where you're moving along the line between the incenter and a point of the triangle by distance r0, you can get around the problem of vertical lines by doing this: incenter + normalize(point - incenter) * r0, where normalize means giving a vector a magnitude of 1 by dividing by its own magnitude. Links: https://www.desmos.com/calculator/arjw17vu1i https://www.desmos.com/calculator/vnioqsqfjj https://www.desmos.com/calculator/jto271dcja
  • @Jackpkmn
    This has strong "i'm gonna build a house with Fischer price plastic tools" vibes and honestly i love it.
  • @Fluffernater
    You need to be a math teacher. This isnt even meant to be a math learning video but this SERIOUSLY helped me with my struggle in math. We need teachers like you, make the class have one common goal (in this case, making sm64 in scratch) and guiding the class through it while asking questions. Thats the supreme way of teaching
  • @kkibi
    4 MONTHS. 1 TRIANGLE. LETS GOOOOOOOOO
  • @nickvanamburg
    The radius of the inner circle is known as the inradius and has a simple formula: r = K/s where K is the area and s is the semiperimeter (a+b+c)/2 (quoted from wikibooks). If you apply this formula, I think you'll see some performance improvements since the square root won't be needed anymore!
  • @lucaspawprint1888
    I'm pretty sure sm64's polygons aren't rendered all at once, but the amount of calculations you did to optimize it was very impressive regardless
  • @NotABean_
    man i love when you get some basic, unconventional logic system, like minecraft redstone or scratch, and apply complex, low-level mathematics to achieve something 'simple' really makes you appreciate the genius on which our normal everyday programs are built upon
  • You are seriously talented and smart man. Good luck with school, and good luck with this project. Can't wait to see where it goes!
  • @ezraengineerkid
    Man. Being a small YouTube creator, i know you put a LOT of effort into this.
  • @lillyy256
    legends say he's still making a 2nd triangle
  • @qwertzuioppel
    i come back every few months to see if you uploaded the next part... i wish you have all the motivation you need
  • @KingOfAluminum
    This seems like it's gonna be an awesome project! I think the 3D engine programming will take you a lot longer than it took to make this video though (ESPECIALLY in Scratch), and I imagine you're gonna have to do an insane amount of optimizing the code. One thing it looks like you overlooked is that you won't actually need to render 1000 triangles at once, because you likely won't be rendering the whole level at once, only the parts you can see.
  • @BerzerkVideos
    I like your work, but I feel you make your music too loud. I can't really hear your explanations that well. Ignoring that though, that's Insane! Those parts where you showed random triangles with random colors, it looked straight out of an old PZ game. That is SO COOL!