Page 1 of 1

Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 9:39 am
by Nirahiel
Since a small picture is better than a thousand words, here is one :
Belts.png
Belts.png (3.7 KiB) Viewed 9648 times
Currently, the items have a square collision box.
That means when they arrive in a belt, all nicely compacted, when red turns left, blue has to wait until red is completely gone to start to go up, and when it's on top of the belt, it has to leave completely again before the 2nd red can come in, etc.

With circle collision boxes, it's different, when red starts to go left, blue can gently slip against red and still go up, that way, when red is gone, blue has already started to go up, and is even done already. It can now go left without waiting, letting the 2nd red go up immediately.

I think THIS will fix the issue we have with turns in belts where you have to use faster belts at the edges or else gaps will appear. :)

Image

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 10:37 am
by Goddohando
Good idea!
It would make it much better.

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 6:15 pm
by ssilk
It will fix it, but you have calculate with radius it eats much more CPU. And it changes the gameplay completely cause when the items jam and there is nothing on the other side of the belt, some items would be pressed to that side.

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 6:26 pm
by Nirahiel
ssilk wrote:It will fix it, but you have calculate with radius it eats much more CPU. And it changes the gameplay completely cause when the items jam and there is nothing on the other side of the belt, some items would be pressed to that side.
Not necessarily, cause the belts push the items outwards naturally :)
Also it can be done without eating CPU, keep bounding boxes square if you want, but then make it so that when an item is on the top of the belt, just starting to go left, then let the other one clip through and go up, that could also fix the issue.

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 6:41 pm
by kovarex
I have spent some non trivial time solving different kind of problems with belts already, so I know that every solution brings some new problems almost every time :)

This particular solution would help in some cases, as you propose, but, in some other it would bring new problems. The included picture is the first one I came up with after thinking about it for short time, but I'm quite sure, that the game would bring some new ones :)

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 7:05 pm
by Nirahiel
Give priority to items coming from the top then, or in general, if a belt is coming from the side of another one, the merging belt have less priority than the main one ? :)
Like, there is a small invisible wall that pops on the (in this case right, looking from the direction of the items, or left if you just look at the picture) side of the main belt to prevent items from entering until the belt is clear.

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 7:20 pm
by grobyc
I don't knew the encoding but:

If materials goes on belt from left to right it use straight graphics of belt, if materials goes goes from let to down its corner and use corner graphics and you code it use two different graphics.
If u can display different graphic used on corner, maybe there is possibility to code:
if it's corner then use 150% of basic speed of used belt

simple thought but is possible to code?

Re: Circle collision box for drops instead of a square.

Posted: Mon Sep 30, 2013 7:35 pm
by Nirahiel
Yeah it's possible to make the belt naturally faster on a turn. That could work.