Packages
A Project starts with its Engine: sprites, physics, input, animation. A Package is what a Project adds beyond that. Adding one puts its components in Add Component and has its systems run, with nothing to write in code.
| Package | What it is for |
|---|---|
| Spatial | Many things that find their way or each other: flow fields, keeping apart in a crowd, line of sight |
| Tilemaps | Ground painted cell by cell, such as water, sand, grass and a stone wall. A new Project has it already |
Add a Package
Section titled “Add a Package”- Open File, then Packages…. The command palette (
CtrlorCmd+K) has it too. - Choose the Package under Add to your game. Its page says what you get. The search field finds one by what you want to make: “crowds”, “tiles”.
- Click Add to game, and wait a few seconds while it is installed. The editor then loads anew, for every Member who has the Project open.
Unsaved changes to the scene are kept across that reload.
Or ask the Agent in the Agent panel: “add the Spatial package”. The Agent also adds one by itself when what you ask for needs it, and says so in its plan.
Use what it brings
Section titled “Use what it brings”Choose the Package in File › Packages…: Get started lists what it gives the editor, with a button for each thing to make or panel to open, and the keys of its tools. When one of its tools shares a key with another tool, the Package says so, and Change key opens the shortcuts in Settings at that tool. Always included lists what every editor has, such as Bones and IK.
-
Components: select an entity, click Add Component, and look under the Package’s name. Spatial’s are
FlowFieldAgent,FlowFieldTarget,Separation,LineOfSight,Obstacle, andTerrainCost. -
In a Script: import from the Package’s own name, on a line of its own beside the Engine’s.
import { Define, Mut, Velocity } from '@shell/engine-2d';import { FlowFieldAgent } from '@shell/spatial';
Set a Package’s numbers
Section titled “Set a Package’s numbers”A Package’s numbers are its settings, like the numbers your own game shares. Spatial’s are the size of its grid and where its middle is.
- Open File › Project Settings….
- Choose the Package’s settings under Engine, and change their fields.
Without one, the defaults apply. Spatial’s grid is 4096 wide and high in cells of 64, centred on the origin, so it fits a scene whose camera looks at (0, 0).
Remove a Package
Section titled “Remove a Package”- Open File, then Packages….
- Choose the Package under In your game, and click Remove. The editor loads anew.
Nothing is lost. Scenes and prefabs keep the Package’s components, which do nothing until the Package is added again, and the console says which ones. A Script that imports the Package is left out of the game and named in the console until it is changed or the Package is back.
A Project made before Packages
Section titled “A Project made before Packages”The dialog says so, and its buttons are off: the Project’s code needs a few lines first, which a page cannot write. Ask the Agent to add the Package. It writes them, once.