I was interested in how fast Löve/Lua is at drawing triangles, so I wrote a demo/benchmark that fills the screen with 60702 triangles - it got a decent 12 fps on my pc.
I then figured it would be interesting to do the same test with GameMaker, so I wrote the exact same code (give or take the language differences) into GML and ran it. The results were actually not as different as I would have thought - I always assumed that GameMaker was rather slow, but I got an average of 3 or 4 fps.
Screenshot of the tests running simultaneously (oddly, this did not affect the performance - similar results were achieved whether the tests were running concurrently or not).
The numbers are FPS (top) and triangle count (bottom)
Looks like my screenshot gets cut off a bit there, the Löve version's window is exactly the same size as the GML verson's.
Code for the Löve version:
Code: Select all
function love.load()
love.graphics.setBackgroundColor(128,128,128)
end
function love.update(dt)
fps = 1/dt
tris = 0
end
function love.draw()
love.graphics.setColor(0,0,0)
for n=0,800,4 do
for m=0,600,4 do
love.graphics.triangle("line",n,m,n+4,m,n,m+4)
love.graphics.triangle("line",n+4,m+4,n+4,m,n,m+4)
tris = tris+2
end
end
love.graphics.setColor(255,255,255)
love.graphics.print(fps,16,16,0,1,1)
love.graphics.print(tris,16,48,0,1,1)
end
Code: Select all
On Create:
tris=0
On Step:
tris=0
On Draw:
draw_set_color(c_black)
for(n=0;n<=800;n+=4)
{
for(m=0;m<=600;m+=4)
{
draw_triangle(n,m,n+4,m,n,m+4,1)
draw_triangle(n+4,m+4,n+4,m,n,m+4,1)
tris += 2
}
}
draw_set_color(c_white)
draw_text(16,16,fps)
draw_text(16,48,tris)
Also interestingly, Löve and GameMaker seem to draw their triangles slightly differently.