As a little preparation for the start of my new game that I want to begin in March, I'd like to talk about a topic that's less about actual code and more about best practices and script definition:
The movement of opponents.
In my last game, I simply had individual functions for every character. This was justified because their movements were vastly different: One only walks back and forth, one only jumps, one flies around without being hindered by the environment etc.
Also, I had only seven opponents, so a scripting engine would have been overkill.
But my new game is supposed to be a top-down action adventure, similar to "The Legend of Zelda" and "Final Fantasy Adventure". And this game, as an UNROM game, will probably have a huge bunch of opponents. Maybe 20-30 or so.
That's why I intended to create a data-/script-based approach: One function MoveOpponent that simply reads values from an array to decide what the opponent shall do next.
I think I could come up with something if I think of it:
For example, the first value could be an indicator of what the next values are supposed to be, i.e. each value stands for a sub algorithm like "walk in straight line", while the next value or values are parameters.
But I wanted to ask whether there's an established way to do this in an efficient and space-saving way.
Are there algorithms or general descriptions on how to implement opponent behavior of simple adventure game opponents?
And is there any knowledge on how the famous games did it?
What does the algorithm look like that decides that a Moblin walks in straight lines, occasionally turns to the side and shoots arrows while a ghost flies in certain patterns and cannot be stopped by walls?
Did anybody already analyze the "Zelda" ROM regarding this?
The movement of opponents.
In my last game, I simply had individual functions for every character. This was justified because their movements were vastly different: One only walks back and forth, one only jumps, one flies around without being hindered by the environment etc.
Also, I had only seven opponents, so a scripting engine would have been overkill.
But my new game is supposed to be a top-down action adventure, similar to "The Legend of Zelda" and "Final Fantasy Adventure". And this game, as an UNROM game, will probably have a huge bunch of opponents. Maybe 20-30 or so.
That's why I intended to create a data-/script-based approach: One function MoveOpponent that simply reads values from an array to decide what the opponent shall do next.
I think I could come up with something if I think of it:
For example, the first value could be an indicator of what the next values are supposed to be, i.e. each value stands for a sub algorithm like "walk in straight line", while the next value or values are parameters.
But I wanted to ask whether there's an established way to do this in an efficient and space-saving way.
Are there algorithms or general descriptions on how to implement opponent behavior of simple adventure game opponents?
And is there any knowledge on how the famous games did it?
What does the algorithm look like that decides that a Moblin walks in straight lines, occasionally turns to the side and shoots arrows while a ghost flies in certain patterns and cannot be stopped by walls?
Did anybody already analyze the "Zelda" ROM regarding this?