Scripts

What is a script?

Projects in bitbybit.dev contain scripts. When you create a new project, first script is created automatically. Scripts can be of 3 types - Blockly, Rete and TypeScript. The type of script is tightly coupled with the type of editor that will be used to edit it.

Script visibility

Script visibility inherits the visibility of the Project. It is not possible to have private scripts in the publically accessible project. While it is not mandatory, scripts should also have a picture that represents their content. Script also contains actual code.

Image showing the preview of scripts within a project

Scripts within project

What kinds of scripts can a Project contain?

Scripts can have any of the 3 types mentioned before. Depending on your use case, you can combine multiple scripts to create the final - main script. For example, you can create a 3D parametric model and it's collision body in Rete, export both of them to GLTF file, import it as an asset to the project, and then use these models in your mini game or a simulation that is written in TypeScript. The picture above this does exactlt that. Run our embedded script editors to see how geometry is produced and how simulation works.

Here is the Script that creates the visible geometry in Rete editor:

Rete

Visible geometry script

Script that creates the simplified collision body in Rete editor:

Rete

Collision body script

Script that combines two assets in a single simulation using TypeScript editor:

TypeScript

Animation script

Script that combines two assets in a single physics based simulation using TypeScript editor:

TypeScript

Physics script