3 minutes
Collider.JAM Debug Mode
It is easy to run a Collider.JAM project.
Just execute somewhere inside a project folder:
jam
And then open http://localhost:9999.
Even better, you can ask Collider.JAM to open the project link automatically:
jam play
However, during development we often use a different form:
jam -d
The -d
flag turns on the debug mode.
There are a number of debug and development features enabled by this:
Debug output in the terminal
The debug output prints a lot of data besides the usual Collider.JAM version and listening address.
It shows the type of project it runs (sketch mod, sketch mix or package), what configurations are found and used, the scan map used to find and inspect all the units.
It prints all the files and folders it has found, which ones are included and which ones are ignored.
It shows where exactly the found units are mounted on the webserver.
If you are missing a resource, it is the first place to look. Maybe Collider.JAM scans wrong folders or the file is ignored for some reason.
Fast Boot
Collider.JAM tries to minimize the load time when in debug mode. Keeping [Change-> Reload -> Try ↵] cycle short is crucial for a jamming-style development.
Help Data
Collider.JAM collects help data only in debug mode.
Open the project and use F1 to access the help system. It includes a lot of useful information - how to get started with Collider.JAM, useful links, tutorials, documentation on framework libraries, and your own objects and prototypes.
Hot Reload
This feature significantly speeds up the tuning process.
Collider.JAM scans the included folders for changes and reloads all changed files.
Hot reload works well for things like /dna, /env, /lib and static resources, but can be tricky for entities in /lab.
The ones placed directly in /lab are mostly OK. The entities spawned from DNA, on the other hand, have an evolved state associated with them that can’t be changed. Collider.JAM tries to patch the functions in order to upgrade behavior. But there is a change it can brake the entity - especially if a new state has been introduced in updated DNA.
Therefore, sometimes full page reload is necessary to get a consistent update. But if you are changing resources or tuning colors in /env/tune.js, it works just fine.
Custom Debug Hooks
The last significant feature of debug mode is custom hooks you can add for development and debugging.
When you run the projects with jam -d
,
the environment configuration has debug
flag activated.
So you can introduce debug-only code in your project
as simple as:
if (env.config.debug) {
// TODO enable debug feature or log debug info
}
Useful by default
I always run Collider.JAM with the -d
flag
while working on a project.
The debug features are really useful and have no practical downsides.
Only when I want to see the release version, I skip the -d
.