BVM Questions

Blitz3D Forums/Blitz3D Programming/BVM Questions

Okay, I want to add BVM into the engine, properly. If this works, the author gets another license sale.

I am using one script per entity. I want to load a script with an UpdateEntity() function, and pass the function the four-byte entity data structure to update that entity.

file$="monster.script"
module=BVM_LoadModule(file)
If module=BVM_INVALID_MODULE RuntimeError "Error loading script "+Quote(file)+"."
context=BVM_CreateContext()
functionpointer=BVM_FindEntryPoint(context,module,"UpdateEntity")
BVM_SelectContext(context)
BVM_SelectEntryPoint(functionpointer)
BVM_Invoke_Blitz3D()


Questions:

-How do I pass a variable to the UpdateEntity() function? (The entity!)

-Can I have more than one function called "UpdateEntity" in the same context, or do I have to call each entity's update routine a different name?

-Is there any inherit overhead in calling a function? Should I call one UpdateMonsters() function, or is it okay to call each UpdateMonster() function individually?