Collisions vs. lasers

About advanced scenes, and the Thyme scripting language used in Algodoo.

Collisions vs. lasers

Postby immibis » Fri Oct 23, 2009 7:34 am

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:
Rating: rated 5
Filesize: 16.44 kB
Comments: 0
Ratings: 1
download

Rating: rated 5
Filesize: 16.52 kB
Comments: 0
Ratings: 1
download

Rating: rated 4.3
Filesize: 16.43 kB
Comments: 2
Ratings: 4
download
Thymechanic
immibis
 
Posts: 87
Joined: Wed Sep 30, 2009 12:24 am

Re: Collisions vs. lasers

Postby KarateBrot » Fri Oct 23, 2009 11:36 am

Yeah and lasers are more precise than collisions but they aren't good in some cases. Collisions can have advantages but so do lasers.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Collisions vs. lasers

Postby Versieon » Fri Oct 23, 2009 11:27 pm

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.
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: Collisions vs. lasers

Postby KarateBrot » Sat Oct 24, 2009 10:03 am

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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Collisions vs. lasers

Postby Versieon » Sat Oct 24, 2009 6:23 pm

What about an alternating collider, those update every frame, right?
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: Collisions vs. lasers

Postby KarateBrot » Sun Oct 25, 2009 12:04 am

yep they collide every frame. i think it would be better if lasers also collide once per frame.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Collisions vs. lasers

Postby Mystery » Mon Oct 26, 2009 9:10 am

Shouldn't alternating collider's operate at 50hz?
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Collisions vs. lasers

Postby KarateBrot » Mon Oct 26, 2009 2:37 pm

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
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Collisions vs. lasers

Postby mitbrown » Sun Jan 31, 2010 11:35 pm

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.
mitbrown
 
Posts: 12
Joined: Sun Jan 31, 2010 11:08 pm

Re: Collisions vs. lasers

Postby kilebantick » Wed Feb 03, 2010 6:11 am

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 :-D
Image
User avatar
kilebantick
 
Posts: 1267
Joined: Tue Sep 01, 2009 9:50 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 12 guests

cron