I need to properly join cells with joints

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

I need to properly join cells with joints

Post by DjSapsan »

I creating a very sophisticated simulation of evolution with the DNA code. I have the cells that eats, moves and divides. New cell might be connected to parent. But this feature requires a very complicated handling of physical joints.
There are few cases that can happen:
1)
The attachment cells1.png is no longer available
2)
cells2.png
cells2.png (56.62 KiB) Viewed 5972 times
3)
cells3.png
cells3.png (178.1 KiB) Viewed 5972 times
Currently i'm trying to solve problem with growing in size (picture 3). But others problem needs to be solved as well.
For now i asking to help just with last picture. Here is what i getting actually:
cells3.png
cells3.png (178.1 KiB) Viewed 5969 times
When cell are eating and getting bigger joints are becoming wrong placed. How can i reconnect joint in optimal way, considering i will have thousands of cells?
Animation link

sorry, but forum is broken i can't properly create a post
Attachments
screenshot.png
screenshot.png (15.3 KiB) Viewed 5969 times
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: I need to properly join cells with joints

Post by DjSapsan »

Sorry, but this forum is broken, i cant put pictures properly, they are appears randomly and attachment box is broken...
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: I need to properly join cells with joints

Post by DjSapsan »

Picture 1 is here
Attachments
cells1.png
cells1.png (81.7 KiB) Viewed 5951 times
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: I need to properly join cells with joints

Post by bobbyjones »

I'm guessing the problem is less how to do such a thing and more so how to do so efficiently? Why not create the naive approach if you haven't already and check if it's actually a bottle neck. Right now off the top of my head I can't think of any optimizations. I think it mainly depends on what you are using for your physics engine. The actual joint changing stuff is a couple variables and a tiny bit of math. There very few things you can do to optimize that. The bigger problem is the propagation of that change throughout your physics engine. Even then create the naive solution first and see what happens.
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: I need to properly join cells with joints

Post by DjSapsan »

bobbyjones wrote: Sat Mar 21, 2020 4:47 am I'm guessing the problem is less how to do such a thing and more so how to do so efficiently? Why not create the naive approach if you haven't already and check if it's actually a bottle neck. Right now off the top of my head I can't think of any optimizations. I think it mainly depends on what you are using for your physics engine. The actual joint changing stuff is a couple variables and a tiny bit of math. There very few things you can do to optimize that. The bigger problem is the propagation of that change throughout your physics engine. Even then create the naive solution first and see what happens.
I still have no working solution for reconnection of joints. I suppose that i need to follow next algorithm:
1) Create a child cell.
2) Check if it is colliding with "brothers"
3) If it is colliding sufficient then:
4) If it is "stick" then stick to parent and brother
5) if it is sticking only to parents then reconnect and cut off brother
6) if it is "free" then leave and also cut off brother

Problem is that it hardly can be done in the same tick, because of callbacks will be called later. Also it is hard to check how sufficient collide is. Maybe there is a little colliding area and i dont need to bother about breaking existing joints.

Beside described problem there is another problem, maybe not so hard but still. I dont know how to reconnect joint if cells are growing/shrinking. Or can i connect it to edge of the circle in such way that after growing in size joint will be still connected to the edge?
Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests