If you believe to have found a bug in any of our games using the Engine that is related to the Engine itself, please open a GitHub issue. It helps if you also include the engine version where the bug happened.
Our project primarily follows Java naming conventions as a foundation for consistency across code and assets.
Directory names should use all lowercase letters.
Example: server, client, alertlevel
- Luau scripts must use the
.luafile extension. - Client, server, and module scripts should follow UpperCamelCase.
Examples:
Brain.lua,JoinServerLobbies.server.lua,Detection.client.lua
- Roblox instances (e.g., ScreenGuis, sounds) should use the
.rbxmxfile extension, which is XML-based. - Asset files, such as sounds, should use lower_snake_case.
Example:
detected_sound.rbxmx - Other Roblox files, such as GUIs, should use UpperCamelCase.
Example:
DetectionGui.rbxmx
Classes, interfaces, and types should use UpperCamelCase. Use whole words and must avoid acronyms and abbreviations.
local BrainDebugRenderer = {}local Entity = {}
Entity.__index = Entityexport type Sensor<T> = {
doUpdate: ( self: Sensor<T> , agent: T, deltaTime: number) -> ()
}Functions and methods should be verbs and use lowerCamelCase.
function Brain.setMemoryInternal<T, U>(self: Brain<T>, memoryType: MemoryModuleType<U>, optional: Optional<ExpireableValue<U>>): ()
if self.memories[memoryType] then
if optional:isPresent() and isEmptyTable(optional:get():getValue()) then
self:eraseMemory(memoryType)
else
self.memories[memoryType] = optional
end
end
endVariables should be descriptive, and use lowerCamelCase.
local lastDetectionValue = 10And I swear to God, DO NOT ABREVIATE.
local larm
local rarm
local lleg
local rleg
local head
local torso
local hrpLook at this monstorsity. You can not understand jackshit. When you write code, always assume that there will be a poor soul that is gonna read, understand, and refactor your code.
The good way to do is:
local leftArm: BasePart
local rightArm: BasePart
local leftLeg: BasePart
local rightLeg: BasePart
local head: BasePart
local torso: BasePart
local humanoidRootPart: BasePartOh now my eyes won't cry anymore. Now I can easily understand what the hell the variables means and do.
Oh and also, since these are not set immediately, ALWAYS ADD A SPECIFIC TYPE. This does not include variables where the type is obvious. Such as:
local deltaTime = 0.5We already know what the hell deltaTime is. A number. However, if a variable is not set immediately:
local detectedEntityNow we know jackshit on what the hell "detectedEntity" supposed to be. Sure, you're gonna set it SOMEWHERE but that adds extra suffering.
Even if the name is somewhat obvious, You should always add a type.
local detectedEntity: EntityThis applies to tables as well.
local entitiesByUuid = {}What the fuck does this supposed to store? Sure we immediately set it to a table, but that tells us jackshit on what it's supposed to be storing.
Adding a type provides clarity.
local entitiesByUuid: { [string]: Entity } = {}This also won't leave the type checker to slap in you in the face when trying to set a value to a table.
Now you might be saying "But nir!1! What if I need to change the variable's type-" NO. Variables should store only ONE type. ONE. What circumstances where variable need to change multiple types of data???? Thats just stupid! This applies to tables as well! Do not have a goddamn table which stores multiple types of data!
Comments are either tools for developers to tell other developers what a piece of code does, or a way for a developer to vent.
--[=[
If a value is present, returns the value, otherwise returns `other`, which may be `nil`.
]=]
function Optional.orElse<T, U>(self: Optional<T>, other: U): T | U
-- I SWEAR TO GOD THE TYPECHECKER WONT STFU
return if (self.value :: any) ~= nil then self.value else other
endOh, the contrast. The documentation comment everyone sees when they hover their little mouse over the method. Clean. Elegant. The person using the method will think the code is all sunshine and rainbows. Until you get to the comments inside the method.
Yes. It is acceptable to vent your frusterations and rage. Infact, its MANDATORY.