we need to deprecate functions in the engine API. It can be annoying to the people using the engine of course, but backwards patibility is the mother of stagnation. If you never throw away old code, you will eventually have a huge ugly code mess on your hands.Luckily, since the script can create functions in the engine namespace, the script can provide the backwards patibility when needed.For example, we used to FIFA Coins have a function PhysicsWorld.clear_kinematic(world, actor). That naming was

 

with some of our other functions so we changed it to FUT Coins Actor.set_kinematic(actor, false).One way of dealing with this change would be to go through all the code in the project, find all uses of PhysicsWorld.clear_kinematic and change them to use Actor.set_kinematic instead. But another way would be to just implement PhysicsWorld.clear_kinematic in the script:function PhysicsWorld.clear_kinematic(world, actor)Actor.set_kinematic(actor, false)endNow the rest of the code

 

go on using PhysicsWorld.clear_kinematic without even caring that the function has been removed from the engine API. You could even use a bination of the two strategies — implementing the deprecated function in Lua for a quick fix, and then looking into removing the uses of it.5. Dynamically inserting profilingTop-down profiling with explicit profiler scopes is a good way of finding out where a game is spending most of its time. However, to be useful, explicit profiler scopes need to be

 

in all the "right" places (all potentially expensive functions).In C we need to guess where these right places are before piling the program. In Lua, we can just insert the profiler scopes dynamically. We can even create a function that adds profiling to any function we want:function profile(class_name, method_name)local Gclass_namemethod_name_Gclass_namemethod_name = function (...)Profiler.start(class_name .. "." .. method_name)f(...)Profiler.stop()endendWhen we call at https://www.mmogo.com