Page 4 of 5

Re: love-loader: load resources in a separate thread, easily

Posted: Thu Feb 02, 2012 5:55 pm
by bartbes
I had to make two changes to make it work, love-loader.lua:124 still used thread:send, and in main I replaced your quit with:

Code: Select all

  if key == 'escape' then 
	  local f = love.event.quit or love.event.push
	  f("q")
  end
EDIT: Btw, love.event.quit doesn't take any arguments, but also ignores surplus ones, which is why this works. If you wonder why push("q") doesn't work any more, it's because events now have long names, so it's push("quit") instead.

Re: love-loader: load resources in a separate thread, easily

Posted: Thu Feb 02, 2012 10:21 pm
by kikito
bartbes wrote:<Awesome feedback>
Thanks! I've updated love-loader to 1.1.0. This new version is able to load imageData and soundData, and is forward-compatible with LÖVE 0.8.x.

I'm updating the demo on the OP.

Re: love-loader: load resources in a separate thread, easily

Posted: Wed May 09, 2012 7:37 am
by kikito
Update: v1.1.2 fixes an error on windows. I still have to update the demo on this OP with the latest version. Will do so this evening.

Re: love-loader: load resources in a separate thread, easily

Posted: Wed May 09, 2012 9:28 am
by Roland_Yonaba
Nice. Guess BattleCry was updated with this new version too. Going to check.

Re: love-loader: load resources in a separate thread, easily

Posted: Wed Aug 29, 2012 6:08 am
by kexisse
This library looks awesome. I'm thinking of using it in my project.

I create a bunch of Entities instances with images, and then set their properties based on the image size/width etc.

Currently:

Code: Select all

function Entity:initialize()
  -- load image
  -- set properties
end
With love-loader there resource isn't ready straight away, so I'm thinking about adding a single callback option to the newImage method.
So the code would look like this:

Code: Select all

function Entity:initialize()
  loader.newImage(... function()
    -- set properties
  end)
end
It's possible that draw() will get called before the image finishes loading. I'm thinking about checking self.image before drawing every time, and if it's not there, I'll draw a placeholder image. I'll be instantiating objects off-screen so hopefully the player should never see the placeholder image.

I think I know how to do this, I was just wondering if others think this is a good idea.

Re: love-loader: load resources in a separate thread, easily

Posted: Wed Aug 29, 2012 3:12 pm
by kikito
¡Hi there!

I have already told you this (¡In person! (¡In Kyoto! How cool is that?)) but in case it helps others: I think love-loader is better-suited for implementing "an animation while loading resources". I don't think it will work for doing "dynamic loading", node.js-style, whithout heavy modifications. Nevertheless, you could use love-loader as a way to understand how threads work, and then do your own thing.

Regards!

Re: love-loader: load resources in a separate thread, easily

Posted: Sun Jan 12, 2014 11:28 pm
by kikito
This Library has been ported to LÖVE 0.9.0 by the great Tanner Rogalsky. He did a great job, and left the external interface of the lib unchanged.

I am hereby releasing version 2.0.0.

I have update the OP with a demo compatible with LÖVE 0.9.0.

Re: love-loader: load resources in a separate thread, easily

Posted: Mon Jun 30, 2014 8:21 am
by AlexYeCu
Thanks for a useful library! A question: how to restart love-loader correctly?
For example:
Step 1: We are loading graphical elements and music for main menu.
Step 2: We are chainging currentState var, and one more to tell what state should be next, then making

Code: Select all

currentState.start(media, finishCallback)
by «START GAME» button pressing to load resources for a level. Bar and log show us that all resources are loaded, but next state won`t start. Guess, we need to somehow reset finish/allLoaded callback. So, how to do that?

SOLVED:

Code: Select all

currentState.start(media, loadingFinished)
Just checked everything carefully.

Re: love-loader: load resources in a separate thread, easily

Posted: Mon Jun 30, 2014 3:25 pm
by murks
Nice lib, I almost tried to write something like it yesterday, but eventually loaded the music as "stream" (and didn't play it using Tesound). Our game still has some loading delays but it's not as bad as with the music.
I'm sure it will come in handy for the next project though.

Re: love-loader: load resources in a separate thread, easily

Posted: Sun Aug 02, 2015 11:52 pm
by georgeprosser
This is fantastic, thanks for making this and sharing it with everyone.

Just implemented a loading screen into my audio-heavy game and it immediately feels much more professional.