If you think that Lua is too complicated, you are probably not looking for a common programming language (another suggestion would be Python). Instead, consider creating a domain-specific language . I will make some assumptions here about your game, but you could, for example, implement a rule-based scripting language, where each script represents an adversary’s behavior:
can_see(player) and distance_to(player) > 100: run_towards(player) can_see(player) and distance_to(player) < 100: shoot_at(player) default: wander()
At each step of the argument, the first matching rule can be satisfied. In this case, you will need some form of hysteresis so that your NPCs cannot make a decision.
This basically reduces your programming language to one if-else-if with a limited number of keywords and operators to be used. You can even create your own IntelliSense editor specifically for your language. If your users are ready for this, you may have nested rules:
can_see(player): distance_to(player) > 100: run_towards(player) default: shoot_at(player)
At some point, you can begin to allow variables and user-defined functions, but then from the very beginning, a general-purpose language would be the best choice! So, you see, the main question is to find a balance between versatility and convenience.
source share