-
Notifications
You must be signed in to change notification settings - Fork 5
Gotchas
#Introduction
There are certain aspects to the workflow that may not make sense, and without first being aware of them one may find undesired behaviour.
Attribute are set to "complain" by default. This means that their values are hashed whenever the attribute itself is assigned a new value. Setting a muteable value which supports hashing (e.g a Struct instance) will read the hashed values of its current state. Hence, if you were to execute this code: {{{ data = Struct() self.attribute = data
data.x = 1 data.y = 2 }}}
You would receive the same hash each time. To fix, simply assign after setting the values
{{{ data = Struct()
data.x = 1 data.y = 2
self.attribute = data }}}
This means that roles should not be replicated as complaining attributes
Attributes cannot be coerced. (integers are treated as integers, and floats as floats, so you'll get errors trying to set them as such): It would not be sensible to support this, as side effects would be unwanted. {{{ class Example(Replicable): attribute = Attribute(0) #or Attribute(type_of=int)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.attribute = 1.0 # TypeError raised here
}}}
#Network
##Replication Overview
##Serialisation Data handlers
##Communication Messaging
#Game Framework ##Bindings Creating bindings