Coding Challenge #32.1: Agar.io - Part 1 (Basic Game Mechanics)

preview_player
Показать описание


Other Parts of this Challenge:

References:

Livestream Archive:

Related Coding Challenges:

Timestamps:
0:00 Introduce the coding challenge
0:55 Set up sketch
1:05 Create a blob class
2:06 Create a blob object
2:24 Debug drawing logic
2:42 Describe movement logic
3:05 Create an array of blob objects
4:05 Position blobs in the canvas
4:40 Explain movement logic
5:32 Move blob toward the mouse
6:46 Explain coordinate system
7:52 Translate origin
9:13 Debug movement logic
9:56 Position blobs in a larger world
10:46 Consider blob collision
11:48 Implement collision detection
12:18 Explain overlap test
12:38 Increase the radius of the blob
13:02 Debug collision logic
14:03 Consider chat suggestions
14:32 Increase the radius based on area
15:52 Scale coordinate system to expand the world
17:00 Debug operations on the coordinate system
18:10 Fix the order of the operations
19:10 Introduce `lerp` interpolation
19:47 Interpolate the change in scale
21:54 Interpolate the velocity of the blob
23:22 Summarize the coding challenge
23:44 Conclude the coding challenge

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

#agario #websockets #javascript #nodejs
Рекомендации по теме
Комментарии
Автор

6 years ago, this video inspired me to be a developer. Now, I'm a software engineer in the Netherlands with six years of experience. Thanks, Dan!

richjoshuaalzate
Автор

I love how energetic you are!
Watching people code would almost always put me to sleep after a few minutes. You manage to keep it interesting throughout. Good job! I love this series.

KabooM
Автор

You need to wear a much wider (green only) head band, so we can much easier see your thoughts. Also might be cool to also wear a green collar.
Seriously... keep um coming... love that code!

robertcoyle
Автор

Never had I realized most than now how relatively little are my problem-solving skills at coding. Dan, you're magic.

Loquendotop
Автор

I have been working a lot with low-level C lately and every time you throw functions like setMag and dist in my face I feel a sting of envy. High-level programming can be a breeze sometimes! Excellent video series :)

Surfurplex
Автор

Instead of just adding the smaller blob's radius to your radius, you should add the areas of the circles. In theory, the circle is gaining the mass of the eaten circle. So instead of blob.r += other.r, you should use a blob.mass variable, do blob.mass += other.mass, and then calculate the radius of the blob based on the mass (or area) which is,

blob.r = math.sqrt(blob.mass / math.pi)

Edit: Ah. Apparently you figured that out, but in a more complicated way.

kevnar
Автор

1:30 'What's your Victor, vector?' Haha, nice reference to Airplane!

rszec
Автор

Great Video! you make really interesting videos. Keep it up :)

vincentl
Автор

damn this man is a genius. i wish i had 10% of his js knowledge

mrdoner
Автор

Just a minor optimisation: you never need to use pi to scale up the blob's radius. Consider,
new_area = pi * new_radius^2 = pi * old_radius^2 + pi * other_radius^2
Divide everything by pi and take the square root to get:
new_radius = sqrt( old_radius^2 + other_radius^2 )
And thus we have a formula for the new radius with no pi's involved.

chrizzie
Автор

It is awesome how interesting you make coding hahaha, seriously, i couldnt have imaginated seen a video of someone writing code could be so entertaining :D

(Also i dont know a shit about programming haha but thanks to you i really want to learn :D )

CinnamonRobins
Автор

when i do
function Blob(x, y, r) {
I cant run it and it says syntax error, maybe missing a semicolon?
Please help

exzell
Автор

I dont even code but this is hella entertaining

non-fateggnog
Автор

These videos just makes me happy. Its so awesome to take part of your energy and passion.
Thank you!

gustavlundquist
Автор

man i don't code but you're so energetic, i need more people like you in my life lol

shinobu
Автор

I don't know anything about code. What is the best way to start learning code? All the "beginner coding" videos just basically talk about what coding and programming means, and what you can do with it. You are the first person I have come across that shows the code and the outcome of it. Keep doing what you are doing!

jordandemaret
Автор

Man you're too good. So jelly.

slither.io? You did the snake game already, for all intents and purposes, but maybe you can revisit and implement the multiplayer aspect of it.

camelcase
Автор

I desperately need the next episode. Your video on Websockets and node.js just opened up a million opportunities for my code. Learning how to do this will help me create my own stuff. Thanks for the awesome videos! Your content is very high quality as far as programming lessons go. The same content would be dreadfully boring when delivered by most others you can find online.

SmokingGummyBears
Автор

Just watched 10+ of your videos; It had a similar vibe as my favourite book 'The nature of code', and heck you're the creator of it! You've always inspired me in all my codings. Thank you very much :D and keep up the great work!

Kai-gbcx
Автор

Love the P5js framework and you! keep the videos comin

talonnewton