- Видео 47
- Просмотров 119 296
Programming Chaos
США
Добавлен 18 окт 2011
Hone your programming skills with fun, interesting programming projects! In these videos I walk through creating short, interesting programming projects such as procedural generation, artificial life simulations, and more - mostly in Java using Processing. I focus on programming basics, including problem solving, using procedural generations, a bit of AI, and, of course, some chaos. Each of the videos cover the basic project, you should expand on them with your own additions, ideas, and creations. And, if you come up with anything interesting, please share a link in the comments for the video.
Speed-up your simulations with Spatial Partitioning.
Simpler than Quad-Trees, Spatial Partitioning can dramatically speed-up large scale simulations and multi-agent systems. This video shows both the basic idea and steps through programming the code.
Просмотров: 2 619
Видео
Procedurally animate limbs with inverse kinematics
Просмотров 3,3 тыс.Месяц назад
Learn how to program a robot limb using inverse kinematics. We step through the coding for the cyclic coordinate descent algorithms, one of the simplest approaches to inverse kinematics. Great for robotics and procedural animations.
Procedurally Generate Jack o'Lanterns using Classes
Просмотров 490Месяц назад
Just in time for Halloween let's make some procedural jack o'lanterns using basic classes and procedural generation.
Programming Procedural Animations
Просмотров 5 тыс.2 месяца назад
Use a surprisingly easy form of procedural animation to animate fish, snakes, eels, slugs, and other things that swim, slither, and wiggle.
Optimize anything with Evolution: Programming Genetic Algorithms
Просмотров 1,5 тыс.3 месяца назад
Program your own genetic algorithm and use the power of evolution to solve a wide range of optimization problems, from autonomous race cars to alife creatures.
Procedural Generation using Constraint Satisfaction
Просмотров 18 тыс.5 месяцев назад
Learn how to use constraint satisfaction algorithms to generate a wide variety of procedural content, including maps, plants, and textures.
Programming tricks to create beautiful day/night cycles.
Просмотров 8066 месяцев назад
Learn the programming tricks to create some beautiful day/night cycles. See how to use a combination of recursion, trigonometry, color theory and more to generate stunning sunsets, night scenes, and fractal trees.
Evolving creatures using 3D particle life.
Просмотров 1,4 тыс.6 месяцев назад
An evolutionary model is applied to 3D particle life to create an amazing range of colorful creatures.
Program a 3D version of Particle Life
Просмотров 1,6 тыс.7 месяцев назад
Create an infinite set of amazing organic-looking forms using a 3D version of Particle Life.
Program a Chaotic Strange Attractor
Просмотров 1,1 тыс.8 месяцев назад
Learn to program chaotic systems and strange attractors.
Programming Sierpinski Triangles
Просмотров 4989 месяцев назад
Create dozens of beautiful, fractal forms based on the classic Sierpinski Triangle. Sierpinski Triangles are the perfect starting point for a huge variety of more complex fractal forms that use color, images, and motion to create amazing, mesmerizing projects.
Programming 1D Cellular Automata
Просмотров 1,7 тыс.9 месяцев назад
Create an infinite array of amazing, intricate patterns using the simple rules of a cellular automata. The 1-D version of Conway's Game of Life creates infinite patterns.
Creating an Evolutionary World, Part 3: Evolution
Просмотров 59810 месяцев назад
Create a world of evolving creatures! This video finishes the programming for a simple evolutionary artificial life. The model is programmed in Java using Processing.
Create an Evolving World Part 2: Creatures
Просмотров 48610 месяцев назад
Create an evolving world! In this video we program the second part of an evolving artificial life model - the creatures! The programming is done in Java using the Processing environment.
Create an Evolving World Part 1: The Environment
Просмотров 91410 месяцев назад
Create an evolving world! In this video we program the first part of an evolving artificial life model, an environment with two types of terrain and two types of food. The programming is done in Java using the Processing environment.
Program an Invisibility Cloak and other Cool Effects
Просмотров 599Год назад
Program an Invisibility Cloak and other Cool Effects
An Evolutionary Version of Particle Life
Просмотров 23 тыс.Год назад
An Evolutionary Version of Particle Life
Particle Swarms with Physics and Vectors
Просмотров 1,1 тыс.Год назад
Particle Swarms with Physics and Vectors
Programming Simple, Fractal L-Systems
Просмотров 1,7 тыс.Год назад
Programming Simple, Fractal L-Systems
Programming a zoomable Mandelbrot viewer
Просмотров 2,5 тыс.Год назад
Programming a zoomable Mandelbrot viewer
Programming Reaction Diffusion Models
Просмотров 7 тыс.Год назад
Programming Reaction Diffusion Models
Programming Simple Procedural Flowers
Просмотров 1,4 тыс.Год назад
Programming Simple Procedural Flowers
Generating Procedural Maps using Perlin Noise
Просмотров 2,8 тыс.Год назад
Generating Procedural Maps using Perlin Noise
Great video! What's the environment you're using? Looks like the graphics are built in?
Thanks! I'm using Processing. Yes, it has a very solid library of graphics functions built in. I'm programming in Java, but Javascript and Python are also options in the same environment. It's free to down load from processing.org and takes about 3 minutes to get running - basically download and unzip.
Optimising particle systems has intrigued me a lot. Thanks for your clear and extensive explanation.
I'm glad it was helpful. I realize it's not the quad-trees you were asking for a while back, but it should be useful for a lot of applications - and simpler to understand.
Very interesting , many thanks!
Thanks! I'm glad you found it interesting.
Is your source code available?
Not currently. It can all be copied from the video though. I should be able to send a copy if you want it.
Cool!
Thanks! Glad you enjoyed.
Hello! One way to make sure that the particles evolve you can ensure that the particles close to each other tend to complement one another. By ensuring the wrapping around of forces you can order all possible its states to a circle. A circle is important because you can have two or more values that are equal distance away from one another. I also suggest the range to be negetive infinity to positive infinity, and it wraps in the infinities. The way you do this is to not use actual infinities, but to divide NEGATIVE 1 with a number that is very small either positive, or negative. Summarizing the range persumably from left to right would be negative infinity, negative one, zero, positive one, positive infinity, wrap. Each individaul attribute may wrap. When two particles are close enough to one another, their attributes start to complement eachother's. The inifinity complements zero, negative one completments positive one, and around according to the wrap at "infinities". You can tune these ranges to accomodate to interaction between macro particle groups. You can even ensure that the range itself is an attribute of the particle, such that if it is negative, then it will seek the furthest interactable particle to complement, not the closest.
very interesting! it was fun to listen to when making lunch. I'll be sure to keep this method in mind if I'm ever dealing with a ton of particles!
Thanks! I'm glad you found it helpful.
Great video 👾
Thanks! I'm very glad you enjoyed.
Hello! I can also include the seed of the tree in the class such that it grows deterministically.
Good idea! That could lead to some kind of a game where on-line players can swap seeds.
@@programmingchaos8957 then i would include other attributes of the plants too like how much sun light it needs, how fast it grows, is it making a fruit, or the way it reproduces, etc..
your box's fan could be heard in various ocassions
Thanks for letting me know. With that many particles it definitely kicks into high gear occasionally. I'll have to play with the audio in future videos to see if I can filter it out.
Always enjoying these vids! Gotta leave it on 2x speed though, for old times' sake 😛
I'm glad you're enjoying them! I already go through all of the typing segments and up them to around 3x speed (and edit out all of the backtracking and retyping, I can't really type that accurately). I wonder if I should speed those pieces up even more.
@programmingchaos8957 Honestly I think it's fine how you have it, the pacing seems appropriate and followable. I'm just referring to how watching at 2x speed brings me back to the days of being in your classes, haha. (I do much of my YT watching at 2x)
couldn't record in 1080p?
Crud. Thanks for pointing that out. It was recorded in 1080p. For some reason my editor shrank it - my fault for not keeping an eye on the default scale as I did the editing.
@@programmingchaos8957 It makes no difference, no worries everything is perfectly well visible and legible.
Good to know. But still annoying on my end. I'm trying to put out good content and these (minor) issues are frustrating. I do appreciate your pointing it out so I can try to fix it in the future.
@@programmingchaos8957 wouldn't have noticed if not for youtube shite codec
i just started a project that will benefit massively from this. you're a godsend. thanks!
I'm thrilled to hear it! If you want feel free to post info about the project.
@@programmingchaos8957 im working on an idle game in rust with the bevy engine, and the concept is that you have many different ants crawling around doing various tasks. Eventually I'm hoping for some emergent, factory-design type mechanics where the ants do all the work. For now, its just a bunch of particles moving around though. I'm no rust or bevy expert, so its been a great learning experience, but equally as daunting
Sounds like a very cool game. I've never understood the appeal of idle games, while also spending hours and hours watching multi-agent simulations that are basically idle games without the scoring :) So, this sounds like a very clever approach.
@@programmingchaos8957 they itch my brain the right way. I've wanted to make one since I was a kid. I'm really hoping this project works out for me
Best of luck then!
This is amazing work! I'm trying to do the same thing with a similar particle system (primordial particle system), and you have done a fantastic job on explaining how evolutionary particle systems work!
Thank you! I hadn't heard of primordial particles systems before, so thanks for sharing. When you get your system working feel free to share a link, I'd love to see it.
First
Good Job! I hope you enjoyed the video too :)
Best video! :D
Thanks! 😁I'm glad you enjoyed it.
Great video, Thank you for the info!
I'm glad you enjoyed it! Chaotic systems are one of my favorites - not a big surprise given the channel name :)
@@programmingchaos8957 In the process of making a 3d Rossler attractor!, your work has inspired me.
Thanks Terry, new to the ChaosCommunity but happy to be here! I was wondering why you choose to use Processing over something like p5.js or other software? Thanks:)
Welcome! I'm glad you enjoyed the video. I love 'ChaosCommunity', I don't think anyone has used that phrase before - mind if I 'steal' it? I like Processing for these videos because it's easy to install and has easy to access graphics capabilities, so has a very low bar to entry for newer programmers (and more experienced programmers can translate the algorithms to the language of their choice). My standard language is C++, but that's not as good for simple, graphical projects. Of course, p5.js has the exact same advantages as Processing with Java, I've just used the Java version a lot more so am more comfortable with it. But I have been thinking of doing some future videos in p5.js. Just need to brush up on the syntax differences.
@@programmingchaos8957 I'd love for you to steal that name! Okay I was just wondering about it for my own work. I'd also be open to working on p5.js if you decide to do those videos. Thanks again!
Thank you!
You're very welcome! I'm glad it was useful.
Hello! What sort of procedural techniques would you use to code a sidewinder snake's animation?
That's an excellent question. With the algorithm in the video movement tends to 'dampen out' whereas sidewinders maintain a fairly strong curve over their whole body. Watching some videos of them it looks like maybe all of their body 'segments' move through the same spaces/curves. So, something more like a traditional snake game snake, but with the head moving in sin() wave might be a good starting point. It's also possible that someone has already figured out the algorithm and posted it, but if so, I haven't seen it. If you make any progress on this, I'd love to hear about it.
@@programmingchaos8957 For me it looks like it is stepping with its head, or neck. Based on its trail i can see that there are always two contact points to it with the ground. This reminds me of a cork screw that is rolling with its tip that is like the snake's head region, or rather the neck of it because it keeps its head away from the ground. Also the trail of it looks like the tangent function a littlebit
Good observations. The bit about looking like a corkscrew might be a clue as to how to model it. The whole body shaped roughly like a corkscrew, but with each section progressing through the curve.
@@programmingchaos8957 Humanoid things have their feet on the ground while they are stepping too. I can imagine the place where the snake puts its neck to the first time as a humanoid foot step. Basically the segments must go through that first footprint first, and then towards the neck of the snake. After that spot there is a straight part on which the snake "stands", and then a turn which is the last stationary place of the snake's step. Each snake step consists of two turns, and a straight part, that is two stationary points Everything after that has to go through these stationary points before it can go towards the snake's head, but also only these segments are not touching the ground so these are the suspectible to curve when the snake turns. After that there are going to be two additional points where the snake "stands" with its tail part like a leg behind. These two points are also stationary. So i would place a point where the snake puts its neck not its head first, and then make an additional point at a certain distance from the first, at a certain angle compared to the direction the snake went when its neck step "touched" the ground, and then pull everything through these two points first. I would also make sure that the snake does exactly two steps before it "runs out" by tuning its initial two points' distance, and the snake's length.
Nice algorithm. Very simple indeed!
Thanks! For a long time, I had thought the inverse kinematics was a lot more complicated than it is (at least the simpler algorithms) so I was glad to get the word out. :)
Is there a git repo, so i can experiment with your code ?
Not currently. I might set one up eventually, but for now all of the code is in the video. Not as easy as downloading from a repo, but the teacher in me thinks copying it is a good way to see the nuances in the code. These days a large language model like ChatGPT can probably generate most of the code if your specific with it - code in processing for a CCD inverse kinematic model - especially if you give it the segment class to start from. I'm not a huge believer in LLM code, but for well defined problems it can save some typing.
Great ,I prefer FABRIK, but this too Is very interesting !
Thank you! FABRIK is also pretty cool. I want to code that next and compare them. I might do a video on FABRIK as well, thanks for the suggestion.
Replying to a previous comment (RUclips keeps deleting my reply): If you're interested in implementing PID controllers for a video, I would recommend looking at openAI's gym library for python. It's a library made to simulate environments where you control a robot, for tasks like balancing a pole or controlling a rocket ship. The API is simple and already has visualizations built in. The library is typically used to teach reinforcement learning, so I think a video teaching how to implement a PID controller using this library would add a lot to this space. Have a look at some of the 'CartPole' examples of the library, you'll find a lot of high quality material online.
That's a great suggestion, I'll have to check it out.
The opening animation brings to mind the worm prediction scene in Devs.
I managed to totally miss Devs, I'll have to check it out. But there's a good chance they used the same (or a similar) IK algorithm in the show.
thank you so much man, i was trying to program this myself and you gave me so much insight
I'm glad it was helpful!
Thanks for this tutorial! Inverse kinematics has been one of the many programming things I've wanted to learn but haven't quite got around to, so this is a great primer for me!. I'd love to see more tutorials for projects that have an application in robotics, like this one :). Would you be interested in doing a tutorial about PID controllers?
You're welcome! I'm glad is was a useful tutorial. I found this approach easier than I expected. A PID video is a great suggestion. I'll have to look for some applications that do a good job of illustrating the process graphically. I think of them as for problems like temperature control, but I know there are more visually interesting applications. Let me know if you know of any.
ahh this so cool! thank you!
Thanks! I was surprised at how (relatively) simple and effective this algorithm was for generating smooth movements.
Hi Terry! This is Zach from the Game Development Club. Thanks again for coming out! Great video
Hi Zach! I had a great time at the game jam kick-off, thanks for the invite. It's always fun giving presentations like that. I still need to check out the games you guys developed. I'm guessing there were some pretty impressive ones, based on the attendees.
your videos are always the best! may i ask you what you studied? i need to choose what to study after high school 🥹. I really want to learn more about matematics and computer science, to be able to write and research papers about interesting topics such as this one and still integrate all of this with a pratical approach. Love your vids❤
Thank you! For my undergraduate degree I studied physics and did a fair amount of computer modeling as part of the degree - but that was also long enough ago the CS programs were not very common. I got an MS in physics as well, before finally figuring out that I really only liked the programming models part of physics, and switched to CS for my PhD. Of the 'traditional' fields I would recommend CS with a math or physics minor. But these days it might be possible to find something like a mathematical modeling program. Hope this helps.
@@programmingchaos8957 thank you!
Thank you for educating us!
Thanks! I'm always trying to learn new techniques myself. If you have any suggestions for future topics I'd love to hear them.
That's fire my nigga
Thank you!
Thanks for walking us through this! I will make a 1-d automata in bash script showing text output.
I'm glad it was helpful. Creating a text based version with a bash script is a great idea. It's one of the the things I love about computer science/programmers, all of the cool ideas for how to apply things in ways I never would have thought of.
cool!
Thanks!
Really a nice and impressive work. Can you please let me know which COMSOL command I should use for this simulation and what are the parameters?what is the exact equation for allen cahn 2D and 3D which i can use in comsol multiphysics.
Thank you, but I'm afraid I haven't used the COMSOL package at all, so I don't know what commands would work. As a finite element modeler COMSOL should be able to mimic the results. I think you would need to define two 'chemicals' in each cell in the model and then implement the same equations as are presented in the video. The parameter choice is up to you. The tail end of the video shows several different outcomes with different parameter choices. Keep in mind that the initial conditions can also make a difference.
@@programmingchaos8957 what will be the Allen Cahn equation for weak form of PDE for 2D and 3D?
you are my favourite #1 youtuber i love you!!!
Thank you! That totally made my day!
going to try to implement this in 3D haha
Great idea! Let me know how it turns out.
Thanks for the video Terry. I appreciated how you showed how classes are a solution to a problem.
Thanks for the comment. I've found that I'm often introduced to some feature of a language or programming technique and think why would I bother learning that? And then six months later I stumble upon the problem it's designed to help with. So, I do try, at least sometimes, to introduce the issue first.
Hii, I am programing in C. I don't quite understand the difference between defining a class in Java or C++ and defining a type in C, apart from the fact that you can't really include functions in a type. I would like to know the differences :) Thank you
That's a big topic, as there are quite things you can do with classes that you can't with just a type. Being able to define function members of a class is a big difference. In addition in a class you can make some of the data members and/or function members private (or protected). Private members can only be accessed from 'within' the class. This is most commonly used to protect the data members so that they can only be changed using the public functions of the class. For example, this can be used so you can't accidently make the denominator data member in a fraction class zero. There's also inheritance and polymorphism, which allows you to create variations of classes that have similar features. For example, sets of classes that all share the same print function so they can be used partially interchangeably. I realize that probably doesn't make much sense, but the full capabilities of classes usually take a couple of chapters to explain.
@@programmingchaos8957 Thank you very much
Very cool !
Thanks! I've always been intrigued by diffusion limited aggregation, because it has a lot of very cool applications, at least for procedural art.
Amazing! Will work with you soon, for Research in machine Learning Algorithm. Thank you!
I'm glad it was helpful. You're very welcome.
Thank you for the video. I've been trying to figure out inverse kinematics for a long time and you helped a lot. I was able to reproduce your Processing in Python. I hope to eventually implement it in Godot and try to add paws to the fish.
You’re welcome. I’m glad it was helpful. Which graphics library do you use with Python? I’ve played with Godot a little bit, but mostly use Unity for game development.
@@programmingchaos8957 I use a mod in the Processing program, it's called "Python Mode for Processing", by Jonathan Feinberg
I should have guessed :) I've used the Python version myself a little bit, but I'm so used to Java in the Processing environment that when I switch languages in Processing I make all sorts of mistakes. It's like I need to use a different IDE for each language so my brain knows what language I'm using.
I discovered this video a while back and returned to it today because I'm diving into Procedural World Generation for a game I'm developing. I really wanted to create something unique, rather than just follow the most popular tutorials out there. Your explanation was fantastic and inspired me to think deeply about the possibilities when you truly invest effort into your work. I haven't come across much content on Constraint Satisfaction in the context of Procedural Generation-perhaps because it can be a bit slow-but your video really opened my eyes. Thank you for sharing such valuable insights!
I’m thrilled to hear it was so useful. Constraint satisfaction has been around for a long time, but I haven’t seen applied to procedural generation much either. I’m not sure why, maybe it’s just viewed as too old to be applicable (?)
@@programmingchaos8957 probably, it also took some time to generate and most of the procedural generation these days just uses noise and calls it a day. There has been a small rise in popularity of wave function collapse for procedural generation, who knows maybe this will also pop out.
GJ!
Thanks! I'm glad you enjoyed the video.
Thank you this was amazing
I’m really glad you enjoyed it. Happy programming.
Good, but too small for a mobile screen.
Thanks! I’d like to make a mobile version, but I don’t see a good way to handle the programming portion.
I think it would be really cool to combine this technique with something like Boid's algorithm and get whole flocks of creatures moving around like this!
That’s a great idea! It should give really interesting results depending on the length of the creatures.
You content is great, but can you post the code to GitHub so it can be downloaded and played around with. thx
This was borrowed/stolen from the work published here 4 month ago: ruclips.net/video/qlfh_rv6khY/видео.html&
Hi. This is a pretty well known technique that's been around for quite a while. I thought having a version that stepped though the programming could be useful for some viewers. To be clear almost none of the algorithms I present (or that are in most RUclips videos) are completely original. For example, my previous video was on genetic algorithms, which go back at least to John Holland's work in the 1970's. I'm just trying to present algorithms in a way that is helpful to the viewers. I have to say that argonaut's video is very impressive, and possibly does a better job of illustrating the idea than my own - thanks for pointing it out.
for a second I thought this was a follow up from argonaut's video, the creatures are very similar! Was their video an inspiration for this exercise?
I watched several videos, and read a couple of blog posts, before putting this together. But you one of them was argonaut's video - good spotting. Of the techniques I looked at this one seemed the simplest to code.