Light grid — the base of Darkened Areas | Сетка освещённости — основа Darkened Areas
English first · Русская версия ниже
Working on the project is getting much more interesting: the core reverse engineering of the original engine is nearly done, and so is the work on lighting, which means the long-awaited stage begins — new mechanics. The first one is Darkened Areas.
Its foundation is the light grid. Every cell of the map now calculates how much light it gets, and all of this is computed in real time: when an effect's light pulses, the cells around it flicker in exactly the same way.
What the light of a cell takes into account:
- sunlight;
- light sources on the map, both placed in the editor and created dynamically, with their current position and radius;
- light from effects;
- zones: inside a cave there is no sun except what comes in through the entrance (the portal).
Cells take into account shadows from:
- rock geometry;
- some large buildings;
- portal geometry.
There are two thresholds: a yellow cell is a dark spot where there is little light, a red one is complete darkness. Brightness is measured the way the eye sees it at night: bluish moonlight counts as dim, even though there is a lot of blue in it.
So almost always, if it looks lit on screen, the game counts it as light.
When a map loads, the grid is computed in full, and after that it is updated only where needed. A full recalculation is spread over several frames, which avoids performance problems.
This is the first step towards emergent gameplay. In the first dev diary I'll show the other components of the Darkened Areas mechanic and how it affects gameplay.
────────── ∴ ──────────
Работать над проектом становится намного интереснее: основной реверс-инжиниринг оригинального движка подходит к завершению, равно как и работа над светом, а значит, начинается долгожданный этап — новые механики. Первая из них — Darkened Areas.
Её основа — сетка освещённости. Каждая клетка карты теперь вычисляет, сколько на неё падает света, и всё это считается в реальном времени: свет эффекта пульсирует — и клетки вокруг точно так же мигают.
Что учитывает свет клетки:
- солнечный свет;
- источники света на карте: как установленные в редакторе, так и динамически создаваемые — с их текущим положением и радиусом;
- свет эффектов;
- зоны: в пещере солнца нет, кроме того, что попадает через вход (портал).
Клетки учитывают тень от:
- геометрии скал;
- некоторых больших построек;
- геометрии порталов.
Порогов два: жёлтая клетка — тёмный участок, где света мало, красная — полная тьма. Яркость считается так, как её видит глаз ночью: синеватый лунный свет засчитывается тусклым, хотя синего в нём много.
Таким образом, практически всегда, если на экране светло, игра тоже считает это светом.
При загрузке карты сетка считается целиком, а дальше процесс обновления происходит точечно, где это требуется. Полный просчёт распределяется на несколько кадров, что позволяет избежать проблем с производительностью.
Это первый шаг на пути к эмерджентности геймплея. В первом дневнике разработки я покажу остальные компоненты механики Darkened Areas и то, как она влияет на геймплей.
the third prophecy