Added client-side Thinkers
Adds support for client-side Thinkers, Actors, and ACS scripts (ACS uses the existing CLIENTSIDE keyword). These will tick regardless of the network state allowing for localized client handling and are put in their own separate lists so they can't be accidentally accessed by server code. They currently aren't serialized since this would have no meaning for other clients in the game that would get saved. Other logic like the menu, console, HUD, and particles have also been moved to client-side ticking to prevent them from becoming locked up by poor network conditions. Additionally, screenshotting and the automap are now handled immediately instead of having to wait for any game tick to run first, making them free of net lag.
This commit is contained in:
parent
e4081df0db
commit
f7e62a8cd6
28 changed files with 507 additions and 215 deletions
|
|
@ -573,6 +573,7 @@ void DObject::Serialize(FSerializer &arc)
|
|||
SerializeFlag("justspawned", OF_JustSpawned);
|
||||
SerializeFlag("spawned", OF_Spawned);
|
||||
SerializeFlag("networked", OF_Networked);
|
||||
SerializeFlag("clientside", OF_ClientSide);
|
||||
|
||||
ObjectFlags |= OF_SerialSuccess;
|
||||
|
||||
|
|
@ -668,7 +669,7 @@ void NetworkEntityManager::SetClientNetworkEntity(DObject* mo, const unsigned in
|
|||
|
||||
void NetworkEntityManager::AddNetworkEntity(DObject* const ent)
|
||||
{
|
||||
if (ent->IsNetworked())
|
||||
if (ent->IsNetworked() || ent->IsClientside())
|
||||
return;
|
||||
|
||||
// Slot 0 is reserved for the world.
|
||||
|
|
@ -758,6 +759,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, GetNetworkID, GetNetworkID)
|
|||
ACTION_RETURN_INT(self->GetNetworkID());
|
||||
}
|
||||
|
||||
static int IsClientside(DObject* self)
|
||||
{
|
||||
return self->IsClientside();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, IsClientside, IsClientside)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
|
||||
ACTION_RETURN_BOOL(self->IsClientside());
|
||||
}
|
||||
|
||||
static void EnableNetworking(DObject* const self, const bool enable)
|
||||
{
|
||||
self->EnableNetworking(enable);
|
||||
|
|
|
|||
|
|
@ -359,6 +359,7 @@ private:
|
|||
public:
|
||||
inline bool IsNetworked() const { return (ObjectFlags & OF_Networked); }
|
||||
inline uint32_t GetNetworkID() const { return _networkID; }
|
||||
inline bool IsClientside() const { return (ObjectFlags & OF_ClientSide); }
|
||||
void SetNetworkID(const uint32_t id);
|
||||
void ClearNetworkID();
|
||||
void RemoveFromNetwork();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ enum EObjectFlags
|
|||
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
|
||||
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
|
||||
OF_Networked = 1 << 14, // Object has a unique network identifier that makes it synchronizable between all clients.
|
||||
OF_ClientSide = 1 << 15, // Object is owned by a specific client rather than the server
|
||||
};
|
||||
|
||||
template<class T> class TObjPtr;
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ DObject *PClass::CreateNew()
|
|||
ConstructNative (mem);
|
||||
|
||||
if (Defaults != nullptr)
|
||||
((DObject *)mem)->ObjectFlags |= ((DObject *)Defaults)->ObjectFlags & OF_Transient;
|
||||
((DObject *)mem)->ObjectFlags |= ((DObject *)Defaults)->ObjectFlags & (OF_Transient | OF_ClientSide);
|
||||
|
||||
((DObject *)mem)->SetClass (const_cast<PClass *>(this));
|
||||
InitializeSpecials(mem, Defaults, &PClass::SpecialInits);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue