Crash when loading multiple collection proxies

I’m testing out collection proxies before using them in my game, and I’m having an issue with it crashing when I try to load multiple proxies.

I’ve got a ‘game’ collection, and a ‘menu’ collection, both loaded through proxies.

Then the menu collection loads a further 4 proxies for screens. So 6 in total.

Currently each of these proxies is just a collection with an empty game object in it, so they aren’t very big. Except for game, but I still get the crash even if this collection isn’t loaded.

But the trouble I’m having is that it crashes if I try to load all of them at once, if I comment a few out, it loads ok. I’m getting the ‘Physics world buffer full, world could not be created’ error, but changing my max collection proxies in my config hasn’t made any difference.

All the collections have unique names.

Here’s my code for the preloader

function init(self)
	-- load our game collection(s)
	msg.post("game_pxy", "load")
	msg.post("menu_pxy", "load")
end


function on_message(self, message_id, message, sender)
    -- Init and Enable them then they've been loaded
    if message_id == hash("proxy_loaded") then
    	print("" .. tostring(sender) .. " has loaded")
    	msg.post(sender, "init")
    	msg.post(sender, "enable")
    end
end

and the menu loader

local to_load = {}
to_load[0] = "#gameover_pxy"
to_load[1] = "#settings_pxy"
to_load[2] = "#store_pxy"
to_load[3] = "#title_pxy"
local count = 1

function init(self)
    print("preloading menu screens...")
    msg.post(to_load[0], "load")
end


function on_message(self, message_id, message, sender)
	if count > 3 then return end
	
    if message_id == hash("proxy_loaded") then
   		print("" .. tostring(sender) .. " has loaded")
    	msg.post(sender, "init")
    	msg.post(sender, "enable")
    	msg.post(to_load[count], "load")
    	count = count + 1
    end
end

Each loaded collection creates a separate physics world and there is a limit to how many you can have at the same time. The max number of proxies is the limit to proxies you have, not the number simultaneously loaded.

Is there a special reason you load screens through proxies? If you want to create separate GUI screens it’s probably a better idea to just create GUI scenes and enable/disable them.

I see, that makes sense.

No reason I can’t use GUI scenes, I was just testing the feature to see what things I could do with it. I had initially planned to break the game down into proxies and then use that to determine how far along a loading progress bar should be, as I’ve read that these collections are loaded synchronously.

Thanks.

Ok, cool. It’s possible btw to load async. See http://www.defold.com/ref/collection-proxy/#async_load

1 Like

Ah fantastic, thank you.

2 Likes