Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/client/StarClientApplication.cpp18
-rw-r--r--source/game/StarUniverseClient.cpp8
-rw-r--r--source/game/StarWorldClient.cpp9
-rw-r--r--source/game/StarWorldRenderData.hpp6
-rw-r--r--source/rendering/StarWorldPainter.cpp9
5 files changed, 27 insertions, 23 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index 86dc0c2..de51f99 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -389,23 +389,23 @@ void ClientApplication::render() {
auto start = Time::monotonicMicroseconds();
renderer->switchEffectConfig("world");
worldClient->render(m_renderData, TilePainter::BorderTileSize);
- LogMap::set("render_world_client", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_client", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
start = Time::monotonicMicroseconds();
m_worldPainter->render(m_renderData, [&]() { worldClient->waitForLighting(); });
- LogMap::set("render_world_painter", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_painter", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
start = Time::monotonicMicroseconds();
m_mainInterface->renderInWorldElements();
- LogMap::set("render_world_elements", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_elements", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
renderer->switchEffectConfig("default");
- LogMap::set("render_world_total", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_total", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
}
auto start = Time::monotonicMicroseconds();
m_mainInterface->render();
m_cinematicOverlay->render();
- LogMap::set("render_interface", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_interface", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
}
if (!m_errorScreen->accepted())
@@ -862,14 +862,14 @@ void ClientApplication::updateRunning() {
Vec2F aimPosition = m_player->aimPosition();
float fps = appController()->renderFps();
- LogMap::set("render_rate", strf("{:4.2f} FPS ({:4.2f}ms)", fps, (1.0f / appController()->renderFps()) * 1000.0f));
- LogMap::set("update_rate", strf("{:4.2f}Hz", appController()->updateRate()));
+ LogMap::set("client_render_rate", strf("{:4.2f} FPS ({:4.2f}ms)", fps, (1.0f / appController()->renderFps()) * 1000.0f));
+ LogMap::set("client_update_rate", strf("{:4.2f}Hz", appController()->updateRate()));
LogMap::set("player_pos", strf("[ ^#f45;{:4.2f}^reset;, ^#49f;{:4.2f}^reset; ]", m_player->position()[0], m_player->position()[1]));
LogMap::set("player_vel", strf("[ ^#f45;{:4.2f}^reset;, ^#49f;{:4.2f}^reset; ]", m_player->velocity()[0], m_player->velocity()[1]));
LogMap::set("player_aim", strf("[ ^#f45;{:4.2f}^reset;, ^#49f;{:4.2f}^reset; ]", aimPosition[0], aimPosition[1]));
if (m_universeClient->worldClient()) {
- LogMap::set("liquid_level", strf("{}", m_universeClient->worldClient()->liquidLevel(Vec2I::floor(aimPosition)).level));
- LogMap::set("dungeon_id", strf("{}", m_universeClient->worldClient()->dungeonId(Vec2I::floor(aimPosition))));
+ LogMap::set("tile_liquid_level", strf("{}", m_universeClient->worldClient()->liquidLevel(Vec2I::floor(aimPosition)).level));
+ LogMap::set("tile_dungeon_id", strf("{}", m_universeClient->worldClient()->dungeonId(Vec2I::floor(aimPosition))));
}
if (m_mainInterface->currentState() == MainInterface::ReturnToTitle)
diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp
index e025517..783c5d3 100644
--- a/source/game/StarUniverseClient.cpp
+++ b/source/game/StarUniverseClient.cpp
@@ -279,12 +279,12 @@ void UniverseClient::update() {
m_celestialDatabase->cleanup();
if (auto netStats = m_connection->incomingStats()) {
- LogMap::set("client_incoming_bps", netStats->bytesPerSecond);
- LogMap::set("client_worst_incoming", strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize));
+ LogMap::set("net_incoming_bps", netStats->bytesPerSecond);
+ LogMap::set("net_worst_incoming", strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize));
}
if (auto netStats = m_connection->outgoingStats()) {
- LogMap::set("client_outgoing_bps", netStats->bytesPerSecond);
- LogMap::set("client_worst_outgoing",
+ LogMap::set("net_outgoing_bps", netStats->bytesPerSecond);
+ LogMap::set("net_worst_outgoing",
strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize));
}
}
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp
index accf025..552b6e2 100644
--- a/source/game/StarWorldClient.cpp
+++ b/source/game/StarWorldClient.cpp
@@ -535,8 +535,8 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) {
}
}
- renderData.particles = m_particles->particles();
- LogMap::set("active_particles", renderData.particles.size());
+ renderData.particles = &m_particles->particles();
+ LogMap::set("client_render_particle_count", renderData.particles->size());
renderData.skyRenderData = m_sky->renderData();
@@ -569,9 +569,10 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) {
}
}
+ auto functionDatabase = Root::singleton().functionDatabase();
for (auto& layer : renderData.parallaxLayers) {
if (!layer.timeOfDayCorrelation.empty())
- layer.alpha *= clamp((float)Root::singleton().functionDatabase()->function(layer.timeOfDayCorrelation)->evaluate(m_sky->timeOfDay() / m_sky->dayLength()), 0.0f, 1.0f);
+ layer.alpha *= clamp((float)functionDatabase->function(layer.timeOfDayCorrelation)->evaluate(m_sky->timeOfDay() / m_sky->dayLength()), 0.0f, 1.0f);
}
stableSort(renderData.parallaxLayers, [](ParallaxLayer const& a, ParallaxLayer const& b) {
@@ -1458,7 +1459,7 @@ void WorldClient::lightingMain() {
m_lightingCalculator.calculate(m_renderData->lightMap);
m_renderData = nullptr;
- LogMap::set("render_world_async_lighting_calc_time", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_async_light_calc", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
}
m_lightingCond.wait(m_lightingMutex);
diff --git a/source/game/StarWorldRenderData.hpp b/source/game/StarWorldRenderData.hpp
index b13fef5..6d8c3b1 100644
--- a/source/game/StarWorldRenderData.hpp
+++ b/source/game/StarWorldRenderData.hpp
@@ -30,7 +30,7 @@ struct WorldRenderData {
Image tileLightMap;
List<EntityDrawables> entityDrawables;
- List<Particle> particles;
+ List<Particle> const* particles;
List<OverheadBar> overheadBars;
List<Drawable> nametags;
@@ -48,10 +48,10 @@ struct WorldRenderData {
};
inline void WorldRenderData::clear() {
- tiles.clear();
+ tiles.resize({0, 0}); // keep reserved
entityDrawables.clear();
- particles.clear();
+ particles = nullptr;
overheadBars.clear();
nametags.clear();
backgroundOverlays.clear();
diff --git a/source/rendering/StarWorldPainter.cpp b/source/rendering/StarWorldPainter.cpp
index 9a93365..7bcbb45 100644
--- a/source/rendering/StarWorldPainter.cpp
+++ b/source/rendering/StarWorldPainter.cpp
@@ -72,7 +72,7 @@ void WorldPainter::render(WorldRenderData& renderData, function<void()> lightWai
if (lightWaiter) {
auto start = Time::monotonicMicroseconds();
lightWaiter();
- LogMap::set("render_world_async_lighting_wait_time", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
+ LogMap::set("client_render_world_async_light_wait", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
}
if (renderData.isFullbright) {
@@ -166,7 +166,10 @@ void WorldPainter::renderParticles(WorldRenderData& renderData, Particle::Layer
const int textParticleFontSize = m_assets->json("/rendering.config:textParticleFontSize").toInt();
const RectF particleRenderWindow = RectF::withSize(Vec2F(), Vec2F(m_camera.screenSize())).padded(m_assets->json("/rendering.config:particleRenderWindowPadding").toInt());
- for (Particle const& particle : renderData.particles) {
+ if (!renderData.particles)
+ return;
+
+ for (Particle const& particle : *renderData.particles) {
if (layer != particle.layer)
continue;
@@ -218,7 +221,7 @@ void WorldPainter::renderParticles(WorldRenderData& renderData, Particle::Layer
} else if (particle.type == Particle::Type::Text) {
Vec2F position = m_camera.worldToScreen(particle.position);
- unsigned size = round((float)textParticleFontSize * m_camera.pixelRatio() * particle.size);
+ int size = min(128.0f, round((float)textParticleFontSize * m_camera.pixelRatio() * particle.size));
if (size > 0) {
m_textPainter->setFontSize(size);
m_textPainter->setFontColor(particle.color.toRgba());