I’ve watched a few tutorials on youtube, and have read through some of the tutorials in Defold. I am having a little confusion with the following concerning collections …
Tutorials use main collection and will eventually make a new collection. I am not yet grasping why. What is the main factor/reason you would create a new collection or decide I need a new collection? (would this be per level or section of your game, level1, level2, etc.?)
When and why would you use proxy collection? What determines this being needed?
Great questions! A collection is a group of game objects, one or more, organised in a hierarchy or flat “list” or any other combination. Collections can be used for complex game entities such as a player character with different weapons or a boss with body parts. A collection can also be used to describe a whole scene, screen or level.
You can use a collection in a number of different ways:
The bootstrap collection - This is the collection you specify in game.project. It is the starting point of your game.
Added to another collection - A collection can be added to another collection by right clicking in the outline of a collection and selecting Add Collection File. This can be useful when you wish to reuse groups of game objects in a level for instance.
Created using a collection factory - You can spawn multiple instances of the game objects in a collection using a collection factory.
Loaded through a collection proxy - You can load and unload an entire collection using a collection proxy. This is mainly used for large collections representing scenes, screens or levels. The resources associated with a collection will in this case not be loaded until the collection is loaded through the proxy.
I primarily use two collections in the small games I’m currently working on. I use 1 as the main collection holding the controls of the game, including the pause button. Then I have a separate collection which contains the core gameplay aspects, such as levels and characters. This allows me to very easily pause the second collection without losing the controls.
This also allows me to reuse the main structure of one game for other games which use the same control scheme.