Currently FRB wizard can create a simple platformer with no code - you just select the platformer type and the wizard will create a game with levels, platforming physics, platforming controls, collision relationships. The user can paint a level in the editor and try it out.
However, the character is a white rectangle. It is missing art. If the user wants to add art to the level, it can be done in Tiled with no code, but adding animation to the player requires code, and it's unfortunately somewhat complex.
The new platform wizard is missing the "wow" factor of having an animated character, and if it had support for automatically animating a platformer character, then users would be that much further along on their project from the beginning.
Solution Discussion
To solve this, the platformer plugin could codegen some animation playing code. The simplest conceptually is to generate animation code depending on which movement type is used. Each movement type could have an animation name that it assigns, and whenever the values are set, the animation changes. Games like Super Mario Bros play animations at different speeds depending on the player's velocity, so some variables are needed to control speed.
Unfortunately, this does not provide enough flexibility to be used in a lot of games, and if the user had to rip that out and start fresh this would be frustrating for all but the most basic of games.
Here are things that games might need in a platformer animation system:
Each set of movement values needs to:
Specify its animation name such as "Walk"
Support setting left/right automatically. Therefore, setting "Walk" and checking "Append Direction" would result in WalkLeft and WalkRight being set
Each movement value may need to support multiple animations. For instance, the ground movement values may need to support Idle and Walk
Specify the minimum and maximum absolute horizontal values for playing the animation. That way, a walk animation may only play if the user is moving faster than X units/second, whereas an idle animation would play if less than X units/second.
Similar to the point above, an animation may need to support minimum and maximum vertical velocity. For example, different animations may play if the player's Y velocity > 0 or < 0 (like Super Mario World)
Specify the "horizontal speed" to "animation speed" formula. This allows the walk animation to play faster when the player is moving more quickly.
Whether the animation should play one time or continue to loop. For example, in Donkey Kong Country, the jump animation includes the character moving his arms up immediately after the jump, then staying up for the remainder of the jump. This would be a transition animation.
Whether the animation should follow the initial transition animation.
There may be other things that are needed. For instance, the animation may need to support attacks but only when the player performs an attack (like Mario shooting a fireball), or may depend on other input (like Donkey Kong playing a swim animation whenever the player pushes the swim/jump button in water)
Therefore, a good balance is needed between providing useful defaults which will work in many cases, but which are very easy to override.
Animation Layers
This system should definitely use the AnimationLayer system, as that allows additional logic to inject itself inbetween the different layers, or on top of the layers. A layered system allows for adding new logic on top. If the new top layers return animation values, then those will be used. Otherwise, the generated animation layers will be applied.
Will the following separation between what's generated vs custom work?
Generated:
Multiple animations per movement, each with min/max x and y nullable floats.
Horizontal speed to animation speed
Ability to specify left/right auto assignment or not
This will create an animation layer which can then be added to an AnimationController.
Supported Through Code Generation
The following would be supported automatically, with no need for custom code (including facing left and right):
Idle
Walking (different speed)
Running (different speed)
The following would require custom code:
Shooting (detect button push, override the animation with a shoot animation)
Taking damage (detect damage state, override with taking damage)
Climbing rope (this would be based on YVelocity not XVelocity)
Problem
Currently FRB wizard can create a simple platformer with no code - you just select the platformer type and the wizard will create a game with levels, platforming physics, platforming controls, collision relationships. The user can paint a level in the editor and try it out.
However, the character is a white rectangle. It is missing art. If the user wants to add art to the level, it can be done in Tiled with no code, but adding animation to the player requires code, and it's unfortunately somewhat complex.
The new platform wizard is missing the "wow" factor of having an animated character, and if it had support for automatically animating a platformer character, then users would be that much further along on their project from the beginning.
Solution Discussion
To solve this, the platformer plugin could codegen some animation playing code. The simplest conceptually is to generate animation code depending on which movement type is used. Each movement type could have an animation name that it assigns, and whenever the values are set, the animation changes. Games like Super Mario Bros play animations at different speeds depending on the player's velocity, so some variables are needed to control speed.
Unfortunately, this does not provide enough flexibility to be used in a lot of games, and if the user had to rip that out and start fresh this would be frustrating for all but the most basic of games.
Here are things that games might need in a platformer animation system:
Each set of movement values needs to:
There may be other things that are needed. For instance, the animation may need to support attacks but only when the player performs an attack (like Mario shooting a fireball), or may depend on other input (like Donkey Kong playing a swim animation whenever the player pushes the swim/jump button in water)
Therefore, a good balance is needed between providing useful defaults which will work in many cases, but which are very easy to override.
Animation Layers
This system should definitely use the AnimationLayer system, as that allows additional logic to inject itself inbetween the different layers, or on top of the layers. A layered system allows for adding new logic on top. If the new top layers return animation values, then those will be used. Otherwise, the generated animation layers will be applied.
Will the following separation between what's generated vs custom work?
Generated:
This will create an animation layer which can then be added to an AnimationController.
Supported Through Code Generation
The following would be supported automatically, with no need for custom code (including facing left and right):
The following would require custom code: