Actually it’s not a simple question.
In some extreme situations, it might be necessary to have ChaiScript VM instances running for some specific entities
which have complex behavior.
However in general, most game entities behave with a simple behavior that can run in 1 VM which execute the same update function on all the elements of the game that match that behaviour. That VM could then be loaded with a script with all the possible scripted behaviours, but do nothing until the update functions are called (in entity type batch manner, preferably).
This is not the only setup possible. If you have a game console, you might want to make a ChaiScript VM instance loaded in it. Or you might want several instances depending on different totally unrelated systems, like an editor.
Just note one thing: all the data that exist in one VM will be visible to all scripts and calls being done through the same VM.
So basically you have to know:
- What needs scripted behavior.
- Can their behavior be gathers in a bunched of scripts loaded in 1 VM? Is it ok that they have access to the same data in the VM?
- What is the cost of a VM? Am I ok running more than one?
Anyway try to limit the VM instances count to the minimum necessary.
In a very complex game I am making, which is not finished, I plan to have several VMs because of different systems needing separation but also scripting, like the behaviour of each “place” (aka level/zone/area). But I don’t need a VM for entities because they have a dumb behavior (they are RTS units more or less). There is other places where I could use a VM, like the editor or some oppoonent’s behavior. We’ll see.
So it totally depends on the game. But keep in mind that a VM running is expensive.