Author
Topic: Mark's circles wtf (Read 1387 times)

so i always thought Mark Sibly was a great programmer. But even the best make a few errors.I couldn't understand how he had such a slow circle oval draw function in blitz. So I went his blitzplus github page. And by golly, what a monster function. wtf was he thinking? Most of his functions are concise, but this one, he really went into an unnecessary myriad of protracted thinking and ideas just to draw a circle.

No wonder blitzers wrote their own circle and oval functions. I'm no high tier programmer, but I got my own blitzplus circle function running at 70~100 times faster than Mark's, using just 8 lines of simple code, w/o using writepixelfast.If anyone gets a chance to talk to him, ask him about his circles wtf.

Don't have the time to look real close, but it appears that most of that code is dealing with ovals at the edge of the screen. You can't just simply shrink the bounding rectangle to the clipping plane or else your ovals will be squashed.

>Besides who uses oval in their games anyway?I like the mario4 , looneytoons style of screen flip, which was circles-to-black in and out, so I had them in my games. Circles are also useful for games with bubbles, like underwater games.

I assume "write pixel" is slower than "drawrect" (dozen of plots versus a single fill operation instruction).

Without having a deeper look at the code (or yours) using less draw calls is to prefer. Dunno if "draw line" was possible there too - but usage of "rect()" alone seems to say that there was some kind of optimization done. "rect" is a untextured quad, a line surely a connection of plots.

@ FasterWhat did you measure? FPS or "function execution time" ? Depending on your GPU/driver-stack the work is done on "flip" rather than "draw".

@ SteveMeems already started his thread with praise - and he wonders how it comes that such a mind as MS wrote this function. One could express this in a nicer way but the core is: if there are more efficient variants around there, why has MS written it the way it is now.

x2#=ry2#=0n=r*6.29 ; if gaps in circle then increase this number, but should be ok

For i=0 To n WritePixel x+x2,y+y2,col x2=x2-y2/r y2=y2+x2/rNext

End Function

Actually, back in the blitzforum days, I saw others write their own circle and oval functions. We never got to the point of testing against each other to see whose was the fastest and most versatile. But some of us noobs were surprised we could beat Mark, and it made us feel like leet programmers for a moment.