Skip to content

Conventions

Kane Rogers edited this page Sep 20, 2022 · 7 revisions

Introduction

Background

image

Everyone loves conventions! What could be more exciting than splitting hairs about the smallest difference in meaning between two words?

In this document we try to outline our motivations behind conventions in general, some guidelines to use when creating them and, of course, an always incomplete list of the conventions we use inside the engine today.

Motivations and goals

Why have conventions to begin with? The idea is to follow the principle of least surprise. If I access a variable called position, I wouldn't, for example, expect to get that object's velocity.

That makes sense - the variable should give you something you expect. But what if position returns an Isometry3 in one case and a Vector3 in another? I would be very surprised!

Therein lies the real magic of conventions - they enforce consistency. As long as names are used consistently throughout a codebase, the actual name itself doesn't matter.

Current conventions

Spaces

  • global refers to the space sometimes called "world space", that is, the "top most transform".
  • stage refers to a space centered around the player.
Clone this wiki locally