Separation of draw-loop and update-loop threads. Possible?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
AndreyMust19
Prole
Posts: 21
Joined: Thu Mar 06, 2014 3:00 pm

Separation of draw-loop and update-loop threads. Possible?

Post by AndreyMust19 »

If us running in same thread, then drawing may slows updating and reversal.
Love2d have threads, but is isolated threads, no shared environment, with exchanging by messages. Is possible separate loops to updating and drawing same objects from different threads, to optimal execution on multi-core systems?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Separation of draw-loop and update-loop threads. Possibl

Post by Robin »

Maybe? I think it'll be a lot of work for a small pay-off (if it even has a pay-off), though.
Help us help you: attach a .love.
User avatar
DaedalusYoung
Party member
Posts: 407
Joined: Sun Jul 14, 2013 8:04 pm

Re: Separation of draw-loop and update-loop threads. Possibl

Post by DaedalusYoung »

I haven't got a lot of knowledge about this, but I'm thinking it wouldn't work, because love.update needs to be finished before love.draw anyway. You don't want to draw anything before its location is updated, if both functions run virtually at the same time.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Separation of draw-loop and update-loop threads. Possibl

Post by Plu »

This sounds to me like it's in the category of "If you have to ask, you don't understand well enough to make it work".

It's going to be a huge undertaking for probably no gain and loads of really weird bugs.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Separation of draw-loop and update-loop threads. Possibl

Post by T-Bone »

Isn't it much easier to just use a fairly minimal love.update-function and put all the heavy lifting of update logic in a different thread? That way you don't have to change everything so much yet you get basically the same result.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Separation of draw-loop and update-loop threads. Possibl

Post by Robin »

The difficulty with that is that you're going to have a lot of traffic between threads to facilitate that, because both the drawing thread and the updating thread need to access a lot of the same data. For a simple game it's no problem, but it just doesn't scale.
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Separation of draw-loop and update-loop threads. Possibl

Post by Jasoco »

Would "diminishing returns" be an appropriate name for it? Too much work for such little benefit if any at all.
Post Reply

Who is online

Users browsing this forum: No registered users and 61 guests