View Single Post
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-01-2020 , 16:37   [L4D1/Any][POC] Custom Skybox (with DD support)
Reply With Quote #1

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.
Attached Files
File Type: zip skybox_forum.zip (4.06 MB, 274 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 05-28-2020 at 08:29.
Dragokas is offline