Working on the server
This commit is contained in:
1 parent
075750442f
commit
28c6e83eda
30 files changed
+646
-362
No files matched your search
+8
-4
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "render/Renderer.h"
|
||||
#include "Environment.h"
|
||||
@@ -48,7 +48,7 @@ namespace FRG
|
||||
float radius = 1.5f;
|
||||
float hysteresis = 0.3f; // exit fires at radius + hysteresis to prevent flickering
|
||||
bool enabled = true;
|
||||
bool playerInside = false; // runtime tracking state, not serialized (mirrored in LocationState)
|
||||
bool playerInside = false; // runtime tracking state, not serialized (mirrored in LocationNetworkState)
|
||||
};
|
||||
|
||||
struct LocationSetup
|
||||
@@ -68,6 +68,7 @@ namespace FRG
|
||||
// setup() creates a private one when this is null.
|
||||
std::shared_ptr<Character> player;
|
||||
LocationGameState* gameState = nullptr;
|
||||
std::shared_ptr<LocationLocalState> localState;
|
||||
};
|
||||
|
||||
class Location
|
||||
@@ -78,7 +79,9 @@ namespace FRG
|
||||
// Detaches the (shared, longer-lived) player from this location.
|
||||
~Location();
|
||||
const std::string& locationId() const { return locationId_; }
|
||||
std::shared_ptr<const LocationState> stateSnapshot() const;
|
||||
std::shared_ptr<const LocationNetworkState> stateSnapshot() const;
|
||||
LocationLocalState& localState() { return *localState_; }
|
||||
const LocationLocalState& localState() const { return *localState_; }
|
||||
bool isDarklands() const;
|
||||
bool isNight() const;
|
||||
bool isDawn() const;
|
||||
@@ -234,13 +237,14 @@ namespace FRG
|
||||
private:
|
||||
IGameServer& gameServer_;
|
||||
std::string locationId_;
|
||||
std::shared_ptr<LocationLocalState> localState_;
|
||||
std::unordered_map<std::string, std::shared_ptr<Character>> remotePlayers_;
|
||||
void synchronizeRemotePlayers();
|
||||
void drawRemotePlayerNames(
|
||||
const Eigen::Matrix4f& cameraViewMatrix,
|
||||
const Eigen::Matrix4f& projectionMatrix);
|
||||
// ---- Pointer-to-index helpers ----
|
||||
TeleportZone* getTargetTeleportZone(const LocationState& state);
|
||||
TeleportZone* getTargetTeleportZone(const LocationNetworkState& state);
|
||||
|
||||
enum class InstancedTexture { None, Color, Darklands };
|
||||
|
||||
|
||||
Reference in new issue
Block a user