Goal: What I want is to create a game where the player can write Lua scripts to control/move robots. The gameplay would be very similar to an existing game called ‘When The Farmer Was Replaced’.
Problem: The problem is that if the player wrote an infinite loop, wouldn’t it freeze the game?
I’ve done an AI-assisted research, and it offer these solutions:
You would most likely execute one step of the program, save the state and program counter, then yield back to the engine, and next frame you restore state and program counter and execute the next instruction.
Yes, this is perfectly suited for this.
I’ll leave this here for you. A robot programming game made with Defold: