How are games like Undertale made? I specifically focus on the unique events in battles, like when Sans attacks you when you select an action, and also if one could make a >>Undertale engine<< that could create a battle, NPC dialogue and more.