Falling in LÖVE with Lua

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

КОМЕНТАРІ • 123

  • @marcellacosta1375
    @marcellacosta1375 4 роки тому +80

    I was introduced to Lua back in Rio during my graduation at PUC, by its own creator! Roberto Ierusalimschy.
    Fantastic language and fantastic teacher

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

      I guess Im randomly asking but does anybody know of a trick to log back into an instagram account?
      I was stupid forgot my account password. I appreciate any tricks you can offer me

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

      Quem diria que Lua se tornaria uma linguagem tão conhecida mundo afora!

  • @requi2383
    @requi2383 6 років тому +37

    I am completely in love with Lua too, I am happy that I am not the only one!

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

      The community is quite small, but it’s faster and more lightweight than python (but that doesn’t mean python is bad) and is why I chose it.

  • @shubhammittal9764
    @shubhammittal9764 7 років тому +148

    Does creating games seems more fun than playing it, or I am just going nuts? (which I often do)

    • @coltonoscopy
      @coltonoscopy 7 років тому +37

      I tend to get a lot of enjoyment out of both :)

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

      Thanks for introducing Lua to us, will explore it after I've completed cs50 :)

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

      Hope you have fun! :D

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

      creating a game for me is a game by itself

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

      Colton Ogden hey colton, just have a quick question how would i usee moonscript with löve ? (Btw moonscript is a language that compiles to lua, it takes away the need of most of the syntax for curly braces etc and makes life easier lol)

  • @ShemarMcLean
    @ShemarMcLean 6 років тому +18

    I'm soo glad there's a talk about this

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

    Thank you CS50 and Colton for this amazing course 😁. It's really helpful for beginners like me to get started. I have been trying to get into gamedev for months but stumble, trip and fall because I tried to jump to higher rungs instead of climbing from the bottom. Love2D is awesome way to get started and I've felt it. Completed pong and can't wait to make other games in the course.

  • @Pashb33
    @Pashb33 6 років тому +21

    great video for a great project. The guys who maintain LOVE need some LOVE because they rock. Games in 2018 suck major ass unfortunately. So, i challenge people to make games we would rather player using awesome tools like LOVE. Game Dev faces on, go go go.

  • @lua2wood
    @lua2wood 4 роки тому +16

    Thank you guys for falling in love with me!!

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

    3:20 you missed out that the same thing you explained prior (globals vs locals) also applies to functions
    local function say(...) --local functions
    print(...)
    end
    function say(...) --global function
    print(...)
    end

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

    Great stuff. Just wondering why you used string keys in the sounds table instead of just doing:
    sounds = {
    jump = love.audio.newSource(a, b),
    hit = love.audio.newSource(a, b),
    coin = love.audio.newSource(a, b)
    }
    This way seems better since some editors would even auto suggest the sounds whenever we accessed self.sounds. Is there more to it that I'm not seeing?

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

      thanks Nika!! You could definitely do it that way, but then you're limited to naming your keys with symbol limitations (i.e., no dashes or other characters you couldn't put into a variable name, including spaces). Also, if you want to have maybe 10 sound effects that are similarly named (hit1, hit2, hit3), you could programmatically access them if they were in string format but not so if they were symbols, if that makes sense? For many use cases though, the distinction doesn't necessarily matter; I just default to this method!

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

      Thanks for the reply! I didn't take variable naming restrictions into account, now that you explained it, that seems like an obvious reason why one would use string keys. What I didn't get is the "hit1, hit2, hit3" example where you wrote that one could access them programmatically I can access sounds.jump just as well as sounds["jump"]. The advantage I see of the string key here may be with the ability to to access each sound with a variable.
      Like:
      -- Say we have some local variable 'currentSound' somewhere in the scope
      if player.isRunning then
      currentSound = "running"
      -- maybe some more cases here...
      elseif player.isWalking then
      currentSound = "walking"
      end
      self.sounds[currentSound]:play()
      Probably not what you meant, but am I close?
      (You don't have to answer, already thankful for the reply)

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

      Hey Nika, the programmatic access I'm referring to could vary case by case, but one I just used in the most recent lecture example actually is there are five sounds called 'wood1', 'wood2', 'wood3', etc., and I can randomly choose one of them by simply appending a math.random(5) call to the string 'wood' and then indexing the sounds table with that new generated string, which isn't possible with variables! You could also just lump all of these in a nested table of their own and then simply do a gSounds['wood'][math.random(#gSounds['wood'])], but that starts to obviously get a little bit hairy! Hope that helps!

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

      Thanks! I realize there are many ways to go about solving this certain problem but I wanted to know your reasons for going with the one you use. Also, playing a random sound from a nested sounds table doesn't have to be that messy. You could easily set the __call function of the inner table to play a random sound from its children.
      Like:
      ```
      sounds = {
      hit = { love.audio.newSource(a, b), love.audio.newSource(a, b), love.audio.newSource(a, b) }
      }
      setmetatable(sounds.hit, {
      __call = function(self) self[math.random(#self)]:play() end
      })
      -- This metatable can even be abstracted away so you could simply call
      -- setemtatable(sounds.hit, randomSoundMetaTable)
      ```
      so now instead of
      sounds.hit[math.random(#sounds.hit)]:play()
      you would only have to do
      sounds:hit()
      or when using string keys, simply
      sounds["hit"]() -- the self argument is implicit here, I suppose
      I get that having to set the metatable on every nested sound table would be a pain, but one could just loop through the sounds table once inside love.load() and just setmetatable.
      Less hair, less string concatenation and more lua magic.
      I just set up a working example here if you want to check it out:
      github.com/Nikaoto/sounds-table

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

      Hey Nika, that's a great approach to the problem! It then lets you also place the :stop() method inside the __call function to clean up examples that call it every time we call play() as well :) While I think this is great for a real-world code base, or a more advanced class, I think it's a little too fancy for this intro class; indeed, we deliberately strayed from using metatables altogether in favor of using HUMP's "Class" library, which we've bundled with every distro, just to make things a little closer to what folks have expected from CS50's use of Python classes (or maybe folks with a Java background or the like). But if I were making a commercial game in Lua, I would definitely use your approach for this use case to clean up the code! Thanks for putting together that demo! :D

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

    I can see 3 persons and a camera on the screen

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

    Great lecture.
    You should do part II coding the enemies and their AI.

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

    Lua is also integrated into the Roblox Studio game engine. It is much similar to Love2D but its 3D and integrated as a game engine with pre-made UI

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

    OK... why wasn;t this at the start of the CS50G course? It tosses you into pong and I was so confused how things worked in Lua when trying to work on project 0!

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

    🙏 this is a solid introduction. thank you!

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

    dear coloton how many inches in size the TV your using in your lecture.

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

      85"!

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

      thanks you coloton i am an Asst.professor and I wanted to use a TV for my edu. channel ua-cam.com/users/dsree91 I hope you like my work.

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

    Great talk, thanks for sharing!
    Is there a link for the code used on the presentation? Thanks again for this.

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

      0:33
      github.com/CS50/Mario-demo

  • @not_amanullah
    @not_amanullah 4 місяці тому

    Thanks

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

    anybody have this running the github lovedemo ? :
    Error
    push.lua:101: attempt to call field 'getPixelScale' (a nil value)
    Traceback
    push.lua:101: in function 'initValues'
    push.lua:48: in function 'setupScreen'
    main.lua:26: in function 'load'
    [C]: in function 'xpcall'
    [C]: in function 'xpcall'

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

      Have you just downloaded Love?
      If so, you may be running Love v11, which just came out. I can run it fine with 0.10 which was the previous version.

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

      yeah you're right, with the previous version it's work fine. thank you !

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

    omg lua fan base!!!!!!! what???!!!!☺️☺️☺️☺️

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

      Yeah! Lua absolutely deserves a strong fan base!

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

      @@jared_per is there is any future of Lua. I am new i don't know much about programming. Is Lua worth it ?

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

      @@abhishekamoli1586 I personally think it's worth it. Though it is less popular than a lot of other languages, it is still very useful. Depending on your skill level and need, it can vary how useful it will be for you. But it's used commonly in gameDev, Adobe Photoshop Lightroom uses it. one of my favorite strategy games uses a modified LUA.
      In terms of popularity, it's (unfortunately) not growing growing much, but it's not dying either. I personally think it should get a lot more attention than it does, but I am biased because it's my first language I learned.

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

      @@jared_per thanks for replying sir I have just started programming and i am very confuse which language should I learn first. Thanks for giving me your opinion it means a lot to me.

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

      @@abhishekamoli1586 I'm very happy that I started with Lua. Getting started with it is much easier than something like C#. You don't have to worry about type setting and such. You just... program.

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

    Shame the git repo isn't linked in the description

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

    Is there a list if packages that he's using for Atom? His setup looks REALLY nice. :)

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

      No real packages in use here, except maybe syntax highlighting for Lua (don't recall if Atom ships with it)! :)

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

    oh my god lua is so hot

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

    where is the link to the git repo ?

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

    Thanks for the video! Can anyone share the link to download the source code please?

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

    17:12 sprite sheet (ahw, nice. so this is what those little image in the games folder are called)
    17:13 lua is one indexed

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

    what is the ide he is using..

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

      What do you mean Atef? :)

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

      I meant the IDE but the auto correction lol..

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

      oh haha just Terminal + Atom :)

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

      By the way, there's a package for Atom which add a lot of tools for LOVE2D game development, such as a simple play button for testing your game.

  • @aftalavera
    @aftalavera 6 місяців тому

    There goes the Harvardhood!

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

    What Text Editor Do You Use With Lua and love?

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

      Check out ZeroBrane

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

      In this video he's using VS Code, you need to install a couple plugins to make it work easily.

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

      @BloxyHD Oh, Looking at it again I think you're right!

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

      Just use neovim noob

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

      Any, but choose Atom if you want customizablity

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

    1:00:38 "... divided by [INAUDIBLE]"
    oh lol, it's: "... divided by self dot tile-height"

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

    Created one game which is the pong,since that day i never stopped playing because i learned how to code and make this game.im using windows so its a real pain in the ass to configure it and each time you have to go on folder that your main.lua program is and the press shift right click the command promp and press love .
    In mac you only have to press start i think

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

      which text editor is being used here?

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

      @@adityamehra7238 try zerobrane

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

    Love the presentation, and I know the video is very long, but you should've taken your time as you talk very fast

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

    Yeah I also want to fall in lion with lua

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

    3:45 Do this body

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

    i will try to learn this and make the best roblox game ever

  • @Noob-ix1bf
    @Noob-ix1bf 2 роки тому

    #Lua

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

    I like LUE

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

    14:02 what?
    lol

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

    Что он все, когда описывает, с питоном сравнивает.

  • @hexbit01
    @hexbit01 6 років тому +9

    Sheldon Cooper is you? 😂😂😂😂😂😂😂

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

    this is unacceptable, you are offering advice and a tutorial pretty much here. How are people supposed to make their own decisions on teh content if you don't allow users to comment and share thoughts on it? I get that you could be getting trolled unfairly, but if all videos do this then people will be continuously learning information they think is credible and it turns out being wrong. We can't have that happen! We must have a dialogue open at all times! If your video is purely entertainment, then sure kill the comments and the ratings...people can decide if they like it by watching it. Educational videos must be treated differently though.

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

    By no means an expert, but he could do better here.
    5:06 line 61 rather than having it look like what's shown he can instead do
    local person = {
    name = 'Colton Ogden',
    age = 26,
    height = 69.5,
    }
    this way is a bit more efficient in key strokes and some performance applications since lua will create one table "person" and associate "name", "age", "height" with just that table. Whereas what his example shows are 4 different tables

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

      year old comment, I know, but I believe Colton is doing this to illustrate that you can declare and append variables to a lua table without having to declare your variable with those values initially. it helps to know that you can simply do:
      person.name = var
      or
      person["name"] = var

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

    python >>>>>>>>>>> lua

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

      lol ))

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

      C# >>>>>>>>>>> python
      Even though they are basically the same

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

      @@mason3872 lua >>>>>>>>>>> C#
      inf loop

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

      Yes. Python is far more fun and easy to work with. It's also dogshit slow compared to LuaJIT. If that matters to you, then it matters a lot. If it doesn't then Python is far superior imo. If Python could come anywhere near LuaJIT I'd be in heaven.

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

    OOP in Lua is very ugly and painful. Use Moonscript if you really need OOP.

  • @aftalavera
    @aftalavera 6 місяців тому

    This ought to be a joke!

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

    Arrays start at 0.

    • @maximbrykov
      @maximbrykov 6 років тому +9

      "However, it is customary in Lua to start arrays with index 1. The Lua libraries adhere to this convention; so, if your arrays also start with 1, you will be able to use their functions directly" www.lua.org/pil/11.1.html

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

      not in lua