Bleep Guru
 Joined: 09/01/2022 Location: United KingdomPosts: 772 |
| Posted: 12:46pm 15 Jan 2024 |
|
|
|
This is my current fastest Bubble Universe, using VGA, but it also works fine on a LCD if you remove the "Mode 2"; it will update just over 2000 points at a rate of 267mS (at 378Mhz using an older version of VGA Picomite) otherwise it'll be about 400ms per update @ 252Mhz. Alternatively if you want more speed, increase the step size in the two main 'For' loops ("For i=" and or "For j=") For example changing the i loop to 'step 7' looks quite nice and updates at 5hz or 3.5Hz. Regards, Kevin.
' Bubble Universe MODE 2 Dim Float u(51),w(51),a,p,q,t,v=0,x=0 Dim Integer g,b,i,j,c(51),d(51),e(51),n(51),nn,dd Dim Integer f(13,41),l(13,41),m(26,41),y,z,cc,tt Const r=(2*Pi)/235,k=255,s=50 CLS RGB(black) t=Rnd*10:Math set 1,e() 't=1 nn=Peek(varaddr n()) dd=Peek(varaddr d()) cc=Peek(varaddr c())
For g=0 To 41 For b=0 To 51 n(b)=RGB(g*6,b*5,128*(g+b>30)*(g+b<60)) If g<26 And b<13 Then n(b)=RGB(0,128,0) Next Memory pack nn, Peek(varaddr m(0,g)),52,32 Next g Do Inc t,0.01:g=0':Print Timer:Timer =0 For i=50To 255Step 5 b=0:a=r*i z=Peek(varaddr f(0,g)):Memory unpack z,cc,52,16 y=Peek(varaddr l(0,g)):Memory unpack y,dd,52,16 Box c(),d(),e(),e(),0,,0'Pixel c(),d(),0 For j=50To 255Step 4:u(b)=Sin(i+v)+Sin(x):v=Cos(i+v)+Cos(x):x=u(b)+a+t:w(b)=v:Inc b:Next Math Scale u(),70,c():Math Scale w(),60,d() Math add c(),160,c():Math Add d(),120,d() Memory unpack Peek(varaddr m(0,g)),nn,52,32 Box c(),d(),e(),e(),0,,n()'Pixel c(),d(),n() Memory pack cc,z,52,16:Memory pack dd,y,52,16 Inc g Next Loop Edited 2024-01-15 22:58 by Bleep |