Orient_t m_transform;
Mesh3d* m_pMesh;
void* m_pUserData;
void (*m_pUpdate)(); // polymorphic update
void (*m_pDraw)(); // polymorphic draw
}Bucketed updates: only call a certain update for objects in the same 'bucket' to avoid calling the update on unnecessary objects
enum Bucket
{
kBucketVehiclesPlatforms,
kBucketCharacters,
kBucketAttachedObjects,
kBucketCount
};
void UpdateBucket(Bucket bucket)
{
for (each gameObject in bucket)
{
gameObject.PreAnimUpdate(dt);
}
g_animationEngine.CalculateIntermediatePoses(bucket, dt);
for (each gameObject in bucket)
{
gameObject.PostAnimUpdate(dt)
}
...
}
void main()
{
while (true)
{
UpdateBucket(kBucketVehiclesPlatforms);
UpdateBucket(kBucketCharacters);
...
}
}
Concurrency: can call asynchronous functions to kick off a task, then perform other tasks while it is running, then call a sync when we need to wait for the concurrent task to be completed
The language interpreter is contained within the game engine, 'emulating' the system for the script to run in (example from Naughty Dog's DC language)
void DcExecuteScript(DCByteCode* pCode)
{
DCStackFrame* pCurStackFrame = DcPushStackFrame(pCode);
while (pCurStackFrame != nullptr)
{
DCInstruction& instr = pCurStackFrame->GetNextInstruction();
...
}
}
Language calls can be tied/binded to engine calls via the language function string or similar