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:
Boondorl 2024-11-09 22:18:04 -05:00 committed by Ricardo Luís Vaz Silva
commit f7e62a8cd6
28 changed files with 507 additions and 215 deletions

View file

@ -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);