title
Pong (with Lua) - CS50's Intro to Game Development
description
Learn game development by creating the game of Pong using Lua and LÖVE2D.
This beginner's course teaches the foundations of game development. This video is lecture 0 of CS50's Intro to Game Development from Harvard University.
Check out the full course playlist: https://www.youtube.com/playlist?list=PLWKjhJtqVAbluXJKKbCIb4xd7fcRkpzoz
🔗Assignment: https://docs.cs50.net/ocw/games/assignments/0/assignment0.html
⭐️Contents⭐️
⌨️ (0:00:00) Introduction
⌨️ (0:04:10) Lecture Topics
⌨️ (0:07:35) What is Lua?
⌨️ (0:09:20) LÖVE2D
⌨️ (0:10:08) Game Loops
⌨️ (0:11:06) 2D Coordinate System
⌨️ (0:11:47) Lecture Scope
⌨️ (0:13:01) The Day-0 Update
⌨️ (0:18:55) The Low-Res Update
⌨️ (0:21:02) Texture Filtering
⌨️ (0:25:10) The Rectangle Update
⌨️ (0:30:42) The Paddle Update
⌨️ (0:35:42) The Ball Update
⌨️ (0:45:37) The Class Update
⌨️ (0:55:51) The FPS Update
⌨️ (0:59:35) The Collision Update
⌨️ (0:59:51) AABB Collision Detection
⌨️ (1:12:37) The Score Update
⌨️ (1:14:40) State Machine
⌨️ (1:21:18) The Victory Update
⌨️ (1:27:57) The Audio Update
⌨️ (1:26:44) bfxr
⌨️ (1:33:54) The Resize Update
Want to learn more computer science basics? Check out the original CS50 course: https://www.youtube.com/watch?v=F0WoVEr0-44&list=PLWKjhJtqVAbmGw5fN5BQlwuug-8bDmabi
Lecture taught by Colton T. Ogden. Thanks to Harvard's CS50 for giving us permission to post this lecture. Checkout their YouTube channel for more great lectures: https://www.youtube.com/cs50
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://medium.freecodecamp.org
detail
{'title': "Pong (with Lua) - CS50's Intro to Game Development", 'heatmap': [{'end': 874.228, 'start': 816.884, 'weight': 0.885}, {'end': 1165.229, 'start': 1043.507, 'weight': 1}, {'end': 1340.86, 'start': 1281.664, 'weight': 0.869}], 'summary': "Course 'pong (with lua) - cs50's intro to game development' introduces unity and love2d, lua programming, game frameworks, and game development concepts for 2d games such as pong, covering topics like setting up love2d, lua, and the game loop, love2d functions, pong game development, random number generation in lua, object-oriented programming, debugging, collision detection, scoring system, state machines, adding audio, and lua tables.", 'chapters': [{'end': 395.543, 'segs': [{'end': 56.056, 'src': 'embed', 'start': 29.397, 'weight': 6, 'content': [{'end': 35.34, 'text': 'we just assume that you have prior programming experience in most any language and therefore have some comfort with some of the basic constructs of programming.', 'start': 29.397, 'duration': 5.943}, {'end': 40.244, 'text': "But we assume no background in Lua or Lub2D or any of the frameworks that we'll be using in the class.", 'start': 35.62, 'duration': 4.624}, {'end': 42.205, 'text': 'All of that lies ahead.', 'start': 40.304, 'duration': 1.901}, {'end': 46.088, 'text': "So if you're like me, you probably grew up with video games of some sort.", 'start': 42.345, 'duration': 3.743}, {'end': 52.333, 'text': 'And when you maybe started programming, the programming environments were perhaps very text-based, black and white terminal window and the like.', 'start': 46.128, 'duration': 6.205}, {'end': 56.056, 'text': 'And maybe you did something graphical with a language like Scratch or Alice or beyond.', 'start': 52.373, 'duration': 3.683}], 'summary': 'The course assumes prior programming experience, no background in lua or lub2d, and mentions familiarity with text-based and graphical programming environments.', 'duration': 26.659, 'max_score': 29.397, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM29397.jpg'}, {'end': 141.572, 'src': 'embed', 'start': 111.269, 'weight': 0, 'content': [{'end': 120.376, 'text': "Some in the form of smaller assignments that are meant to reinforce just some of the more recent material and sort of set you up for success with the course's deeper and more hands-on projects.", 'start': 111.269, 'duration': 9.107}, {'end': 124.779, 'text': "Because indeed, the project is where you'll build or extend some of your own games.", 'start': 120.616, 'duration': 4.163}, {'end': 129.883, 'text': 'And then the class itself will culminate at the very end of the semester with your very own final project, an opportunity to propose,', 'start': 124.819, 'duration': 5.064}, {'end': 134.086, 'text': "to design and implement a game that somehow or other draws upon the course's lessons.", 'start': 129.883, 'duration': 4.203}, {'end': 138.93, 'text': "So that when you walk out of here in just a few months time, you've not only played your fair share of games,", 'start': 134.347, 'duration': 4.583}, {'end': 141.572, 'text': 'but have actually built several of your own.', 'start': 138.93, 'duration': 2.642}], 'summary': 'Course involves smaller assignments, hands-on projects, and a final game project to reinforce learning and build games.', 'duration': 30.303, 'max_score': 111.269, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM111269.jpg'}, {'end': 294.478, 'src': 'embed', 'start': 266.35, 'weight': 1, 'content': [{'end': 269.392, 'text': 'which is a dynamic scripting language very similar to Python and JavaScript.', 'start': 266.35, 'duration': 3.042}, {'end': 273.074, 'text': "We'll be covering Love2D as our primary game framework,", 'start': 269.752, 'duration': 3.322}, {'end': 282.553, 'text': 'which is a runtime and a framework which exposes all of its methods for drawing audio input et cetera via Lua,', 'start': 273.074, 'duration': 9.479}, {'end': 286.855, 'text': "so that it's very easy to write code very quickly but get very good results.", 'start': 282.553, 'duration': 4.302}, {'end': 290.096, 'text': 'And the documentation for their framework is superb, in my opinion.', 'start': 286.895, 'duration': 3.201}, {'end': 294.478, 'text': "Today we'll be talking about a few just basic principles as we get our feet wet with game development.", 'start': 290.816, 'duration': 3.662}], 'summary': 'Introduction to love2d for game development using lua, with emphasis on quick coding and superb documentation.', 'duration': 28.128, 'max_score': 266.35, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM266350.jpg'}, {'end': 345.629, 'src': 'embed', 'start': 307.165, 'weight': 3, 'content': [{'end': 313.99, 'text': 'which delta time is probably arguably one of the most important variables that we keep track of in any game framework or engine,', 'start': 307.165, 'duration': 6.825}, {'end': 318.153, 'text': "which is just the amount of time that's elapsed since the last frame of execution in our game.", 'start': 313.99, 'duration': 4.163}, {'end': 322.325, 'text': 'measured in Love2D in terms of seconds, fractions of seconds.', 'start': 319.301, 'duration': 3.024}, {'end': 325.629, 'text': "We'll be talking about game state because you can have a state in your game.", 'start': 322.725, 'duration': 2.904}, {'end': 327.291, 'text': 'You can be at the title screen.', 'start': 325.669, 'duration': 1.622}, {'end': 327.931, 'text': 'You can be playing.', 'start': 327.311, 'duration': 0.62}, {'end': 328.812, 'text': 'You can be in a menu.', 'start': 327.951, 'duration': 0.861}, {'end': 334.459, 'text': "This will obviously be very important because you want different update logic and rendering logic depending on what state you're in.", 'start': 329.513, 'duration': 4.946}, {'end': 341.148, 'text': "We'll be talking about basic object-oriented programming for those who might be unfamiliar coming from C.", 'start': 335.606, 'duration': 5.542}, {'end': 345.629, 'text': "It's basically a way of encapsulating our data, any of our game objects,", 'start': 341.148, 'duration': 4.481}], 'summary': 'Delta time is crucial in game development, measured in seconds. game states require different logic.', 'duration': 38.464, 'max_score': 307.165, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM307165.jpg'}, {'end': 395.543, 'src': 'embed', 'start': 364.195, 'weight': 5, 'content': [{'end': 370.28, 'text': "We'll be talking about hitboxes today, predominantly in the context of box collision, because we'll be talking about pong,", 'start': 364.195, 'duration': 6.085}, {'end': 371.701, 'text': 'which is just paddles and a ball.', 'start': 370.28, 'duration': 1.421}, {'end': 377.005, 'text': "Those are all rectangles, and they'll be colliding with what's called axis-aligned bounding boxes.", 'start': 372.021, 'duration': 4.984}, {'end': 386.837, 'text': 'which makes calculating whether two boxes have collided very simple, as opposed to calculating rotated hitboxes, which is a bit more complicated.', 'start': 379.212, 'duration': 7.625}, {'end': 393.882, 'text': "And then lastly, we'll polish off with sound effects, because adding that polish layer, in my opinion, is important and ties it all together.", 'start': 387.217, 'duration': 6.665}, {'end': 395.543, 'text': 'It makes it feel like a more cohesive whole.', 'start': 394.162, 'duration': 1.381}], 'summary': 'Discusses hitboxes in box collision for pong, using axis-aligned bounding boxes for simplicity, and emphasizes the importance of adding sound effects for a cohesive experience.', 'duration': 31.348, 'max_score': 364.195, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM364195.jpg'}], 'start': 17.21, 'title': 'An introduction to game development and unity', 'summary': 'Introduces the course structure, prerequisites, and goals of teaching game development, including the focus on unity and love2d, lua programming language, game frameworks, delta time, game states, object-oriented programming, hitboxes, and sound effects to prepare for 2d game development.', 'chapters': [{'end': 232.641, 'start': 17.21, 'title': 'Intro to game development', 'summary': "Introduces the course structure, prerequisites, and goals of teaching game development, as well as the instructor's personal journey into programming and game development, aiming to equip students to build and extend their own games by the end of the semester.", 'duration': 215.431, 'highlights': ['The course assumes prior programming experience in any language and introduces Lua and Lub2D frameworks, diving into the context of games and underlying principles throughout the semester. The course assumes prior programming experience in any language and introduces Lua and Lub2D frameworks, diving into the context of games and underlying principles throughout the semester.', "The class will culminate with students building or extending their own games and implementing a final project that draws upon the course's lessons. The class will culminate with students building or extending their own games and implementing a final project that draws upon the course's lessons.", "Instructor's personal journey into programming and game development, including initial intimidation, subsequent curiosity, and growth in programming and computer science, aiming to inspire and guide students through the course. Instructor's personal journey into programming and game development, including initial intimidation, subsequent curiosity, and growth in programming and computer science, aiming to inspire and guide students through the course."]}, {'end': 395.543, 'start': 233.381, 'title': 'Introduction to unity and game development', 'summary': 'Covers the introduction to game development using unity and love2d, focusing on lua programming language, game frameworks, delta time, game states, object-oriented programming, hitboxes, and sound effects, to prepare for 2d game development.', 'duration': 162.162, 'highlights': ['Introduction to Unity and Love2D The chapter introduces Unity and Love2D as primary game frameworks, highlighting the use of Lua programming language and its accessibility, popularity, and documentation.', 'Delta Time and Game States Delta time, vital for game execution, is explained along with the importance of game states for managing update and rendering logic based on different states.', 'Object-Oriented Programming The concept of object-oriented programming is discussed, emphasizing its role in encapsulating data and functions for individual game objects, simplifying code management.', 'Hitboxes and Collision Detection Hitboxes are explained in the context of box collision, focusing on axis-aligned bounding boxes for simple collision calculations, crucial for games like Pong.', 'Sound Effects Integration The importance of sound effects in adding a polished layer to games is highlighted, emphasizing its role in enhancing the overall game experience.']}], 'duration': 378.333, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM17210.jpg', 'highlights': ["The class will culminate with students building or extending their own games and implementing a final project that draws upon the course's lessons.", 'Introduction to Unity and Love2D as primary game frameworks, highlighting the use of Lua programming language and its accessibility, popularity, and documentation.', "Instructor's personal journey into programming and game development, aiming to inspire and guide students through the course.", 'Delta time, vital for game execution, is explained along with the importance of game states for managing update and rendering logic based on different states.', 'Object-Oriented Programming is discussed, emphasizing its role in encapsulating data and functions for individual game objects, simplifying code management.', 'Hitboxes are explained in the context of box collision, focusing on axis-aligned bounding boxes for simple collision calculations, crucial for games like Pong.', 'The course assumes prior programming experience in any language and introduces Lua and Lub2D frameworks, diving into the context of games and underlying principles throughout the semester.', 'Sound Effects Integration is highlighted, emphasizing its role in enhancing the overall game experience.']}, {'end': 781.474, 'segs': [{'end': 426.919, 'src': 'embed', 'start': 396.67, 'weight': 0, 'content': [{'end': 400.975, 'text': "So, two important things that we'll need to do when we're following along with the examples,", 'start': 396.67, 'duration': 4.305}, {'end': 404.58, 'text': "which I'll show you a link to the repo in a moment is getting Love2D installed.", 'start': 400.975, 'duration': 3.605}, {'end': 405.782, 'text': "It's a very simple process.", 'start': 404.6, 'duration': 1.182}, {'end': 408.165, 'text': 'The first link here is just a download link.', 'start': 406.102, 'duration': 2.063}, {'end': 412.991, 'text': "So it's available for all major operating systems, so Linux, Mac, and Windows.", 'start': 408.245, 'duration': 4.746}, {'end': 419.995, 'text': 'And then the Getting Started link down here below will give you some tips as to how to get started actually running it on your machine.', 'start': 413.671, 'duration': 6.324}, {'end': 426.919, 'text': 'On Mac, I alias the actual runtime executable within the app that it comes with.', 'start': 420.455, 'duration': 6.464}], 'summary': 'Install love2d for all major operating systems using provided link and follow getting started tips for running it on your machine.', 'duration': 30.249, 'max_score': 396.67, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM396670.jpg'}, {'end': 474.97, 'src': 'embed', 'start': 436.744, 'weight': 1, 'content': [{'end': 440.425, 'text': 'And there are similar instructions located on the page for other operating systems.', 'start': 436.744, 'duration': 3.681}, {'end': 444.247, 'text': "And this is the repo here, which has all of the source code that we'll be using today.", 'start': 440.785, 'duration': 3.462}, {'end': 452.569, 'text': "And I've structured it in a series of 13 different sub-repos so that you can follow along and we can build upon Pong, starting from scratch,", 'start': 444.547, 'duration': 8.022}, {'end': 454.19, 'text': 'going all the way to a fully implemented game.', 'start': 452.569, 'duration': 1.621}, {'end': 457.325, 'text': "So the first thing we'll talk about is what Lua is.", 'start': 455.464, 'duration': 1.861}, {'end': 459.785, 'text': "We'll be using Lua for about 75% of the course.", 'start': 457.465, 'duration': 2.32}, {'end': 460.986, 'text': "It's a very popular,", 'start': 460.085, 'duration': 0.901}, {'end': 474.97, 'text': 'dynamic scripting language Portuguese for moon and it was invented in the early 90s as primarily a config language and a runtime language for compiled code bases to save time on adding code to those code bases and recompiling them.', 'start': 460.986, 'duration': 13.984}], 'summary': 'Using lua for 75% of the course, building 13 sub-repos to create pong game from scratch to fully implemented, lua invented in early 90s as a config and runtime language.', 'duration': 38.226, 'max_score': 436.744, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM436744.jpg'}, {'end': 576.678, 'src': 'embed', 'start': 549.2, 'weight': 3, 'content': [{'end': 554.923, 'text': "And it's very excellent because it was initially intended as a config language and just sort of a glue layer.", 'start': 549.2, 'duration': 5.723}, {'end': 558.465, 'text': "It's very good for storing data and code together, almost one and the same.", 'start': 555.103, 'duration': 3.362}, {'end': 565.605, 'text': 'So Love2D is a fast 2D game development framework.', 'start': 559.898, 'duration': 5.707}, {'end': 572.053, 'text': "It's compiled in C++, and it runs very efficiently because it's so simple, despite the fact that we're running it in Lua.", 'start': 565.645, 'duration': 6.408}, {'end': 576.678, 'text': 'It has modules for basically anything you would need in the context of 2D game development.', 'start': 572.633, 'duration': 4.045}], 'summary': 'Love2d is a fast 2d game development framework, compiled in c++, with modules for various 2d game development needs.', 'duration': 27.478, 'max_score': 549.2, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM549200.jpg'}, {'end': 632.167, 'src': 'embed', 'start': 608.783, 'weight': 4, 'content': [{'end': 616.093, 'text': 'So before we get into looking at some actual concrete code, I think the most fundamental thing we should take a look at is what a game loop is.', 'start': 608.783, 'duration': 7.31}, {'end': 625.484, 'text': 'So a game, fundamentally, is just an infinite loop, like a while true or a while one only in this case, Every iteration of that loop,', 'start': 616.473, 'duration': 9.011}, {'end': 628.465, 'text': "we're doing a set of steps back to back, over and over again.", 'start': 625.484, 'duration': 2.981}, {'end': 629.786, 'text': "We're processing input.", 'start': 628.826, 'duration': 0.96}, {'end': 632.167, 'text': "So we're seeing has the user pressed a key on the keyboard??", 'start': 630.086, 'duration': 2.081}], 'summary': 'A game loop is a fundamental aspect of a game, involving an infinite loop where input is processed.', 'duration': 23.384, 'max_score': 608.783, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM608783.jpg'}, {'end': 733.119, 'src': 'embed', 'start': 708.191, 'weight': 5, 'content': [{'end': 714.893, 'text': "So today's goal, we're going to start fairly low level and work our way up through examples today and in future classes.", 'start': 708.191, 'duration': 6.702}, {'end': 723.556, 'text': 'Our first game is arguably one of the simplest, but also one of the most famous games of all time, Pong, which was released in 1972.', 'start': 715.733, 'duration': 7.823}, {'end': 728.517, 'text': 'And the gist of Pong is you have a paddle on the left side of the screen, a paddle on the right side of the screen.', 'start': 723.556, 'duration': 4.961}, {'end': 733.119, 'text': "Whoever scores 10 points by getting the ball past their opponent's paddle and to the edge of the screen wins.", 'start': 728.537, 'duration': 4.582}], 'summary': 'Starting with pong, a simple game released in 1972, aiming to score 10 points to win.', 'duration': 24.928, 'max_score': 708.191, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM708191.jpg'}], 'start': 396.67, 'title': 'Setting up love2d, lua, and the game loop', 'summary': 'Covers installing love2d, running it on mac, and introduces a repo for building pong. it also introduces lua, emphasizing its use in 75% of the course and its integration with love2d. additionally, it explains the concept of a game loop and its relevance to 2d game development through the example of pong.', 'chapters': [{'end': 454.19, 'start': 396.67, 'title': 'Setting up love2d for game development', 'summary': 'Covers the process of installing love2d, which is available for all major operating systems, and provides tips for getting started with running it on mac. additionally, it introduces a repo with 13 sub-repos for building upon pong from scratch to a fully implemented game.', 'duration': 57.52, 'highlights': ['The Getting Started link provides tips for running Love2D on different operating systems, including instructions for Mac and others.', 'The repo contains a series of 13 sub-repos for building upon Pong, allowing for the development of a fully implemented game from scratch.', 'Love2D is available for all major operating systems, including Linux, Mac, and Windows.']}, {'end': 607.609, 'start': 455.464, 'title': 'Lua and love2d for game development', 'summary': 'Introduces lua, emphasizing its use in 75% of the course, its focus on tables, and its integration with the love2d game development framework, which is fast, efficient, and ideal for 2d game development.', 'duration': 152.145, 'highlights': ['Lua is used for about 75% of the course Lua is a dynamic scripting language invented in the early 90s, primarily used as a config language and a runtime language for compiled code bases, enabling rapid development and runtime interaction with compiled code.', 'Love2D is a fast 2D game development framework Love2D, compiled in C++, efficiently runs Lua and provides modules for graphics, keyboard input, math, and other 2D game development necessities, making it ideal for prototyping and easy game development.', "Lua's focus on tables and its integration with Love2D for rapid development and runtime interaction Lua is focused around the concept of a table, making it suitable for integrating with game engines like Love2D, allowing rapid development and runtime interaction with compiled code, which is essential for game development."]}, {'end': 781.474, 'start': 608.783, 'title': 'Understanding the game loop', 'summary': 'Explains the concept of a game loop, emphasizing the iterative process of processing input, updating game state, re-rendering changes, and introduces the basics of 2d game development through the example of pong.', 'duration': 172.691, 'highlights': ['The game loop consists of processing input, updating game state, and re-rendering changes in an iterative manner. The game loop is described as an infinite loop where input processing, game state updating, and re-rendering of changes occur in an iterative manner.', 'Introduction to the basics of 2D game development through the example of Pong, focusing on drawing shapes to the screen, controlling 2D position of paddles and ball, detecting collision, incorporating sound effects, and implementing score keeping. The lecture introduces the basics of 2D game development through the example of Pong, covering drawing shapes, controlling positions, collision detection, sound effects, and score keeping.', 'Explanation of the 2D coordinate system for 2D game development, where the origin is at the top left, and the positive y-axis goes down, positive x-axis goes right. The 2D coordinate system used in 2D game development is explained, with the origin at the top left and the positive y-axis going down and the positive x-axis going right.']}], 'duration': 384.804, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM396670.jpg', 'highlights': ['Love2D is available for all major operating systems, including Linux, Mac, and Windows.', 'The repo contains a series of 13 sub-repos for building upon Pong, allowing for the development of a fully implemented game from scratch.', 'Lua is used for about 75% of the course Lua is a dynamic scripting language invented in the early 90s, primarily used as a config language and a runtime language for compiled code bases, enabling rapid development and runtime interaction with compiled code.', 'Love2D is a fast 2D game development framework Love2D, compiled in C++, efficiently runs Lua and provides modules for graphics, keyboard input, math, and other 2D game development necessities, making it ideal for prototyping and easy game development.', 'The game loop consists of processing input, updating game state, and re-rendering changes in an iterative manner. The game loop is described as an infinite loop where input processing, game state updating, and re-rendering of changes occur in an iterative manner.', 'Introduction to the basics of 2D game development through the example of Pong, focusing on drawing shapes to the screen, controlling 2D position of paddles and ball, detecting collision, incorporating sound effects, and implementing score keeping. The lecture introduces the basics of 2D game development through the example of Pong, covering drawing shapes, controlling positions, collision detection, sound effects, and score keeping.']}, {'end': 2158.634, 'segs': [{'end': 882.212, 'src': 'heatmap', 'start': 816.884, 'weight': 1, 'content': [{'end': 821.948, 'text': "And if we're looking at pong0 here, we can see it says here the day0 update.", 'start': 816.884, 'duration': 5.064}, {'end': 827.632, 'text': "I've commented everything fairly heavily so that we can, if you're reading the code, you can sort of get a sense of what's going on.", 'start': 821.968, 'duration': 5.664}, {'end': 833.776, 'text': "At line 23, we're going to start off by just declaring a window width and a window height.", 'start': 828.372, 'duration': 5.404}, {'end': 837.599, 'text': 'And these are just constant variables that will be accessible throughout the rest of our application.', 'start': 834.256, 'duration': 3.343}, {'end': 840.901, 'text': "So I'm just setting 1280 by 720 as an arbitrary resolution.", 'start': 838.159, 'duration': 2.742}, {'end': 842.122, 'text': "It doesn't matter too much.", 'start': 840.921, 'duration': 1.201}, {'end': 847.667, 'text': 'An important thing that we need to look at here is that line 29.', 'start': 843.803, 'duration': 3.864}, {'end': 851.871, 'text': "We're using a function called love.load.", 'start': 847.667, 'duration': 4.204}, {'end': 853.733, 'text': "And I'm actually going to go back to the slides here.", 'start': 852.151, 'duration': 1.582}, {'end': 855.275, 'text': "We're going to look at a few functions.", 'start': 853.993, 'duration': 1.282}, {'end': 860.8, 'text': "And I'm going to go over them and just sort of tell you what they do before we look at the code in too much detail.", 'start': 855.715, 'duration': 5.085}, {'end': 864.103, 'text': 'So love.load is just a function given to us by love.', 'start': 861.18, 'duration': 2.923}, {'end': 868.466, 'text': 'Love2D And we overwrite it.', 'start': 865.324, 'duration': 3.142}, {'end': 869.926, 'text': 'We give it behavior.', 'start': 868.946, 'duration': 0.98}, {'end': 870.807, 'text': 'We tell it what to do.', 'start': 869.966, 'duration': 0.841}, {'end': 874.228, 'text': 'And Love2D is going to look at it in our main.lua file.', 'start': 871.007, 'duration': 3.221}, {'end': 877.17, 'text': "If we're looking at pong0, you'll see it just has a main.lua file.", 'start': 874.248, 'duration': 2.922}, {'end': 882.212, 'text': 'Love2D expects just a main.lua file and will run the main.lua file.', 'start': 877.53, 'duration': 4.682}], 'summary': 'Code walkthrough of pong0, defining window size and love.load function behavior.', 'duration': 65.328, 'max_score': 816.884, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM816884.jpg'}, {'end': 965.337, 'src': 'embed', 'start': 917.289, 'weight': 0, 'content': [{'end': 923.171, 'text': "You're going to override it with your own behavior, and Love is going to execute this every frame, passing it in delta time.", 'start': 917.289, 'duration': 5.882}, {'end': 932.415, 'text': 'And you can use delta time dt in that function to change your application based upon how much time has passed.', 'start': 923.551, 'duration': 8.864}, {'end': 940.958, 'text': 'DT will always be a fraction of a second, potentially more depending on how slow your computer is, but typically 1 60th of a second.', 'start': 932.495, 'duration': 8.463}, {'end': 946.46, 'text': 'And you can scale anything in your game by that amount to get even behavior across all frame rates.', 'start': 941.438, 'duration': 5.022}, {'end': 955.334, 'text': 'Love.draw is the other big function between update and draw, two of the two arguably most important functions.', 'start': 947.611, 'duration': 7.723}, {'end': 962.236, 'text': "Love.draw is the function that we're going to define that has all of our drawing behavior, our rendering behavior in it.", 'start': 955.774, 'duration': 6.462}, {'end': 964.537, 'text': "And that's where we can draw our paddles.", 'start': 963.156, 'duration': 1.381}, {'end': 965.337, 'text': 'We can draw our ball.', 'start': 964.577, 'duration': 0.76}], 'summary': 'Using delta time for application behavior and scaling, love.draw for rendering.', 'duration': 48.048, 'max_score': 917.289, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM917289.jpg'}, {'end': 1165.229, 'src': 'heatmap', 'start': 1043.507, 'weight': 1, 'content': [{'end': 1051.57, 'text': "We're passing in love.window.setMode, window width and window height, which recall we defined up above as 1280 by 720.", 'start': 1043.507, 'duration': 8.063}, {'end': 1052.871, 'text': "We're passing in a table.", 'start': 1051.57, 'duration': 1.301}, {'end': 1055.672, 'text': 'This is the syntax for a table, these curly brackets.', 'start': 1053.211, 'duration': 2.461}, {'end': 1060.335, 'text': 'And the way that we define keys and values is just with an equal sign therein.', 'start': 1056.453, 'duration': 3.882}, {'end': 1063.897, 'text': 'So full screen gets false, resizable gets false, vsync gets true.', 'start': 1060.455, 'duration': 3.442}, {'end': 1065.778, 'text': "So it's going to not be full screen.", 'start': 1064.357, 'duration': 1.421}, {'end': 1069.821, 'text': "It's going to be not resizable, but it is going to be synced to our monitor's refresh rate.", 'start': 1065.818, 'duration': 4.003}, {'end': 1071.902, 'text': "And that's what vsync is, short for vertical sync.", 'start': 1069.841, 'duration': 2.061}, {'end': 1076.35, 'text': "And then on line 40, we're overwriting love.draw.", 'start': 1073.467, 'duration': 2.883}, {'end': 1080.274, 'text': 'And this has the love.graphics.printf function therein.', 'start': 1076.75, 'duration': 3.524}, {'end': 1082.796, 'text': "And we're saying we're passing in the string hello pong.", 'start': 1080.714, 'duration': 2.082}, {'end': 1084.798, 'text': "We're starting it at x0.", 'start': 1083.277, 'duration': 1.521}, {'end': 1093.266, 'text': "We're setting it at y window height divided by 2 minus 6, because the default font size in Love2D is 12 pixels tall.", 'start': 1085.419, 'duration': 7.847}, {'end': 1094.187, 'text': "So we're shifting it up by 6.", 'start': 1093.306, 'duration': 0.881}, {'end': 1096.91, 'text': "So it's perfectly centered vertically in the screen.", 'start': 1094.187, 'duration': 2.723}, {'end': 1105.484, 'text': "And then we're setting the alignment amount, the width, to window width so that it's going to align it within the entire width of our window.", 'start': 1098.942, 'duration': 6.542}, {'end': 1107.205, 'text': "And then we're setting it to center alignment.", 'start': 1105.784, 'duration': 1.421}, {'end': 1110.866, 'text': "So it's going to be center aligned within our entire window starting at x0.", 'start': 1107.525, 'duration': 3.341}, {'end': 1117.728, 'text': 'And so if we go to pong 0 and then we actually run it, it has the effect of doing this.', 'start': 1111.246, 'duration': 6.482}, {'end': 1122.95, 'text': "We're just rendering in our default font, default size, hello pong right in the middle of the screen.", 'start': 1118.068, 'duration': 4.882}, {'end': 1126.048, 'text': 'So not a terribly exciting example,', 'start': 1124.246, 'duration': 1.802}, {'end': 1134.818, 'text': 'but it is showcasing the most important functions of Love2D so that we can get started with slightly more interesting examples.', 'start': 1126.048, 'duration': 8.77}, {'end': 1139.202, 'text': 'So our first content update is the low res update.', 'start': 1135.098, 'duration': 4.104}, {'end': 1142.706, 'text': "So we're developing Pong, and Pong is an old game.", 'start': 1139.222, 'duration': 3.484}, {'end': 1148.913, 'text': "It doesn't look like the example that we just looked at, where the font is fairly high res.", 'start': 1143.547, 'duration': 5.366}, {'end': 1150.936, 'text': 'We want something that looks a little more retro.', 'start': 1149.414, 'duration': 1.522}, {'end': 1157.743, 'text': "So what we want to do is get our resolution looking like it's from a game released in 1972.", 'start': 1151.837, 'duration': 5.906}, {'end': 1160.767, 'text': "So what we're going to do is look at a few more important functions here.", 'start': 1157.743, 'duration': 3.024}, {'end': 1165.229, 'text': 'So pong1 has these functions.', 'start': 1162.208, 'duration': 3.021}], 'summary': 'Using love2d to define window mode and render text, showcasing love2d functions for pong game development.', 'duration': 121.722, 'max_score': 1043.507, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM1043507.jpg'}, {'end': 1358.9, 'src': 'heatmap', 'start': 1281.664, 'weight': 9, 'content': [{'end': 1283.444, 'text': "And we'll see that in an example.", 'start': 1281.664, 'duration': 1.78}, {'end': 1285.285, 'text': 'I can actually run it in two different styles.', 'start': 1283.524, 'duration': 1.761}, {'end': 1293.089, 'text': 'So if we go to pong1 in the repo and then we run it, we see here, hello pong is now blown up.', 'start': 1285.706, 'duration': 7.383}, {'end': 1295.971, 'text': "And we'll look at some more code actually to see as to why it's blown up.", 'start': 1293.289, 'duration': 2.682}, {'end': 1302.934, 'text': 'But if we go back to our code, let me pull up pong1.', 'start': 1296.431, 'duration': 6.503}, {'end': 1308.117, 'text': 'Go to main.lua.', 'start': 1306.696, 'duration': 1.421}, {'end': 1314.713, 'text': "And then I'm going to explain this in just a second, but let me comment this out, and we'll see the difference here.", 'start': 1310.39, 'duration': 4.323}, {'end': 1317.635, 'text': 'You can see it looks a lot blurrier.', 'start': 1314.733, 'duration': 2.902}, {'end': 1320.918, 'text': "And that's the default texture filtering taking place.", 'start': 1318.396, 'duration': 2.522}, {'end': 1323.98, 'text': 'It applies, like I said, not only to textures, but also to fonts.', 'start': 1320.958, 'duration': 3.022}, {'end': 1325.642, 'text': "And that's not the aesthetic we want.", 'start': 1324.421, 'duration': 1.221}, {'end': 1329.965, 'text': "So let's look at Pong 1 in detail starting at the top.", 'start': 1326.062, 'duration': 3.903}, {'end': 1333.933, 'text': "On line 28, we're requiring a library.", 'start': 1332.031, 'duration': 1.902}, {'end': 1340.86, 'text': 'This is how you get a library in your Love2D application or your Love application, just equals require in the name of the library.', 'start': 1334.173, 'duration': 6.687}, {'end': 1350.489, 'text': "Push is what we're going to be using to take our 1280 by 720 window and turn it into a virtual resolution window at 432 by 243.", 'start': 1341.18, 'duration': 9.309}, {'end': 1358.9, 'text': 'We can start to think of our game in terms of a more low res feel and think about it in 432 by 243 pixels,', 'start': 1350.489, 'duration': 8.411}], 'summary': 'Demonstration of code running in two styles, with visual differences; using push to change window resolution.', 'duration': 77.236, 'max_score': 1281.664, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM1281664.jpg'}, {'end': 1396.595, 'src': 'embed', 'start': 1371.807, 'weight': 3, 'content': [{'end': 1380.436, 'text': "Instead of love.window.set mode, we're now using push set up screen, the push library's set up screen function, where it takes a virtual width,", 'start': 1371.807, 'duration': 8.629}, {'end': 1385.281, 'text': 'a virtual height, our regular window width and our window height, and then the same table as before.', 'start': 1380.436, 'duration': 4.845}, {'end': 1396.595, 'text': "And this has the effect of setting up a window that's got our concrete dimensions of 1280 by 720, but a virtual resolution of 432 by 243.", 'start': 1385.882, 'duration': 10.713}], 'summary': "Using push library's set up screen function to create a window with virtual resolution of 432x243 within concrete dimensions of 1280x720.", 'duration': 24.788, 'max_score': 1371.807, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM1371807.jpg'}, {'end': 1916.055, 'src': 'embed', 'start': 1883.984, 'weight': 4, 'content': [{'end': 1885.705, 'text': "And so let's go ahead and take a look at the demo.", 'start': 1883.984, 'duration': 1.721}, {'end': 1892.451, 'text': "We're going to go ahead and pull up pong3, the main.lua therein.", 'start': 1887.067, 'duration': 5.384}, {'end': 1902.686, 'text': "Notice that line 37, if you're looking in Pong 3, we have a new constant we've defined called paddle speed, which gets the value 200.", 'start': 1895.481, 'duration': 7.205}, {'end': 1906.188, 'text': 'And this is just an arbitrary value that I found was a good speed.', 'start': 1902.686, 'duration': 3.502}, {'end': 1908.19, 'text': 'But this is how fast our paddle is going to move.', 'start': 1906.488, 'duration': 1.702}, {'end': 1909.791, 'text': "We're going to scale it by delta time.", 'start': 1908.21, 'duration': 1.581}, {'end': 1916.055, 'text': "So we're going to multiply it by how many seconds have passed, typically a fraction of a second, since the last frame.", 'start': 1910.111, 'duration': 5.944}], 'summary': 'In the demo, the paddle speed constant is set to 200, allowing the paddle to move at a scaled speed based on delta time.', 'duration': 32.071, 'max_score': 1883.984, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM1883984.jpg'}, {'end': 1987.433, 'src': 'embed', 'start': 1925.208, 'weight': 5, 'content': [{'end': 1932.59, 'text': "So if we go down here to line 63, I've also set up two new variables, player1score and player2score.", 'start': 1925.208, 'duration': 7.382}, {'end': 1934.571, 'text': 'Those are both initialized at 0.', 'start': 1932.63, 'duration': 1.941}, {'end': 1939.632, 'text': "We're going to add in this example also some rendering of the score.", 'start': 1934.571, 'duration': 5.061}, {'end': 1946.174, 'text': "And notice here on line 49, I've also added a new font which showcases how you need to separate fonts based on their size,", 'start': 1940.033, 'duration': 6.141}, {'end': 1947.355, 'text': "because they're immutable objects.", 'start': 1946.174, 'duration': 1.181}, {'end': 1950.096, 'text': 'Score font gets love.graphics.newfont.', 'start': 1947.755, 'duration': 2.341}, {'end': 1958.419, 'text': "Same exact font file, but it's 32 pixels large because the font or the score when rendered in Pong is pretty large in the middle of the screen.", 'start': 1950.196, 'duration': 8.223}, {'end': 1963.661, 'text': 'And so we have two different fonts now, one for rendering our message, one for rendering our score.', 'start': 1959.119, 'duration': 4.542}, {'end': 1967.942, 'text': "And it's just going to render these two variables, player one score and player two score.", 'start': 1964.581, 'duration': 3.361}, {'end': 1975.265, 'text': "And then we've also initialized our y values for the rectangles, the paddles on the left and the right.", 'start': 1968.663, 'duration': 6.602}, {'end': 1979.787, 'text': 'We need to keep track of their y position because paddles in Pong can only move up or down.', 'start': 1975.285, 'duration': 4.502}, {'end': 1985.111, 'text': 'So player1y gets the same value we did before when we initialized the rectangle, when we drew it onto the screen.', 'start': 1980.367, 'duration': 4.744}, {'end': 1987.433, 'text': "It's going to start at y30, so pretty high up.", 'start': 1985.371, 'duration': 2.062}], 'summary': 'Initializing player scores, rendering fonts, and setting paddle positions in pong game.', 'duration': 62.225, 'max_score': 1925.208, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM1925208.jpg'}, {'end': 2032.716, 'src': 'embed', 'start': 2007.594, 'weight': 6, 'content': [{'end': 2013.559, 'text': "We're using love.keyboard.isdown, and we're passing in the string w and s for this first block.", 'start': 2007.594, 'duration': 5.965}, {'end': 2015.681, 'text': "This first block here is player one's movement.", 'start': 2013.599, 'duration': 2.082}, {'end': 2019.544, 'text': 'So traditionally on a computer, WASD is to move.', 'start': 2016.041, 'duration': 3.503}, {'end': 2023.688, 'text': "In this example, we're going to allow ourselves to move both paddles.", 'start': 2020.785, 'duration': 2.903}, {'end': 2027.792, 'text': "So we're going to use W and S for the left paddle and up or down for the right paddle.", 'start': 2024.008, 'duration': 3.784}, {'end': 2032.716, 'text': 'So if love.keyboard.isDownW, which means are we currently pressing the W key?', 'start': 2028.072, 'duration': 4.644}], 'summary': 'Using love.keyboard.isdown to handle player movement with w, s, up, and down keys.', 'duration': 25.122, 'max_score': 2007.594, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2007594.jpg'}], 'start': 782.887, 'title': 'Love2d functions and pong game development', 'summary': 'Covers love2d functions and their role in game development, emphasizing their use in creating a retro-style pong game with low-resolution graphics. it also introduces the pong3 demo, showcasing additional features such as paddle speed, score rendering, and paddle movement using delta time and new variables in lua programming.', 'chapters': [{'end': 983.644, 'start': 782.887, 'title': 'Game update functions and love2d', 'summary': 'Discusses the structure of a game update in the pong0 repo, including the use of love.load, love.update, and love.draw functions, with emphasis on their roles and importance in game development.', 'duration': 200.757, 'highlights': ['The love.update function is crucial as it is executed every frame, using delta time to ensure consistent behavior across all frame rates, typically 1/60th of a second. The love.update function is crucial as it is executed every frame, using delta time to ensure consistent behavior across all frame rates, typically 1/60th of a second.', 'The love.load function serves as the startup function, where all the initial startup code for the application takes place, providing a clear structure for someone reading the code. The love.load function serves as the startup function, where all the initial startup code for the application takes place, providing a clear structure for someone reading the code.', 'The love.draw function is crucial for defining drawing and rendering behavior, enabling the drawing of paddles, balls, and other game elements. The love.draw function is crucial for defining drawing and rendering behavior, enabling the drawing of paddles, balls, and other game elements.']}, {'end': 1256.376, 'start': 984.224, 'title': 'Love2d functions and game development', 'summary': 'Discusses the use of love2d functions such as love.window.setmode, love.graphics.printf, love.graphics.setdefaultfilter, love.keypressedkey, and love.event.quit to control text rendering, window setup, and game input in love2d, aiming to create a retro-style pong game with low-resolution graphics.', 'duration': 272.152, 'highlights': ['love.window.setmode takes a width and a height and some optional parameters like VSync and full screen and will actually set up our window and get it rendering onto the screen. It explains the purpose of love.window.setmode in setting up the window for rendering.', 'love.graphics.printf function is used to render the text at a specific position, considering alignment and width, and the example demonstrates center aligning the text within the window. It discusses the use of love.graphics.printf to render text and the example of center aligning the text within the window.', 'love.graphics.setDefaultFilter is used to set a default filter for textures, with the aim of preserving the pixelated aesthetic for retro games. It explains the purpose of love.graphics.setDefaultFilter in preserving the pixelated aesthetic for retro games.', 'love.keyPressedKey is a callback function that allows interaction with game input by detecting key presses and performing operations based on the input. It discusses the use of love.keyPressedKey to interact with game input and perform operations based on the input.', 'love.event.quit is a function used to quit the game, and it is an important function for handling game events and user input. It explains the purpose of love.event.quit in quitting the game and handling game events and user input.']}, {'end': 1883.003, 'start': 1256.696, 'title': 'Love2d game development', 'summary': 'Covers texture filtering, setting up virtual window resolution, input handling, and drawing shapes using love2d library, with a focus on low-res feel and retro aesthetics, demonstrated through the development of pong game.', 'duration': 626.307, 'highlights': ['The chapter covers texture filtering, setting up virtual window resolution, input handling, and drawing shapes using Love2D library. The chapter discusses texture filtering, virtual window resolution setup, input handling, and drawing shapes using the Love2D library.', 'The Love2D library applies default bilinear filtering to both fonts and textures, resulting in blurry appearance. Love2D applies default bilinear filtering to fonts and textures, resulting in a blurry appearance.', 'The push library is utilized to set up a virtual resolution window at 432 by 243, providing a low-res feel while preserving the 1280 by 720 window dimensions. The push library is used to set up a virtual resolution window at 432 by 243, preserving the 1280 by 720 window dimensions for a low-res feel.', 'The love.keypressed function is overridden to handle the escape key, allowing the user to quit the application without using external commands or GUI controls. The love.keypressed function is overridden to handle the escape key, enabling users to quit the application directly without external commands or GUI controls.', 'The love.graphics.rectangle function is introduced to draw shapes beyond text, such as paddles and balls, in the Pong game, demonstrating interactive visual elements. The love.graphics.rectangle function is used to draw paddles and balls, introducing interactive visual elements in the Pong game beyond text.']}, {'end': 2158.634, 'start': 1883.984, 'title': 'Pong3 demo summary', 'summary': 'Introduces the pong3 demo, showcasing the addition of paddle speed, score rendering, and paddle movement using delta time, new variables, and fonts in lua programming, emphasizing the need for boundary constraints and the next step being the ball update.', 'duration': 274.65, 'highlights': ["The addition of a new constant 'paddle speed' on line 37 with a value of 200 emphasizes the control of paddle movement, ensuring consistent speed across different frame rates.", "Introduction of new variables 'player1score' and 'player2score' initialized at 0 on line 63, enabling score tracking and rendering in the Pong game.", 'Demonstration of the use of love.keyboard.isdown function for paddle movement, specifying the usage of W, S, up, and down keys to control the paddles, ensuring responsive and customizable user input.', 'Incorporation of a new font for rendering the score, highlighting the importance of font separation based on size and the utilization of love.graphics.newfont for effective display of score on line 49.', 'Initialization of y values for the paddles, player1y starting at y30 and player2y at virtual height minus 50, ensuring proper positioning of the paddles on the screen for effective gameplay.']}], 'duration': 1375.747, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM782887.jpg', 'highlights': ['The love.update function is crucial for consistent behavior across all frame rates, typically 1/60th of a second.', 'The love.load function serves as the startup function, providing a clear structure for the application.', 'The love.draw function is crucial for defining drawing and rendering behavior, enabling the drawing of game elements.', 'The push library is used to set up a virtual resolution window at 432 by 243, preserving the 1280 by 720 window dimensions for a low-res feel.', "The addition of a new constant 'paddle speed' on line 37 with a value of 200 emphasizes the control of paddle movement.", "Introduction of new variables 'player1score' and 'player2score' initialized at 0, enabling score tracking and rendering.", 'Demonstration of the use of love.keyboard.isdown function for paddle movement, ensuring responsive and customizable user input.', 'Incorporation of a new font for rendering the score, highlighting the importance of font separation based on size.', 'Initialization of y values for the paddles, ensuring proper positioning of the paddles on the screen for effective gameplay.', 'The chapter covers texture filtering, setting up virtual window resolution, input handling, and drawing shapes using Love2D library.']}, {'end': 2716.744, 'segs': [{'end': 2212.142, 'src': 'embed', 'start': 2179.251, 'weight': 0, 'content': [{'end': 2180.912, 'text': 'an important function that just belongs to Lua.', 'start': 2179.251, 'duration': 1.661}, {'end': 2181.912, 'text': "It's not a Love2D thing.", 'start': 2180.972, 'duration': 0.94}, {'end': 2182.672, 'text': "It's just a Lua thing.", 'start': 2181.932, 'duration': 0.74}, {'end': 2185.113, 'text': 'Math.random seed num.', 'start': 2183.072, 'duration': 2.041}, {'end': 2190.255, 'text': 'So many of you have probably heard of a seed, like a random number generator seed.', 'start': 2185.613, 'duration': 4.642}, {'end': 2194.576, 'text': "And that just means a random number generator because it's pseudo random.", 'start': 2190.595, 'duration': 3.981}, {'end': 2198.557, 'text': 'it needs some sort of starting value to base all of its random numbers off of.', 'start': 2194.576, 'duration': 3.981}, {'end': 2199.798, 'text': 'It takes a starting number.', 'start': 2198.897, 'duration': 0.901}, {'end': 2206.66, 'text': 'It performs some mathematical operation on that number to derive new random values that we can then use in our game engine.', 'start': 2200.138, 'duration': 6.522}, {'end': 2212.142, 'text': "But if we give it the same number every single time, it's just going to give us the same random numbers every single time,", 'start': 2206.92, 'duration': 5.222}], 'summary': 'Lua function math.random seed num generates pseudo-random numbers based on a starting value.', 'duration': 32.891, 'max_score': 2179.251, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2179251.jpg'}, {'end': 2293.059, 'src': 'embed', 'start': 2262.27, 'weight': 2, 'content': [{'end': 2265.971, 'text': 'And then in order to actually take advantage of all this, we need a function to get a random number.', 'start': 2262.27, 'duration': 3.701}, {'end': 2271.493, 'text': "And so we do that with math.random, which takes a min and a max, although you don't need to technically pass a min.", 'start': 2266.011, 'duration': 5.482}, {'end': 2275.614, 'text': "It'll just implicitly use min as 1 if you don't pass it a min.", 'start': 2271.533, 'duration': 4.081}, {'end': 2279.475, 'text': "And it'll return a value inclusively within that range.", 'start': 2276.714, 'duration': 2.761}, {'end': 2284.916, 'text': "So if we say math.random 1 comma 50, it'll give us a random inclusively between 1 and 50.", 'start': 2279.515, 'duration': 5.401}, {'end': 2288.077, 'text': "And if we just say math.random 50, it'll do the same exact thing.", 'start': 2284.916, 'duration': 3.161}, {'end': 2293.059, 'text': "It'll assume our min is 1 and give us a value between 1 and 50.", 'start': 2288.117, 'duration': 4.942}], 'summary': 'Using math.random to generate random numbers inclusively within a specified range.', 'duration': 30.789, 'max_score': 2262.27, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2262270.jpg'}, {'end': 2345.089, 'src': 'embed', 'start': 2297.261, 'weight': 1, 'content': [{'end': 2304.165, 'text': 'almost everywhere is just math.min, which returns the lesser of two values, and math.max, which returns the greater of two values.', 'start': 2297.261, 'duration': 6.904}, {'end': 2307.286, 'text': "And we'll see this in the context of clamping values to some range.", 'start': 2304.245, 'duration': 3.041}, {'end': 2311.509, 'text': "So let's go ahead and take a look at a demo here.", 'start': 2309.187, 'duration': 2.322}, {'end': 2313.35, 'text': "So I'm going to go ahead and open up pong4.", 'start': 2311.549, 'duration': 1.801}, {'end': 2319.533, 'text': "And we're going to look at main.lua therein.", 'start': 2313.71, 'duration': 5.823}, {'end': 2327.955, 'text': "So here on line 47, we see we're calling the math.random seed function as before.", 'start': 2322.651, 'duration': 5.304}, {'end': 2335.381, 'text': "And note that we're passing an OS.time, another function call, because OS.time is going to be different every time we run our application.", 'start': 2328.336, 'duration': 7.045}, {'end': 2345.089, 'text': "So we're seeding our application every time we run it, based on whatever the current second is relative to 0, 0, 0, 0, 0, 0, January 1, 1970,", 'start': 2335.802, 'duration': 9.287}], 'summary': 'Demonstrates usage of math.min, math.max in clamping values within a range.', 'duration': 47.828, 'max_score': 2297.261, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2297261.jpg'}, {'end': 2410.679, 'src': 'embed', 'start': 2384.261, 'weight': 5, 'content': [{'end': 2388.824, 'text': 'And its velocity is going to be stored in ball dx and ball dy.', 'start': 2384.261, 'duration': 4.563}, {'end': 2395.029, 'text': 'dx and dy are common shorthands for delta x and delta y, which is how you represent velocity.', 'start': 2388.924, 'duration': 6.105}, {'end': 2401.753, 'text': "So what we're going to do effectively is take whatever our delta x and delta y are and add them onto our ball frame by frame.", 'start': 2395.049, 'duration': 6.704}, {'end': 2405.175, 'text': "And that's going to have the effect of updating our ball's position by some value.", 'start': 2401.773, 'duration': 3.402}, {'end': 2410.679, 'text': 'And separating the delta x and the delta y will allow us to have different angles, different trajectories for our ball.', 'start': 2405.596, 'duration': 5.083}], 'summary': "Velocity stored in ball dx and dy; updating ball's position frame by frame.", 'duration': 26.418, 'max_score': 2384.261, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2384261.jpg'}, {'end': 2451.735, 'src': 'embed', 'start': 2423.045, 'weight': 4, 'content': [{'end': 2427.708, 'text': "And so all we're going to do here in this example and this application is store our state as a string.", 'start': 2423.045, 'duration': 4.663}, {'end': 2435.274, 'text': "In future examples, we're going to use what's called a state machine and actually separate out different states into their own modules.", 'start': 2428.868, 'duration': 6.406}, {'end': 2439.257, 'text': "But in the context of this game, we're just going to use a simple string just to illustrate how it works.", 'start': 2435.714, 'duration': 3.543}, {'end': 2444.501, 'text': "And we're going to say our first state when we start the game should be the start string, the start state.", 'start': 2439.737, 'duration': 4.764}, {'end': 2451.735, 'text': "And so, here, on line 86,, what we're going to do is solve a problem that we had in the last example,", 'start': 2446.69, 'duration': 5.045}], 'summary': 'Illustrating state storage using a simple string in the game context.', 'duration': 28.69, 'max_score': 2423.045, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2423045.jpg'}], 'start': 2158.954, 'title': 'Random number generation in lua and math functions in game development', 'summary': 'Discusses the importance of random number generation in game development, emphasizing the use of math.randomseed and os.time in lua and the application of math functions like math.random, math.min, and math.max in generating and manipulating numbers for game development.', 'chapters': [{'end': 2260.681, 'start': 2158.954, 'title': 'Random number generation in lua', 'summary': 'Discusses the importance of random number generation in game development and explains the function math.randomseed in lua, emphasizing the significance of providing a different initial value for unpredictability. it also highlights the use of os.time to generate a different number every time the game is run.', 'duration': 101.727, 'highlights': ['The function math.randomseed in Lua is essential for seeding the random number generator, providing unpredictability and variability in game instances.', 'The use of OS.time in game development ensures the generation of a different number every time the application is run, based on the Unix epoch time and providing significant variability.']}, {'end': 2716.744, 'start': 2262.27, 'title': 'Math functions in game development', 'summary': 'Discusses the usage of math functions in game development, such as math.random, math.min, and math.max, demonstrating their application in generating random numbers, determining lesser/greater values, and clamping values to a specified range, as well as showcasing their usage in updating object positions and implementing game states.', 'duration': 454.474, 'highlights': ['The chapter demonstrates the usage of math.random to generate random numbers within a specific range, showcasing examples of math.random with one and two arguments, illustrating its application in game development (e.g., setting initial object positions, initializing random starting velocity) and its role in updating object positions and applying random ball velocity frame by frame.', "The chapter explains the functionality of math.min and math.max in determining the lesser and greater values respectively, and showcases their usage in clamping values to specific ranges, preventing paddles from moving beyond screen edges, and ensuring the ball's position does not exceed specified boundaries.", 'The chapter introduces the concept of game states and illustrates how a simple string is used to represent different states, with a focus on the start and play states, showcasing the utilization of state changes through key inputs (e.g., Enter key) and the corresponding reinitialization of object positions and random starting velocity.', "The chapter details the usage of delta x and delta y (dx and dy) to represent velocity, explaining their significance in enabling different angles and trajectories for the ball, and demonstrating their application in updating the ball's position by adding them onto the ball frame by frame."]}], 'duration': 557.79, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2158954.jpg', 'highlights': ['The function math.randomseed in Lua is essential for seeding the random number generator, providing unpredictability and variability in game instances.', 'The use of OS.time in game development ensures the generation of a different number every time the application is run, based on the Unix epoch time and providing significant variability.', 'The chapter demonstrates the usage of math.random to generate random numbers within a specific range, showcasing examples of math.random with one and two arguments, illustrating its application in game development (e.g., setting initial object positions, initializing random starting velocity) and its role in updating object positions and applying random ball velocity frame by frame.', "The chapter explains the functionality of math.min and math.max in determining the lesser and greater values respectively, and showcases their usage in clamping values to specific ranges, preventing paddles from moving beyond screen edges, and ensuring the ball's position does not exceed specified boundaries.", 'The chapter introduces the concept of game states and illustrates how a simple string is used to represent different states, with a focus on the start and play states, showcasing the utilization of state changes through key inputs (e.g., Enter key) and the corresponding reinitialization of object positions and random starting velocity.', "The chapter details the usage of delta x and delta y (dx and dy) to represent velocity, explaining their significance in enabling different angles and trajectories for the ball, and demonstrating their application in updating the ball's position by adding them onto the ball frame by frame."]}, {'end': 3543.006, 'segs': [{'end': 2749.645, 'src': 'embed', 'start': 2717.104, 'weight': 6, 'content': [{'end': 2724.51, 'text': 'But what happens if we try to actually run it? or try to interact with it? Nothing.', 'start': 2717.104, 'duration': 7.406}, {'end': 2725.751, 'text': 'It goes straight through.', 'start': 2724.53, 'duration': 1.221}, {'end': 2727.592, 'text': "So we're missing a key piece.", 'start': 2726.411, 'duration': 1.181}, {'end': 2734.356, 'text': "Even though we have the core components of our game engine implemented, we don't have any concrete game play.", 'start': 2727.652, 'duration': 6.704}, {'end': 2735.236, 'text': "Nothing's interacting.", 'start': 2734.416, 'duration': 0.82}, {'end': 2737.377, 'text': "And that's a major piece that we need to look at.", 'start': 2735.696, 'duration': 1.681}, {'end': 2749.645, 'text': "And so before we actually start doing that, though, we're going to take a look at the class update, Pong 5.", 'start': 2738.498, 'duration': 11.147}], 'summary': 'Game engine lacks interactive gameplay, needs class update for pong 5', 'duration': 32.541, 'max_score': 2717.104, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2717104.jpg'}, {'end': 2885.529, 'src': 'embed', 'start': 2860.584, 'weight': 3, 'content': [{'end': 2868.987, 'text': 'But in order to actually have one paddle that has its own set of data and another paddle that has its own set of data, we need to instantiate,', 'start': 2860.584, 'duration': 8.403}, {'end': 2871.187, 'text': 'create objects from this class.', 'start': 2868.987, 'duration': 2.2}, {'end': 2877.329, 'text': 'basically use this class as a Blueprint, but take it to a factory and create concrete cars from the Blueprint.', 'start': 2871.187, 'duration': 6.142}, {'end': 2878.85, 'text': 'And those are objects.', 'start': 2877.489, 'duration': 1.361}, {'end': 2885.529, 'text': 'And so as seen here, our paddles and ball are perfect simple use cases for doing this.', 'start': 2881.246, 'duration': 4.283}], 'summary': 'To have separate data for each paddle, objects must be created from a class, serving as a blueprint, allowing for distinct use cases.', 'duration': 24.945, 'max_score': 2860.584, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2860584.jpg'}, {'end': 2956.79, 'src': 'embed', 'start': 2932.392, 'weight': 4, 'content': [{'end': 2939.176, 'text': "They are, in a sense, a native Lua feature, but Lua's way of doing object-oriented programming is a little bit convoluted.", 'start': 2932.392, 'duration': 6.784}, {'end': 2949.463, 'text': 'Some folks have kindly put together a library that makes it a lot simpler and a lot more closely related to other languages that do object-oriented programming more predominantly,', 'start': 2939.977, 'duration': 9.486}, {'end': 2951.845, 'text': 'like Java or C Sharp or even Python.', 'start': 2949.463, 'duration': 2.382}, {'end': 2956.79, 'text': "allow us to use the keyword class in a way that's very similar to those libraries.", 'start': 2952.545, 'duration': 4.245}], 'summary': "Lua's native object-oriented programming is convoluted, but a library simplifies it to be similar to java or python.", 'duration': 24.398, 'max_score': 2932.392, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2932392.jpg'}, {'end': 3311.867, 'src': 'embed', 'start': 3283.26, 'weight': 1, 'content': [{'end': 3284.98, 'text': 'And then same thing here.', 'start': 3283.26, 'duration': 1.72}, {'end': 3289.742, 'text': 'Instead of having all that logic for resetting the ball as one block of code, we took it out.', 'start': 3285.361, 'duration': 4.381}, {'end': 3290.522, 'text': 'We refactored it.', 'start': 3289.782, 'duration': 0.74}, {'end': 3291.722, 'text': 'We put it into our ball class.', 'start': 3290.562, 'duration': 1.16}, {'end': 3294.803, 'text': 'And now all we have to do is just one line of code, ball reset.', 'start': 3291.762, 'duration': 3.041}, {'end': 3303.685, 'text': 'And then here down at line 169 in our draw function, we just have player one render, player two render, ball render.', 'start': 3296.523, 'duration': 7.162}, {'end': 3311.867, 'text': 'And later on as we scale and we make games that have a lot more things on the screen, a lot more entities, we can just do these renders in a loop.', 'start': 3304.265, 'duration': 7.602}], 'summary': 'Ball reset logic refactored into ball class, reducing code to one line. rendering optimized for scalability.', 'duration': 28.607, 'max_score': 3283.26, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3283260.jpg'}, {'end': 3343.885, 'src': 'embed', 'start': 3320.189, 'weight': 0, 'content': [{'end': 3329.632, 'text': 'hundreds of lines of code into just a few lines of code by deferring update logic and rendering logic to each individual entity thanks to object-oriented programming.', 'start': 3320.189, 'duration': 9.443}, {'end': 3332.713, 'text': "And so that's how we're going to refactor using classes.", 'start': 3330.053, 'duration': 2.66}, {'end': 3340.736, 'text': 'So any questions on how any of that works so far? Cool.', 'start': 3333.394, 'duration': 7.342}, {'end': 3343.885, 'text': 'This is a good point, I think, to take a five minute break.', 'start': 3341.319, 'duration': 2.566}], 'summary': 'Refactoring code using object-oriented programming, taking a five-minute break', 'duration': 23.696, 'max_score': 3320.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3320189.jpg'}, {'end': 3433.108, 'src': 'embed', 'start': 3412.978, 'weight': 5, 'content': [{'end': 3424.184, 'text': "And then the thing that's actually going to let us determine whether or not we are running well or running very poorly is a function called love.timer.getFramesPerSecond.getFPS,", 'start': 3412.978, 'duration': 11.206}, {'end': 3429.787, 'text': 'which is something that Love graciously gives us for free and allows us to very easily slap it wherever we want.', 'start': 3424.184, 'duration': 5.603}, {'end': 3433.108, 'text': 'We can print it to the console, or we can just draw it straight to our application.', 'start': 3429.807, 'duration': 3.301}], 'summary': 'Using love.timer.getfps to monitor performance in love framework.', 'duration': 20.13, 'max_score': 3412.978, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3412978.jpg'}], 'start': 2717.104, 'title': 'Implementing object-oriented programming in pong', 'summary': 'Discusses the need to implement game interaction, the use of classes to organize code, and the creation of class objects for ball and paddle, utilizing a class library to simplify object-oriented programming in lua. it also demonstrates refactoring code using classes, creating functions for resetting and updating objects, and utilizing object-oriented programming to condense lines of code and improve performance, with a focus on monitoring frames per second.', 'chapters': [{'end': 3060.461, 'start': 2717.104, 'title': 'Implementing object-oriented programming in pong', 'summary': 'Discusses the need to implement game interaction, the use of classes to organize code more effectively and the creation of class objects for ball and paddle, using a class library to simplify object-oriented programming in lua.', 'duration': 343.357, 'highlights': ['The chapter discusses the need to implement game interaction The transcript emphasizes the importance of adding concrete gameplay interactions to the game engine.', 'The use of classes to organize code more effectively It explains the concept of using classes to encapsulate data and methods, reducing code bloat and enabling more organized and scalable code.', 'The creation of class objects for ball and paddle It details the process of creating class objects for ball and paddle, defining their attributes, and initializing their state for specific instances.', 'Using a class library to simplify object-oriented programming in Lua The chapter introduces the use of a class library to simplify and streamline object-oriented programming in Lua, making it more similar to other widely used languages.']}, {'end': 3543.006, 'start': 3061.142, 'title': 'Refactoring with classes', 'summary': 'Demonstrates refactoring code using classes, creating functions for resetting and updating objects, and utilizing object-oriented programming to condense lines of code and improve performance, with a focus on monitoring frames per second.', 'duration': 481.864, 'highlights': ['Refactoring code using classes to create reset and update functions for objects The chapter demonstrates refactoring code using classes to create a function for resetting the ball and another for updating objects, condensing code and improving maintainability.', 'Utilizing object-oriented programming to condense lines of code and improve performance The chapter emphasizes using object-oriented programming to condense lines of code, defer update and rendering logic to individual entities, and improve performance by avoiding the need for numerous variables.', 'Monitoring frames per second using love.timer.getFPS and love.window.setTitle The chapter introduces monitoring frames per second using love.timer.getFPS and enhancing application appearance by setting the window title using love.window.setTitle.']}], 'duration': 825.902, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM2717104.jpg', 'highlights': ['The use of classes to organize code more effectively It explains the concept of using classes to encapsulate data and methods, reducing code bloat and enabling more organized and scalable code.', 'Refactoring code using classes to create reset and update functions for objects The chapter demonstrates refactoring code using classes to create a function for resetting the ball and another for updating objects, condensing code and improving maintainability.', 'Utilizing object-oriented programming to condense lines of code and improve performance The chapter emphasizes using object-oriented programming to condense lines of code, defer update and rendering logic to individual entities, and improve performance by avoiding the need for numerous variables.', 'The creation of class objects for ball and paddle It details the process of creating class objects for ball and paddle, defining their attributes, and initializing their state for specific instances.', 'Using a class library to simplify object-oriented programming in Lua The chapter introduces the use of a class library to simplify and streamline object-oriented programming in Lua, making it more similar to other widely used languages.', 'Monitoring frames per second using love.timer.getFPS and love.window.setTitle The chapter introduces monitoring frames per second using love.timer.getFPS and enhancing application appearance by setting the window title using love.window.setTitle.', 'The chapter discusses the need to implement game interaction The transcript emphasizes the importance of adding concrete gameplay interactions to the game engine.']}, {'end': 4355.19, 'segs': [{'end': 3614.459, 'src': 'embed', 'start': 3560.444, 'weight': 0, 'content': [{'end': 3564.725, 'text': 'because it has to gather a few frames of data before it has a number we can actually use.', 'start': 3560.444, 'duration': 4.281}, {'end': 3567.647, 'text': 'But we see there, FPS at 60.', 'start': 3565.126, 'duration': 2.521}, {'end': 3571.188, 'text': 'And so our game runs otherwise just the same.', 'start': 3567.647, 'duration': 3.541}, {'end': 3574.129, 'text': "Completely random, a little bit broken, but that's OK.", 'start': 3571.968, 'duration': 2.161}, {'end': 3575.07, 'text': "We'll fix it up.", 'start': 3574.489, 'duration': 0.581}, {'end': 3583.215, 'text': "But currently we have a problem, and that's that our ball is just going straight through our paddle.", 'start': 3576.831, 'duration': 6.384}, {'end': 3590.812, 'text': 'So how can we fix this problem? We need some way of detecting collision.', 'start': 3583.275, 'duration': 7.537}, {'end': 3598.754, 'text': "So in 2D games, generally, there's a concept of AABB collision detection.", 'start': 3591.672, 'duration': 7.082}, {'end': 3607.737, 'text': 'And what this is is axis-aligned bounding box collision detection, which means that we have bounding boxes, just rectangles,', 'start': 3599.394, 'duration': 8.343}, {'end': 3612.018, 'text': 'quads which have an x and a y, and a width and a height which are non-rotated.', 'start': 3607.737, 'duration': 4.281}, {'end': 3614.459, 'text': "So they're completely aligned with our axes.", 'start': 3612.058, 'duration': 2.401}], 'summary': 'Game runs at 60 fps; need to fix collision detection issue.', 'duration': 54.015, 'max_score': 3560.444, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3560444.jpg'}, {'end': 3688.31, 'src': 'embed', 'start': 3664.185, 'weight': 5, 'content': [{'end': 3671.101, 'text': "If this edge is on this side of this rectangle, we know as well there's no way those two boxes can overlap.", 'start': 3664.185, 'duration': 6.916}, {'end': 3675.303, 'text': 'And it applies to every edge as long as it is the opposite edge.', 'start': 3671.981, 'duration': 3.322}, {'end': 3682.847, 'text': 'So if this edge is below this one, if this edge is above this one, if this edge is on the right and this edge is on the left, it means that,', 'start': 3675.343, 'duration': 7.504}, {'end': 3685.148, 'text': "no matter what, those boxes aren't colliding.", 'start': 3682.847, 'duration': 2.301}, {'end': 3688.31, 'text': 'So we can simply do four conditions.', 'start': 3685.728, 'duration': 2.582}], 'summary': "Boxes won't overlap if edges don't align; 4 conditions can be applied.", 'duration': 24.125, 'max_score': 3664.185, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3664185.jpg'}], 'start': 3543.026, 'title': 'Game development debugging and collision detection', 'summary': 'Covers debugging in game development, focusing on printing fps count and addressing ball-paddle collision issues. additionally, it explains aabb collision detection in 2d games with specific code examples and applications.', 'chapters': [{'end': 3583.215, 'start': 3543.026, 'title': 'Game development tutorial: debugging paddle collision', 'summary': 'Discusses debugging in a game development tutorial, highlighting the process of printing and displaying gathered data, including the fps count and the issue of the ball going straight through the paddle.', 'duration': 40.189, 'highlights': ['The process of printing and displaying gathered data, including the FPS count and the issue of the ball going straight through the paddle.', 'Noting that the FPS count is at 60, and the issue of the ball going straight through the paddle.', 'The effect of starting at 0 and 52 after gathering frames of data, and the issue of the ball going straight through the paddle.']}, {'end': 4355.19, 'start': 3583.275, 'title': '2d collision detection', 'summary': 'Explains the concept of aabb collision detection in 2d games with axis-aligned bounding boxes, providing a simple algorithm to detect collision and illustrating its application in game development with specific code examples.', 'duration': 771.915, 'highlights': ['AABB Collision Detection Algorithm The concept of axis-aligned bounding box (AABB) collision detection is explained, utilizing non-rotated rectangles with x, y, width, and height properties for easy math and parallel alignment.', 'Collision Detection Conditions The algorithm employs simple conditions to check if edges of rectangles are outside the opposite edges of the other rectangle, facilitating collision detection in 2D games.', 'Application in Game Development The application of AABB collision detection is demonstrated with code examples, showcasing how collision detection is integrated into game development with specific functions and logic.']}], 'duration': 812.164, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM3543026.jpg', 'highlights': ['AABB Collision Detection Algorithm The concept of axis-aligned bounding box (AABB) collision detection is explained, utilizing non-rotated rectangles with x, y, width, and height properties for easy math and parallel alignment.', 'Application in Game Development The application of AABB collision detection is demonstrated with code examples, showcasing how collision detection is integrated into game development with specific functions and logic.', 'The process of printing and displaying gathered data, including the FPS count and the issue of the ball going straight through the paddle.', 'Noting that the FPS count is at 60, and the issue of the ball going straight through the paddle.', 'The effect of starting at 0 and 52 after gathering frames of data, and the issue of the ball going straight through the paddle.', 'Collision Detection Conditions The algorithm employs simple conditions to check if edges of rectangles are outside the opposite edges of the other rectangle, facilitating collision detection in 2D games.']}, {'end': 5115.607, 'segs': [{'end': 4416.356, 'src': 'embed', 'start': 4384.825, 'weight': 3, 'content': [{'end': 4385.285, 'text': 'that counter.', 'start': 4384.825, 'duration': 0.46}, {'end': 4390.138, 'text': "So we're going to go ahead and take a look at Pong 8 to see how this is implemented.", 'start': 4386.236, 'duration': 3.902}, {'end': 4399.045, 'text': 'We have here on line 88 and 89 some counter variables, player1score, player2score.', 'start': 4393.342, 'duration': 5.703}, {'end': 4401.607, 'text': "We've had those for a long time, but we haven't used them.", 'start': 4399.085, 'duration': 2.522}, {'end': 4403.148, 'text': "We've only used them to draw to the screen.", 'start': 4401.627, 'duration': 1.521}, {'end': 4411.253, 'text': "We're actually going to now increment them and show them as scorekeeping variables in our code here.", 'start': 4403.428, 'duration': 7.825}, {'end': 4416.356, 'text': 'I thought I had implemented it in pong8, but I think I might have left out the actual incrementing of the score.', 'start': 4411.413, 'duration': 4.943}], 'summary': 'Pong 8 code implements score incrementing using player1score and player2score.', 'duration': 31.531, 'max_score': 4384.825, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM4384825.jpg'}, {'end': 4505.408, 'src': 'embed', 'start': 4473.464, 'weight': 1, 'content': [{'end': 4477.086, 'text': "So when we start up the game, so let's go ahead and take a look at.", 'start': 4473.464, 'duration': 3.622}, {'end': 4483.17, 'text': "We're going to go to Pong 9.", 'start': 4482.249, 'duration': 0.921}, {'end': 4484.831, 'text': "So we're going to go straight to Pong 9.", 'start': 4483.17, 'duration': 1.661}, {'end': 4487.253, 'text': 'And then we need to take a look at what a state machine is.', 'start': 4484.831, 'duration': 2.422}, {'end': 4490.656, 'text': "So currently in the game, we've talked about state a little bit.", 'start': 4487.774, 'duration': 2.882}, {'end': 4494.959, 'text': "We've had the start state, which means the game is ready for us to just press Enter.", 'start': 4490.696, 'duration': 4.263}, {'end': 4496.821, 'text': 'And then the ball will go off in a random direction.', 'start': 4495.059, 'duration': 1.762}, {'end': 4498.202, 'text': 'And then we have the play state.', 'start': 4497.201, 'duration': 1.001}, {'end': 4505.408, 'text': 'And the play state is set to our paddles interacting with the ball and then keeping track of score, basically.', 'start': 4498.242, 'duration': 7.166}], 'summary': 'The game pong 9 features start and play states, with paddles interacting with the ball and tracking score.', 'duration': 31.944, 'max_score': 4473.464, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM4473464.jpg'}, {'end': 4604.888, 'src': 'embed', 'start': 4576.308, 'weight': 0, 'content': [{'end': 4582.03, 'text': 'And you can define any arbitrary number of states, which depends upon your model, whatever game you want to develop.', 'start': 4576.308, 'duration': 5.722}, {'end': 4584.691, 'text': 'For example, like Super Mario has a title screen.', 'start': 4582.45, 'duration': 2.241}, {'end': 4588.233, 'text': 'Maybe your game has a high score state.', 'start': 4584.711, 'duration': 3.522}, {'end': 4590.014, 'text': 'You want to display all the high scores in your game.', 'start': 4588.253, 'duration': 1.761}, {'end': 4593.235, 'text': "And we'll actually show that in a lecture next week.", 'start': 4590.034, 'duration': 3.201}, {'end': 4597.002, 'text': 'But this is what a state machine is.', 'start': 4594.5, 'duration': 2.502}, {'end': 4600.325, 'text': 'It can be in any one particular state at one time.', 'start': 4597.062, 'duration': 3.263}, {'end': 4604.888, 'text': 'And the transitions are what allow you to go in between your states.', 'start': 4600.925, 'duration': 3.963}], 'summary': 'State machines allow transitions between different states in game development.', 'duration': 28.58, 'max_score': 4576.308, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM4576308.jpg'}, {'end': 4976.493, 'src': 'embed', 'start': 4948.401, 'weight': 5, 'content': [{'end': 4956.547, 'text': "So all we're doing is adding logic to that part of the program and saying after we increment their score if it's equal to 10,", 'start': 4948.401, 'duration': 8.146}, {'end': 4958.27, 'text': "We're setting a value called winning player.", 'start': 4956.547, 'duration': 1.723}, {'end': 4959.412, 'text': "We're going to set it to 2.", 'start': 4958.37, 'duration': 1.042}, {'end': 4966.103, 'text': 'So if the ball.x is less than 0, then that means that player 1 got scored on because it went past the left edge of the screen.', 'start': 4959.412, 'duration': 6.691}, {'end': 4970.109, 'text': 'Therefore, player2score should go up.', 'start': 4967.247, 'duration': 2.862}, {'end': 4976.493, 'text': 'And therefore, the winning player should be 2 if the player2score is equal to 10.', 'start': 4970.649, 'duration': 5.844}], 'summary': 'Logic added to increment scores and determine winning player based on conditions such as ball position and score reaching 10.', 'duration': 28.092, 'max_score': 4948.401, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM4948401.jpg'}, {'end': 5090.234, 'src': 'embed', 'start': 5063.032, 'weight': 2, 'content': [{'end': 5068.696, 'text': 'Because remember, we set winning player to 1 or 2 depending on who won, depending on who scored the 10th point.', 'start': 5063.032, 'duration': 5.664}, {'end': 5070.637, 'text': "We'll say player 1 or 2 wins.", 'start': 5069.376, 'duration': 1.261}, {'end': 5077.443, 'text': "And we'll just render that and then press Enter to restart after that.", 'start': 5072.639, 'duration': 4.804}, {'end': 5079.064, 'text': "And that's the logic for that.", 'start': 5077.583, 'duration': 1.481}, {'end': 5080.666, 'text': 'And we can see this in play.', 'start': 5079.124, 'duration': 1.542}, {'end': 5085.89, 'text': "If it's too slow, we might not have to go through an entire run.", 'start': 5081.006, 'duration': 4.884}, {'end': 5090.234, 'text': "But I sped up the, whoops, I don't want to actually hit the ball back.", 'start': 5085.93, 'duration': 4.304}], 'summary': 'The winning player is determined by scoring the 10th point, resulting in either player 1 or 2 winning.', 'duration': 27.202, 'max_score': 5063.032, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5063032.jpg'}], 'start': 4358.919, 'title': 'Implementing scoring system and understanding state machines in pong', 'summary': 'Covers the implementation of a scoring system in pong using counter variables to track and increment player scores, as well as the significance of state machines in game development, including the implementation of different states such as start, play, and serve, and the recognition of a winning player.', 'chapters': [{'end': 4472.783, 'start': 4358.919, 'title': 'Implementing scoring system in pong', 'summary': 'Explains the implementation of a scoring system in pong, utilizing counter variables to track and increment player scores based on ball collision with screen boundaries.', 'duration': 113.864, 'highlights': ['The chapter explains the implementation of a scoring system in Pong, utilizing counter variables to track and increment player scores based on ball collision with screen boundaries.', 'The logic for incrementing the score is demonstrated, with player scores being incremented by one when the ball crosses the left or right edge of the screen.', "Counter variables 'player1score' and 'player2score' are introduced and utilized to track the scores, with player scores being incremented and reset upon ball collision with screen boundaries."]}, {'end': 5115.607, 'start': 4473.464, 'title': 'Understanding state machines in game development', 'summary': 'Explains the concept of state machines and their significance in game development, highlighting the implementation of different states such as start, play, and serve in pong 9, as well as the scoring system and transition between states, culminating in the recognition of a winning player.', 'duration': 642.143, 'highlights': ['The chapter explains the concept of state machines and their significance in game development The lecture introduces the concept of state machines as a crucial and ubiquitous concept in game development, emphasizing the importance of monitoring different states and transitions to facilitate the scaling of code and modular development.', 'Implementation of different states such as start, play, and serve in Pong 9 The lecture illustrates the implementation of various states in the Pong 9 game, including the start state, play state for paddle interaction and score tracking, and the introduction of the serve state to model the serving process in the game.', "Scoring system and transition between states, culminating in the recognition of a winning player The discussion covers the scoring system implementation, where a player wins upon reaching a score of 10, triggering a transition to the 'done' state, resetting the game for a new match, and rendering the winning player on the screen."]}], 'duration': 756.688, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM4358919.jpg', 'highlights': ['The chapter explains the concept of state machines and their significance in game development, emphasizing the importance of monitoring different states and transitions to facilitate the scaling of code and modular development.', 'The lecture illustrates the implementation of various states in the Pong 9 game, including the start state, play state for paddle interaction and score tracking, and the introduction of the serve state to model the serving process in the game.', "The discussion covers the scoring system implementation, where a player wins upon reaching a score of 10, triggering a transition to the 'done' state, resetting the game for a new match, and rendering the winning player on the screen.", 'The chapter explains the implementation of a scoring system in Pong, utilizing counter variables to track and increment player scores based on ball collision with screen boundaries.', "Counter variables 'player1score' and 'player2score' are introduced and utilized to track the scores, with player scores being incremented and reset upon ball collision with screen boundaries.", 'The logic for incrementing the score is demonstrated, with player scores being incremented by one when the ball crosses the left or right edge of the screen.']}, {'end': 5820.375, 'segs': [{'end': 5209.345, 'src': 'embed', 'start': 5173.997, 'weight': 1, 'content': [{'end': 5178.761, 'text': "And so what we're going to do is we're going to start adding audio to the game, which is, in my opinion, one of the more fun things to add,", 'start': 5173.997, 'duration': 4.764}, {'end': 5180.542, 'text': "because it also means you're close to the end of your project.", 'start': 5178.761, 'duration': 1.781}, {'end': 5184.485, 'text': "Love.audio.newSource is a function we're going to look at here.", 'start': 5181.463, 'duration': 3.022}, {'end': 5187.888, 'text': 'All this is going to do is take a path and then optionally a type.', 'start': 5185.106, 'duration': 2.782}, {'end': 5191.775, 'text': 'And this path is going to be to a sound file.', 'start': 5189.674, 'duration': 2.101}, {'end': 5196.778, 'text': "And it's going to create an audio object that you can play back at any point in your application.", 'start': 5191.995, 'duration': 4.783}, {'end': 5203.462, 'text': "So what we're going to effectively do is just whenever a collision happens, depending on what type of collision it is.", 'start': 5197.639, 'duration': 5.823}, {'end': 5204.862, 'text': "we'll just play a particular sound.", 'start': 5203.462, 'duration': 1.4}, {'end': 5209.345, 'text': 'And a program that I really like to use for all of this,', 'start': 5206.003, 'duration': 3.342}], 'summary': 'Adding audio to the game with love.audio.newsource function.', 'duration': 35.348, 'max_score': 5173.997, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5173997.jpg'}, {'end': 5364.409, 'src': 'embed', 'start': 5335.719, 'weight': 0, 'content': [{'end': 5346.897, 'text': 'so all we need to do is Oh, first thing I should say and this is a good illustration of a table.', 'start': 5335.719, 'duration': 11.178}, {'end': 5349.179, 'text': "We'll start to see this a lot more in the future.", 'start': 5347.578, 'duration': 1.601}, {'end': 5356.224, 'text': "We didn't really use tables much in this lecture, but the table is Lua's be-all, end-all data structure.", 'start': 5349.219, 'duration': 7.005}, {'end': 5359.005, 'text': "It's the Python dictionary JavaScript object.", 'start': 5356.464, 'duration': 2.541}, {'end': 5360.947, 'text': "It's an array.", 'start': 5359.886, 'duration': 1.061}, {'end': 5364.409, 'text': "It's everything that you need for anything beyond simple variables in Lua.", 'start': 5360.987, 'duration': 3.422}], 'summary': "Tables are lua's versatile data structure for complex data beyond simple variables.", 'duration': 28.69, 'max_score': 5335.719, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5335719.jpg'}, {'end': 5455.984, 'src': 'embed', 'start': 5428.684, 'weight': 3, 'content': [{'end': 5433.567, 'text': "You don't want to keep all those in memory, necessarily, because that could take up many, many, many megs or gigs of audio.", 'start': 5428.684, 'duration': 4.883}, {'end': 5440.472, 'text': "And if you're loading assets on the fly, if you have dynamic loading in your game, then that's another thing you should take into consideration.", 'start': 5433.827, 'duration': 6.645}, {'end': 5446.316, 'text': "In this case, these are very tiny sound files because they're like a fraction of a second long.", 'start': 5441.312, 'duration': 5.004}, {'end': 5449.418, 'text': "So we're just setting them all to static so that they get preserved in memory.", 'start': 5447.057, 'duration': 2.361}, {'end': 5451.66, 'text': "And we're just loading all three of them into this table.", 'start': 5449.438, 'duration': 2.222}, {'end': 5455.984, 'text': 'And if we want to refer to these later on, all we need to do is sounds.', 'start': 5452.181, 'duration': 3.803}], 'summary': 'Consider memory usage when loading tiny sound files dynamically.', 'duration': 27.3, 'max_score': 5428.684, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5428684.jpg'}, {'end': 5601.651, 'src': 'embed', 'start': 5579.188, 'weight': 2, 'content': [{'end': 5586.833, 'text': 'But if you have a music track, for example, in a level or something like that, you would want set looping to be true, so that when it finally ends,', 'start': 5579.188, 'duration': 7.645}, {'end': 5589.575, 'text': "your user isn't just playing a game in silence.", 'start': 5586.833, 'duration': 2.742}, {'end': 5592.769, 'text': "So we're doing it with paddle hit.", 'start': 5591.549, 'duration': 1.22}, {'end': 5594.67, 'text': "We're doing it with wall hit as well.", 'start': 5593.089, 'duration': 1.581}, {'end': 5601.651, 'text': "So I've named them appropriately so that it's easy to infer where and for what purpose the sound files are used.", 'start': 5594.77, 'duration': 6.881}], 'summary': 'Set looping to true for music track in game levels to avoid silence. sound files named appropriately for easy inference of use.', 'duration': 22.463, 'max_score': 5579.188, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5579188.jpg'}], 'start': 5115.807, 'title': 'Adding audio and lua tables in game development', 'summary': "Covers adding audio to the pong game, creating audio objects for collisions, using bfxer to generate random sounds, introducing lua tables, emphasizing memory management, and utilizing the 'play' function for sound effects in lua.", 'chapters': [{'end': 5335.719, 'start': 5115.807, 'title': 'Adding audio to pong game', 'summary': 'Covers adding audio to the pong game to enhance its appeal and functionality, including creating audio objects for collisions and using a program called bfxer to generate random sounds for the game.', 'duration': 219.912, 'highlights': ["Creating a new font object for larger size and setting the state to 'done' when the player's score reaches 10.", 'Implementing sound in the Pong game using Love.audio.newSource function and creating audio objects for collisions.', 'Using a program called BFXer to generate random sounds for the game and creating specific sounds for paddle hit, score, and wall hit.']}, {'end': 5820.375, 'start': 5335.719, 'title': 'Lua tables and audio implementation', 'summary': "Introduces lua tables as the primary data structure and illustrates their usage in initializing and accessing key-value pairs, and implementing audio assets for game development, emphasizing the importance of managing memory and utilizing the 'play' function for sound effects in lua.", 'duration': 484.656, 'highlights': ['The table in Lua serves as a versatile data structure, encompassing functionalities akin to Python dictionaries and JavaScript objects, providing essential support for complex data beyond simple variables.', "The implementation of audio assets involves initializing a table for sounds, loading static audio files into memory, and using the 'play' function to produce sound effects during collisions, demonstrating the significance of memory management in game development.", "The 'love.resize' function, used in conjunction with the 'push' library, facilitates window resizing, maintaining aspect ratio and letterboxing to ensure consistent UI display across various screen dimensions, enhancing user experience and adaptability."]}], 'duration': 704.568, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/jZqYXSmgDuM/pics/jZqYXSmgDuM5115807.jpg', 'highlights': ['Using lua tables as versatile data structures for complex data beyond simple variables', 'Implementing sound in the Pong game using Love.audio.newSource function', 'Creating specific sounds for paddle hit, score, and wall hit using BFXer', 'Emphasizing memory management in game development during audio asset implementation', "Utilizing the 'play' function to produce sound effects during collisions"]}], 'highlights': ['Love2D is available for all major operating systems, including Linux, Mac, and Windows.', "The class will culminate with students building or extending their own games and implementing a final project that draws upon the course's lessons.", 'Introduction to Unity and Love2D as primary game frameworks, highlighting the use of Lua programming language and its accessibility, popularity, and documentation.', "Instructor's personal journey into programming and game development, aiming to inspire and guide students through the course.", 'Delta time, vital for game execution, is explained along with the importance of game states for managing update and rendering logic based on different states.', 'Object-Oriented Programming is discussed, emphasizing its role in encapsulating data and functions for individual game objects, simplifying code management.', 'Hitboxes are explained in the context of box collision, focusing on axis-aligned bounding boxes for simple collision calculations, crucial for games like Pong.', 'The love.update function is crucial for consistent behavior across all frame rates, typically 1/60th of a second.', 'The love.load function serves as the startup function, providing a clear structure for the application.', 'The love.draw function is crucial for defining drawing and rendering behavior, enabling the drawing of game elements.', 'The function math.randomseed in Lua is essential for seeding the random number generator, providing unpredictability and variability in game instances.', 'The use of classes to organize code more effectively It explains the concept of using classes to encapsulate data and methods, reducing code bloat and enabling more organized and scalable code.', 'AABB Collision Detection Algorithm The concept of axis-aligned bounding box (AABB) collision detection is explained, utilizing non-rotated rectangles with x, y, width, and height properties for easy math and parallel alignment.', 'The chapter explains the concept of state machines and their significance in game development, emphasizing the importance of monitoring different states and transitions to facilitate the scaling of code and modular development.', 'Using lua tables as versatile data structures for complex data beyond simple variables', 'Implementing sound in the Pong game using Love.audio.newSource function']}