Game programming patterns - Byte code
VM
Say we have some methods in our game we want to expose
void add_npc(int id);
void remove_npc(int id);
void set_health(int id, int amount);
int get_health(int id);
We create an instruction set:
enum class instruction
{
add_npc = 0x00,
remove_npc = 0x01,
set_health = 0x02,
get_health = 0x03,
literal = 0x25,
};