## The epic love demo thread!

tido
Prole
Posts: 28
Joined: Mon Feb 04, 2008 4:08 pm
Contact:

### Re: The epic love demo thread!

Old'd'd'd'd'dd'd'd'dd'd'd'ddddd
mike
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

### Re: The epic love demo thread!

Old, but still epic. And beware, BOY, cause I got admin powerz.
Now posting IN STEREO (where available)
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

### Re: The epic love demo thread!

Due to popular demand, let me introduce the unofficial, totally awesome and extremely gay LOVE Benchmark demo! GFX ripped from other demos

Teh screenz:

And teh filez:
http://www.cloverpunk.com.ar/tehstuffs/ ... hmark.love

Edit: Uploaded new version, now you can make stuff rotate
rude
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

### Re: The epic love demo thread!

(Link is broken. You forgot to rename from .zip )

Hehe, cool. On my v-synced machine, the screen is full of pink primitives before the FPS drops below 60, so it's hard to actually see anything. But for LÖVE-logos, the threshold (where 60 FPS becomes 59) is around 3700. Rotation, blending and other stuff had little effect.

Also, if Ivan wants to use this for benchmarking, we obviously need:
• A script without the LÖVE-logo.
• A script with features that both engines have. (Does AGen have additive blending?)
Also note that it's not possible to disable blending in LÖVE, like your demo would suggest. The choices are "additive" or "normal".

Edit: also, I don't think this is the best way to benchmark. We should measure the time used to draw one frame, not the FPS. Guess we'll have to add this in 0.2.2:

Code: Select all

t_start = love.timer.getTime()
-- draw here
t_end = love.timer.getTime()
t_used = t_end - t_start

ivan
Party member
Posts: 1736
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: The epic love demo thread!

Here's a quickie that I made using a fresh and untested build of AGen.
Ok, so I have a couple of excuses... I mean things to point out
I had to turn off the fonts since I'm currently playing around with the GUI elements.
Z-ordering doesn't work in this build since the render was rewritten a few weeks ago, in order to support a wider ranger of video plugins.
That's why I had to draw the background image with alpha, since there's no way I can ensure it is rendered BEFORE the boxes.
This is a new build so don't be suprised if it crashes.
Lastly, sorry that I used the Love logo, but I was too lazy to find another image.

There's no color blending in AGen although it should be pretty simple to add.
Right now color modulation only works per sprite although it could easily be made to work per layer as well.
This way, you won't have to iterate over all the objects when you want to change the modulation factor at the same time.
also, I don't think this is the best way to benchmark. We should measure the time used to draw one frame, not the FPS
Yeah, you're right. In AGen there is a preset target FPS (which ideally should be the monitor's refresh rate).
It's 60 by default which is 0.0166666667 seconds per frame.
The "update" function is not called more frequently than that since it's pointless to alter the scene more often than you redraw it.
0.0166666667 * delta will give you the time elapsed between frames although as I said, it will never be < 0.0166666667.

Otherwise, the "quickie" that I made is way slower than Love.
There's a number of reasons for this, but the major slowdown is rebuilding the scene graph.
Loads of moving objects will slow things down considerably - the payoff is fast culling, collision detection and instancing of the static geometry.
I've included a "underthehood" version of the framework - just rename it to "framework.dll" and you'll see what I'm talking about.
rude
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

### Re: The epic love demo thread!

ivan wrote:Lastly, sorry that I used the Love logo, but I was too lazy to find another image.
At the time I thought maybe you would get offended (probably silly of me). You can of course use the logo everywhere for all I care. ^_^
ivan wrote:There's a number of reasons for this, but the major slowdown is rebuilding the scene graph.
Aha. You have to rebuild the scenegraph when something moves ... that would slow things down. Isn't it better to be able to do this:

Code: Select all

-- Init:
-- Update:
sprite:move() -- Or similar

And then not destroying the entire scene every frame? I know it makes spatial partitioning a pain in the ass, but it would probably be worth it. You know how it is with games. Stuff move.
the payoff is fast culling, collision detection and instancing of the static geometry
Yeah ... this benchmark does not exactly illustrate all aspects of game creation, but it's a start.
ivan
Party member
Posts: 1736
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: The epic love demo thread!

