hunar4321 / particle-life

A simple program to simulate artificial life using attraction/reuplsion forces between many particles
MIT License
2.98k stars 297 forks source link

HTML improvements #30

Closed skal65535 closed 1 year ago

skal65535 commented 1 year ago
hunar4321 commented 1 year ago

@skal65535 Wow this is amazing! I think people who have less JavaScript background will love it. However, GitHub tells me this branch has conflicts with the current file. There was another pull request today which made performance improvements. It Improved the frame rate by 2-3 times. I guess your changes might conflict with that one. I don't know how to resolve these conflicts. If it is easy for you, it will be great if you could add your HTML improvements on top of our latest branch, then we can merge the pull request without conflicts. Thanks a lot in advance.

AnasQiblawi commented 1 year ago

@skal65535 @hunar4321

also I noticed that after the last update when I click "R" on keyboard, the seed, hash, and rules changes but not updated on the canvas.

hunar4321 commented 1 year ago

@skal65535 @hunar4321 also I noticed that after the last update when I click "R" on keyboard, the seed, hash, and rules changes but not updated on the canvas.

Interesting! I didn't play much with the JavaScript version as I was focused on the C++ one but obviously the previous pull request made some changes to the JS file that makes it harder for anyone to follow the script because it uses matrices, but the frame-rate increased dramatically which is also a nice thing!

skal65535 commented 1 year ago

hmm... that's strange, my local version (with the speed-improvement patch) seems to work ok with the 'r' key, at least on Chrome + Mac M1. I made a capture here: https://www.youtube.com/shorts/PsQEhX636-M

I'll certainly try to sync to HEAD and re-test!

skal65535 commented 1 year ago

sorry, i meant: "...my local version (without the speed-improvement patch)..."

hunar4321 commented 1 year ago

hmm... that's strange, my local version (with the speed-improvement patch) seems to work ok with the 'r' key, at least on Chrome + Mac M1. I made a capture here: https://www.youtube.com/shorts/PsQEhX636-M

I'll certainly try to sync to HEAD and re-test!

The GUI addition is really a cool one and the patterns you generate in your video are amazing! It will be amazing if this is integrated with the speed improvements. That way more particles can be played with.

AnasQiblawi commented 1 year ago

'r' key only stopped for me after the speed update, I'm not sure why, and weather its only me, and the fps went x3.5 for me

you people are really making some interesting scripts

dangarfield commented 1 year ago

Hi, sorry to intervene here too. I made the performance improvements, I'm also commiting some code that uses a gui also (uses lil-gui, a favourite of three js users. I think it might be easier to hehe may next PR first and then add these further improvements from @skal65535 . Apologies if this is an imposition. In fact, I'll do it now...

dangarfield commented 1 year ago

I just added my PR, I'm happy to help @skal65535 with incorporating these changes tomorrow, I do think I prefer my attempt at the GUI, but it's up to you as always. My GUI parameterises anything you want. PR - https://github.com/hunar4321/particle-life/pull/31

hunar4321 commented 1 year ago

That is awesome guys. I never thought JavaScript is that cool. I may give up C++ and learn more JS 😅

hunar4321 commented 1 year ago

By the way, I see that the symmetric rules also produce some nice interesting patterns! I haven't systematically investigated the difference between symmetric and asymmetric rules but there was a discussion online that we only see these interesting patterns because we are breaking Newton's third law but now I think this is not the case.

skal65535 commented 1 year ago

let's drop this one, the new UI has definitely more potential and is nicer!