I am making a game where users being able to define their own unique behavior for NPCs (that chase after the player trying to kill them) is a fundamental part of the game. I’m not sure, however, what is the most practical or optimal way to go about that.
I currently have a working format which looks like the following:
Event = {
Type = "Print",
Data = "Hello, world!",
Next = {
Type = "Wait",
Data = 3,
Next = {
Type = "SetVariable",
Data = {"x", "Waited 3 seconds"},
Next = {
Type = "Print",
Data = "x",
UseVariable = true
}
}
}
}
It works and I got a working interpreter for it. Now, however, is the part where I need to implement a way for the player to actually write their own code (I don’t expect my players to know programming, so probably a visual solution) and while I think I can manage any solution, I don’t know which one is the best for my unique use case.
Block coding would fit best, but I think too long to implement. That isn’t an issue on its own but if I decide to change it later on, I’d have wasted a lot of my time.
Nodegraphs, like UE, also seem like a viable solution. But, it also has the same problem as block coding—too long to implement. Additionally, my current system only supports for blocks to have one other block attached to it.
I even had a weird idea where a user would have to write code like this:
Event:
Print "Hello, world!"
Wait 3
Set "x" "Waited 3 seconds"
Print "x"
But I decided not to go with that for pretty obvious reasons.
I understand that all of these are viable and completely valid solutions to the problem. However, I need help deciding which is best to try out first, and I’m open to your own ideas on how I could manage this.
Thank you, in advance