AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [L4D1/Any][POC] Custom Skybox (with DD support) (https://forums.alliedmods.net/showthread.php?t=320644)

Dragokas 01-01-2020 16:37

[L4D1/Any][POC] Custom Skybox (with DD support)
 
1 Attachment(s)
Since the implementation of 'Delayed Downloader' technology is out: [L4D2] Black Screen Fix aka Delayed downloader

and is finally functioning correclty (at least in L4D1 linux),
here is a concept of new technique using that in plugins.

I recall you how DD works:
- when player transition to a new map he downloads all files
- when player join server in the middle-game (newcomer) he download nothing, such a way no black screen appears for him.

Second part cause some negative effects, like newcomer see 'ERROR' instead of custom models.

This is a POC of implementation resolving that issue:

1) Custom Skybox without "ERROR" (aka white 'smeared' skyes) when played didn't download required materials yet.

Alpha-version could be found attached.

Idea based on applying different "sv_skyname" ConVar for different players. However, in L4D changing sv_skyname in middle-game does not affect already joined players. So, we just wait until all transitional players loaded and change "sv_skyname" globally. That thing completely make the work we need.

Edit source code and place
Quote:

void LoadSky()
{
g_aSky.PushString("underwater_corals");
here names of your custom skybox. Here is a video how to create your own skybox: https://www.youtube.com/watch?v=qgb0fNCaYaE (use DTX1 for better compression)
1 skybox sample is included.

Technique is compatible with any game. Required:
- to fill correct names of default skyboxes in DownloadSkyboxes() function to prevent downloading it.
- fill any game default skybox in Timer_WaitConnection() function.

Quote:

To out from alpha-status, need more experiments on separation players beetween transtitional and newcomers. Currently check is quite ugly, plugin makes delay 30 sec. after map start and check difference: IsConnected <-> InGame to define who is transitional (subseqently, that is mean such player downloaded successfully skybox materials) and who is newcomer (mean, he didn't downloaded materials - that is how delayed downloader actually works).
As a final goal:
- players who transitioned to a new map, can see cutom skybox
- players who joined in middle-game, see pre-defined default skybox

2) Soultion for 'ERROR' in custom models.

I don't provide plugin here yet. Idea is simple.

We use additional overlay model (clone) created over base model. Overlay model spawned using "prop_dynamic_ornament" entity. A sample can be found in Lux model changer. AFAIK, method by timocop and Lux.

Next we:
- change base model to custom
- set overlay model to default
- set SDKHook_SetTransmit to base model filtering newcomer players (so they only can see overlay with default model).
- set SDKHook_SetTransmit to overlay model filtering transitional players (so they only can see base custom model).

Such a way we resolve 'ERROR' for players who didn't download model files yet.

For easy use by 3rd party plugins, such native could be implemented:

Code:

DD_SetModel(int entity, char[] sNewModel, char[] sDefaultModel = "");
Feel free to use this technique in your works with respect to copyrights.
And if you are interested, maybe some help in finishing API appreciated.
Currently, I have no mood to make it myself.

Dragokas 01-01-2020 16:37

Re: [L4D1/Any][POC] Custom Skybox (with DD support)
 
Please, move to Un-approved plugin, since it's just a P-O-C.

Dragokas 05-28-2020 08:29

Re: [L4D1/Any][POC] Custom Skybox (with DD support)
 
Updated.

Quote:

1.1 (26-Mar-2020)
- Added support for all games.
- No need to define default skybox anymore. It is detected automatically.
- No need to list all default skyboxes. They are detected automatically.
Still, not fully supports DD, due to this issue: How to modify replicated ConVar on player join?

KadabraZz 12-01-2020 22:25

Re: [L4D1/Any][POC] Custom Skybox (with DD support)
 
Hello, you can change the skybox using the stripper

Code:

modify:
{
        match:
        {
        "classname" "worldspawn"
        }
        replace:
        {
        "skyname" "urbannightburning_hdr"
        }
}

I believe that there is no time to replicate a cvar for a client, I think that at any time it can be done.

Code:

#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

Handle hTest = INVALID_HANDLE;

public void OnPluginStart()
{
    hTest = CreateConVar("your_cvar", "1", "Hacked by plugin", FCVAR_CHEAT | FCVAR_REPLICATED);
    RegConsoleCmd ("sm_test", Command_Test);
}

public Action Command_Test(int client, int args)
{
    SendConVarValue(client, FindConVar("your_cvar"), "1");
    return Plugin_Handled;
}

This code is not mine but it works, remembering that you cannot replicate all cvars, there are some specific ones. Commands too, like r_screenoverlay

Dragokas 12-01-2020 22:35

Re: [L4D1/Any][POC] Custom Skybox (with DD support)
 
You totally didn't understand the purpose of the plugin as well as a goal of replication.


All times are GMT -4. The time now is 21:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.