rude wrote:Aha. You have to rebuild the scenegraph when something moves ... that would slow things down. Isn't it better to be able to do this:
Nah, when you make a change to the scene, it locks the entire branch of the graph up to the root of the tree.
The locked branch is later rebuilt from the bottom up automatically, so that you don't have to do a thing.
Actually, I did a few test and it turns out that the scene graph is not causing any slowdown at all.
The problem was in the lua binder and the way the "position" property is exported.

Anyways, this test is pretty simple and I like it, however I propose a slight change in the script to simplify it:

Code: Select all

-- initialize
function main ( )
object_list = { }

paused = false
moving = false
rotating = false
end

-- enable disable the different test
keyboard.on_press = function ( k )
if k == KEY_1 then
paused = not paused
elseif k == KEY_2 then
moving = not moving
elseif k == KEY_3 then
rotating = not rotating
end
end

-- update
game.on_update = function ( )
-- clock time between updates
window.title = "objects:" .. #object_list .. " fps:" .. game:get_fps ( ) .. " delta:" .. game:get_delta ( )
local delta = game:get_delta ( )

-- do not iterate if paused
if paused == false then
for k,v in ipairs ( object_list ) do

-- motion
if moving == true then
v.position.x = v.position.x + v.inc_x * delta
v.position.y = v.position.y + v.inc_y * delta

if v.position.x < 0 - 400 or v.position.x > 800 - 400 then
v.inc_x = -v.inc_x
end

if v.position.y < 0 - 300 or v.position.y > 600 - 300 then
v.inc_y = -v.inc_y
end
end

-- rotation
if rotating == true then
v.rotation = v.rotation + v.inc_rot * delta
end
end
end

-- create 5 new objects
if keyboard:is_down ( KEY_UP ) then
for i = 0, 5 do
local s = Sprite ( math.random ( 0, 800 ) - 400, math.random ( 0, 600 ) - 300 )

-- size
s.w = math.random ( 10, 20 )
s.h = math.random ( 10, 20 )

-- create object
s.canvas:rectangle ( s.w, s.h )
s.canvas:set_fill_style ( Color(255,0,0), 1 )
s.canvas:fill ( )
scene:add_child ( s )

-- motion
s.inc_x = math.random ( -100,100 ) / 100
s.inc_y = math.random ( 100,100 ) / 100

-- rotation
s.inc_rot = math.random ( -5, 5 )

table.insert ( object_list, s )
end
end

-- release 5 existing objects
if keyboard:is_down ( KEY_DOWN ) then
local diff = 5
if #object_list < diff then
diff = #object_list - 1
end
for i = 0, diff do
local s = table.remove ( object_list )
scene:remove_child ( s )
end
end
end
I don't know if it it's just me, but in the last demo, I think there was a bug that was causing flicker as objects were being removed on and off.
Also, this script makes it a little easier to add new tests.
Yeah, I know it's not written using the Love syntax, but that could easily be changed.
I propose the following tests:
1.motion
2.rotation
3.scaling
4.textures
5.color modulation
6.different blending modes
Err? What else?
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

### Re: The epic love demo thread!

ivan, I also experienced the flicker bug, but it was 2 am when I finished that script. I'm currently trying to complete a little game for a compo, so I won't be able to fix that bug and/or port your script to löve right now :/

Edit: completely misread your post, I was referring to my demo, not yours :/
Last edited by Merkoth on Sun Apr 13, 2008 4:35 pm, edited 1 time in total.
rude
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

### Re: The epic love demo thread!

I didn't notice any flicker ...

There is bug with the logos when they move, though. Some white pixels appears at the bottom of the image.

Noticed that the scene can be scaled and rotated using the mouse. Nice!
ivan wrote:Err? What else?
7. Primitives
8. Text rendering
ivan
Party member
Posts: 1736
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: The epic love demo thread!

Merkoth, the flicker occurs in both mine and your demo (since I used your code)
I think it's caused by the way objects are removed from the table.
It should be fixed it in the script that I posted above.
Noticed that the scene can be scaled and rotated using the mouse. Nice!
Haha, thanks. That's one of the perks of having a large framework.
It makes the difficult thinks simple and simple things difficult (like changing the order in which sprites are rendered).
7. Primitives
8. Text rendering
Maybe it could toggle when you press the spacebar between moving rectangles, textures or text.

By the way, I played around with the AGen binder last night and have to say that the next demo should be more comparable to Love in speed.

### Who is online

Users browsing this forum: No registered users and 19 guests