I am writing an ECS framework and also a game with it, in Python. In an ECS framework, components should contain only data. However, sometimes setup code is needed to create the data. For example, in an audio component, the data would be the volume of the the sound to play and the path to the audio file. But in the audio-playing library, there are objects to represent sounds, which have a sound.play()
method, for example. My question is whether this object should be created in the component, which sort of violates the rule that entities should be pure data, or in the system. If it should best be done in a system, it would only need to be done once (and it would harm performance if the audio file needed to be created once per frame). What is the best way to do this?
jeudi 25 avril 2019
How should setup code be handled in entity-component-system?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire