mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(dashboard): 3D views show a zone's scenes as the game loads them
A "Scenes" choice in the world and property 3D views: every scene (as before), the scenes the game keeps loaded around the camera or the followed player (the scene under it from the terrain's scene map, the scenes its transitions connect to, and the global scene, following as it moves), or scenes picked from a list (world view). The lighting blends to the lighting of the scene under the focus, as the client blends between scenes. The scenery manifest now carries each object's scene, the zone's scenes with their neighbours and lighting, and the scene map as runs (37 KB for Avant Gardens); scenery-core.js finds the scene at a point exactly as ZoneScenes does (checked against it on 2000 points of Avant Gardens). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,3 +83,18 @@ namespace ZoneScenes {
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ZoneScenes {
|
||||
std::string RunLengths(const std::vector<uint8_t>& cells, size_t count) {
|
||||
count = std::min(count, cells.size());
|
||||
std::string runs;
|
||||
for (size_t i = 0; i < count;) {
|
||||
size_t length = 1;
|
||||
while (i + length < count && length < 255 && cells[i + length] == cells[i]) length++;
|
||||
runs.push_back(static_cast<char>(length));
|
||||
runs.push_back(static_cast<char>(cells[i]));
|
||||
i += length;
|
||||
}
|
||||
return runs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Raw.h"
|
||||
@@ -65,6 +66,12 @@ namespace ZoneScenes {
|
||||
std::vector<std::pair<uint32_t, std::set<uint32_t>>> m_Neighbours;
|
||||
};
|
||||
|
||||
/**
|
||||
* The first `count` cells of a scene map as runs, for sending: a run is a byte with its length (1 to 255) then the
|
||||
* scene id. Scene maps are large areas of one scene, so this is a small fraction of the cells.
|
||||
*/
|
||||
std::string RunLengths(const std::vector<uint8_t>& cells, size_t count);
|
||||
|
||||
/**
|
||||
* Whether a player with `loaded` scenes (SceneGraph::Loaded of the scene under them) gets an object: when its scene
|
||||
* is loaded. An object's scene is the scene it was placed in (`placedScene`, -1 for none: spawned at run time or a
|
||||
|
||||
Reference in New Issue
Block a user