PÄSSION: object-oriented LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
Gnx
Prole
Posts: 40
Joined: Sun Nov 09, 2008 6:38 am

Re: PÄSSION: object-oriented LÖVE

Post by Gnx »

I just wanted to say I find this project most intriguing. It's kind of my style of coding, coming from web stuff :)
One thing though, the platformer physics demo is extremely cpu intensive on my machine (an old +3000 AMD warhorse), the other demos/love games don't seem to do this. So I was wondering if there's some particular aspect about that demo that hogs cpu?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

Hi there!

Thanks for testing! Glad to hear that you are intriged :). Web development is also my primary stuff (ruby on rails, mostly). I inspired myself on the DOM box model for implementing the gui elements.

The only thing a bit different on the platformer is that collision detection is used. How are you detecting the "CPU intensiveness"? Is it just that the fan starts spinning, or did you make other measurements?

This said, PÄSSION isn't very efficient right now; It "works", but it isn't particularly optimized. Once I've got a feature complete release, I'll start making speed tweaks.

Anyway, I'll make a mental note to review the platformer.

Regards!
When I write def I mean function.
Gnx
Prole
Posts: 40
Joined: Sun Nov 09, 2008 6:38 am

Re: PÄSSION: object-oriented LÖVE

Post by Gnx »

I've got process explorer running on my machine, and I tested again and as soon as the "player" touches the ground the cpu-usage shoots up to 99%.
Also I can visually observe a slowdown in framerate when this has gone along for some time. Doesn't crash, but the cpu usage stays 85%-99% as long as the player touches anything in the world.

hope this helps somehow :)
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

It certainly looks related with the collision detection.

Probably I'm doing something wrong. It could be LÖVE, but I've learned not to underestimate these guys.

But I just can't put my finger on where the mistake is.

Anyone has any ideas, guys?
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by bartbes »

Well a quick glance over the code says you add every collision to a table, since a collision happens/persists every frame those are a lot of insertions, that might slow it down...
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

I believe that the problem is that I'm using the "continuous collision callback"... trouble is that I need to use that callback, otherwise the "touching point" with the ground isn't updated.

On other order of things, PÄSSION now is able to easily create multiple sources, and automagically chooses a "free" one when it needs to play the same source more than once (through passion.audio.play).

I've also released the first demo of pew pew BOOM!. Grab it while it's hot!
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

Update on PÄSSION.

New features:
  • Added a physics module. I had to do this so I could include a passion.physics.update(dt) function. This, along with other parameters, allows to decouple the physics update from the general game update. It's not a complete decoupling for now, I will have to re-visit this in the future. The original code for updating was borrowed from a post from pekka.
  • Renamed passion.ActorWithBody to passion.physics.Actor (still a subclass of passion.Actor)
  • I'm experimenting with using Lua's packages (module function). I'm not very satisfied with how they work. I might revert this change in the future.
  • Added a new ai module. For now it only includes a QuadTree.
QuadTrees are created with a with and height:

Code: Select all

local quadTree = passion.ai.QuadTree:new(3000,3000)
You then insert objects on them. Objects inserted on QuadTrees must have one method called getBoundingBox (returning x,y,with and height of the object).

Code: Select all

quadTree:add(object) -- object:getBoundingBox() must be implemented
When the object moves, it has to tell the quadTree:

Code: Select all

object:setPosition(x2,y2)
quadTree:update(object)
When an object is destroyed, it has to be removed from the quadTree:

Code: Select all

quadTree:remove(object)
QuadTrees also have a query method that return the objects that "are" (their boundingboxes intersect with) a rectangular region:

Code: Select all

quadTree:query(x3,y3,w3,h3) -- returns objects on that region, on an efficient way
Beware, that last function isn't tested yet!

For now you can see a rather pretty demo on pew pew boom's thread.
When I write def I mean function.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

I've moved the PÄSSION repositories (as well as the MiddleClass ones) to github.

NEW PÄSSION DEVELOPMENT PAGE on github.

It now includes a README explaining how the modules work. Give it a look!

The QuadTree:query method has now been debugged and it works great.

I've made a module for colors. before: passion.white. Now: passion.colors.white. Sorry for the inconvenience.

By the way, I should add the ai module to the list of modules... done!

Going to bed now.
When I write def I mean function.
Geti
Party member
Posts: 112
Joined: Tue Oct 20, 2009 6:38 am

Re: PÄSSION: object-oriented LÖVE

Post by Geti »

OP has a "cannot deliver file" error for me.
Looking at the github stuff now, I'll probably use this for ludumdare.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PÄSSION: object-oriented LÖVE

Post by kikito »

Geti wrote:OP has a "cannot deliver file" error for me.
Thanks for pointing that out. I'll try to upload an updated version during this weekend.

In the meantime, if you just need an example, pew pew BOOM! should do.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 165 guests