Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic precaching of model textures, groups and sounds #542

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Arkshine
Copy link
Member

@Arkshine Arkshine commented Sep 2, 2018

An attempt to allow automatic precaching for model textures (*T.mdl) / groups (*01.mdl, etc.) and weapon sounds, similar to what does already ReHLDS.

Few remarks:

  • Small QoL mainly for convenience and to trigger less crash
  • This targets only vanilla engine as it exists in ReHLDS. It would have been ideal to have this in the engine, but considering GoldSrc is in maintenance mode only, new features are not going to happen.
  • The reason that the code is global and located in ServerActivate is to allow the modules as well.
  • Unlike ReHLDS, there is no cvar to choose to precache weapon sounds. Not sure if necessary. Why is there a cvar?
  • Actually, do we need cvars for people to opt-in automatic precaching?

To be discussed.

@WPMGPRoSToTeMa
Copy link
Contributor

The code relies on a temporary fake entity because of afaik, unless done manually, there is no direct way other than using pfnGetModelPtr which require an edict (internally, it retrieves model_t* from pev->modelindex).

Then maybe just create a variable with the edict_t type? I think we can rely on implementation details here.

@Arkshine
Copy link
Member Author

Arkshine commented Sep 4, 2018

You're right, not sure why It did not occur to me.

Any others suggestions or thoughts on it? What about the cvars?

@IgnacioFDM
Copy link
Contributor

IgnacioFDM commented Sep 6, 2018

I think cvars should exist. There are things I intentionally don't precache because I don't need/want clients to download, like some weapon sounds.

@PartialCloning
Copy link
Contributor

PartialCloning commented Sep 20, 2018

Missing *T.mdl results in the server crashing, missing sounds don't. Weapon sound precache or precaching sounds attached to models should have a cvar and more importantly should be opt in, not opt out. Like REHLDS.

This is better suited to a plugin than a built in feature in AMXMODx. Expect zombie server owners to complain about the new amxmodx crashing their server because of too many resources, where as the old one worked fine.

@Arkshine
Copy link
Member Author

Arkshine commented Sep 20, 2018

Well, we can go with upgrading precache_model native, and adding precache_weapon_sound native for example. For modules, adding MF_PrecacheModel and MF_PrecacheSound or something like that. It would be more specific and no config needed like cvars.

@WPMGPRoSToTeMa
Copy link
Contributor

and adding precache_weapon_sound native for example.

@Arkshine it's not only for weapons.

@Arkshine
Copy link
Member Author

Then I guess precache_model_sound :P.

Anyway, please give feedbacks, should we go with the natives way?

@HamletEagle
Copy link
Contributor

Automatically precaching model sounds shouldn't be the default behavior. I think we should go with the native because it would allow to decide individually for each model unlike a cvar which would be global.

@justgo97
Copy link

Yeah, this should be just natives and shouldn't change any HLDS behavior

@Arkshine
Copy link
Member Author

Alright.

@WPMGPRoSToTeMa
Copy link
Contributor

WPMGPRoSToTeMa commented Sep 30, 2018

Maybe we should go with both cvar (however we can add it later) and native?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants