Collisions vs. lasers
10 posts • Page 1 of 1
Collisions vs. lasers
I did an experiment to see whether lasers or collisions lag more.
I tested 256 lasers with maxRays == 1000, 256 lasers with maxRays == 1, and 256 gears with 3 teeth hitting boxes.
Results:
Lasers with maxRays==1: 9-11% of realtime
Lasers with maxRays==1000: 9-10% of realtime
Collisions: 80-100% of realtime
Conclusions:
Collisions are fastest by a lot. maxRays doesn't make much of a difference to lasers, but lasers are slow anyway.
Of course, lasers are much better for some things such as long range data transfer.
The scenes I used, in case anyone wants to criticise me for some reason:
I tested 256 lasers with maxRays == 1000, 256 lasers with maxRays == 1, and 256 gears with 3 teeth hitting boxes.
Results:
Lasers with maxRays==1: 9-11% of realtime
Lasers with maxRays==1000: 9-10% of realtime
Collisions: 80-100% of realtime
Conclusions:
Collisions are fastest by a lot. maxRays doesn't make much of a difference to lasers, but lasers are slow anyway.
Of course, lasers are much better for some things such as long range data transfer.
The scenes I used, in case anyone wants to criticise me for some reason:
Thymechanic
- immibis
- Posts: 87
- Joined: Wed Sep 30, 2009 12:24 am
Re: Collisions vs. lasers
Yeah and lasers are more precise than collisions but they aren't good in some cases. Collisions can have advantages but so do lasers.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Collisions vs. lasers
The only problem with the gears is that the script is not updated every frame, it skips some frames. The lasers update every frame. I would try using a alternating collider and see how much lag that causes.
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Collisions vs. lasers
Versieon wrote:The lasers update every frame.
as far as i know they don't either. the laser frequency depends on your screen refreshing rate. mine is about 60Hz. You can test it. I made a scene to detect the laser frequency. so if you're running the simulation @ 100Hz with 100% realtime it only hits about 60%. but gradyfitz told me he got about 140Hz with his lasers so it's very different if it will hit on every frame or if not.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Collisions vs. lasers
What about an alternating collider, those update every frame, right?
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Collisions vs. lasers
yep they collide every frame. i think it would be better if lasers also collide once per frame.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Collisions vs. lasers
Shouldn't alternating collider's operate at 50hz?
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Collisions vs. lasers
Mystery wrote:Shouldn't alternating collider's operate at 50hz?
that's dependent on the object you're putting the oncollide code in. It can be 50Hz but also 100Hz
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Collisions vs. lasers
This is really comparing the 'apples to oranges'... As far as I know the collisions only cause lag on the CPU. while lasers are a bit less CPU intensive, they put more strain into the graphics processing.
I could be wrong though. sorry for the bump.
I could be wrong though. sorry for the bump.
- mitbrown
- Posts: 12
- Joined: Sun Jan 31, 2010 11:08 pm
Re: Collisions vs. lasers
KarateBrot wrote:Versieon wrote:The lasers update every frame.
140Hz with his lasers so it's very different if it will hit on every frame or if not.
Pretty sure he was bullshitting you, i see him and his computer often, and trust me, his screen is NOT capable of 140hz, under any circumstance xD Well, i was told that the frequency of lasers was based entirely off of the refresh rate of your screen
-
kilebantick - Posts: 1267
- Joined: Tue Sep 01, 2009 9:50 am
10 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests