Jump to content

What is SetPristine()?


Recommended Posts

And how it may affect looped sounds?

 

I have noticed that as a host, I can hear a repeated sound from a monster, but as a client, I only do it once.

 

Maybe I should build locomotor and stategraphs before not TheWorld.ismastersim ?

Link to comment
Share on other sites

@DarkXero, I don't believe it has any influence on looped sounds. Although I don't know exactly what it does, I know it's at least related to the "network-dirty" system. Basically when something changes a netvar, it tells the client that whatever locally-processed system using the netvar is "dirty" because it is now inaccurate, and needs to be updated in light of the new netvar value.

 

I believe SetPristine() marks all aspects of an entity as "clean" -- not dirty. The specifics on what this really means, though, I'm not sure.

Link to comment
Share on other sites

@rezecib, in abigail.lua:
--It's a loop that's always on, so we can start this in our pristine stateinst.SoundEmitter:PlaySound("dontstarve/ghost/ghost_girl_howl_LP", "howl")

So it made me wonder, because I'm having trouble with a sound.

Edited by DarkXero
Link to comment
Share on other sites

I believe SetPristine() marks all aspects of an entity as "clean" -- not dirty. The specifics on what this really means, though, I'm not sure.

SetPristine (which should only be called on the host) tells the engine that everything set up for the entity so far will also be set up identically on clients. It also seems that all engine level components (Transform, AnimState, Physics, etc.) must be added before a call to SetPristine.

It's just a matter of reducing network usage. For example, tags added on the host after SetPristine (or added without SetPristine being called at all) are transmitted to all clients, but tags added before it are not. Most networked entities have 'inst.entity:SetPristine()' called at some point, the only exception seems to be some FX entities which need to have some engine level components set up dynamically (such as FX entities with a 'inst.entity:AddFollower()' call).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...