The Roblox engine is a software component used for Roblox Player, Roblox Studio and Roblox servers. Internally, the engine is programmed in C++[1], while its data model is accessed using its embedded scripting language Lua (Luau).
The engine runs a data model, made up of instances, that is controlled by other systems, mainly physics, rendering, networking, and Lua VM. Computational tasks are coordinated by the engine's Task Scheduler, which is monitored by the MicroProfiler. In Roblox Studio, some of the systems are initially turned off in order to facilitate development. Many of these systems expose their API, allowing manipulation from Lua programs such as scripts or plugins.
History[]
At the time of Roblox's release, G3D was used as the first rendering engine.[2] In 2009, OGRE was used next. Finally, from 2014 onward, Roblox created and switched to their native rendering engine due to performance limits on low-end hardware and mobile platforms.[3]
Data model[]
The engine's data model is based on the class-based model. Instances are created through the instantiation of a class, which determines the type and behavior of its instances. The structure of the data model is based on the tree model; it represents a hierarchy where instances are connected through parent relationships (Instance.Parent). The root is represented by the DataModel which houses top-level singletons (such as Workspace) known as services. Instances are part of the Roblox API along with other data types.
Run time[]
The run time of the data model allows the systems to run on the place. At the start of run time, scripts meeting their conditions are automatically executed. Many of the run time systems' tasks are run by the Task Scheduler according to the stepping of a frame.
In Roblox Studio, run time initially does not turn on in order to facilitate development, mainly scripting and building. Roblox Studio provides an ability to test the place by simulating it in run time within another environment, which can be stopped or paused at any time.
Rendering[]
- Main article: Rendering
Roblox renders both 3D instances (e.g. parts) and 2D instances (e.g. GUI) collectively referred to as a scene in rendering context. The Workspace service is the primary container for 3D instances and is considered to be the main scene. The Lighting service allows manipulating the lighting of the scene.
Physics[]
- Main article: Physics
The internal physics engine handles how parts behave in the 3D space. In run time, all parts that are descendants of the Workspace are simulated by the physics engine. Motion can be disabled for parts that have their property Anchored set to true
which are known as anchored parts. Unanchored parts that are connected to an anchored part, whether directly or indirectly, are also considered anchored. Physics simulates assemblies, rather than parts. An assembly is a group of one or more parts connected by a weld (such as WeldConstraint) or an animated joint (Motor6D).
Networking[]
- Main article: Server
Lua[]
- See also: Lua
The engine has a Lua VM (virtual machine) which is responsible for executing Lua programs. Upon running the data model, the engine complies the code of Lua programs (such as scripts and plugins) into bytecode which can then be executed through its VM. The VM is a sandboxed environment and Lua programs are given thread identity, which determines the permissions they have to access Roblox API. Programs with a certain thread identity are run in a different VM. To prevent stealing, source code is not replicated to clients in Roblox servers.
In the Parallel Luau programming model, multiple VMs are used, each VM representing a Actor where scripts being run in are executed by that VM.
Sound[]
Sounds are played and controlled through Sound. The engine uses FMOD for handling sounds.
Community[]
There are two Developer Forum subcategories relating to the engine: Engine Features for requesting features and Engine Bugs for reporting bugs.
References[]
- ↑ https://web.archive.org/web/20220612061813/https://blog.roblox.com/2017/05/optimizing-lua-c-interoperability/
- ↑ Pesce, Angelo (2021, August 13). "Roblox (Rendering) Engine Architecture". From Rendering Engine Architecture Conference, 2021 Course. Archived from the original on April 25, 2023.
- ↑ zeuxcg (2014, March 28). "Farewell to the OGRE: The New ROBLOX Rendering Engine is Here". From Roblox Blog. Accessed February 22, 2023. Archived from the original on October 20, 2021.