Implementation of a Finite State Machine for Character Animation Transitions in Unity-Based 3D Games
DOI:
https://doi.org/10.58222/sj.v4i2.1808Keywords:
FSM, HSFM, gameAbstract
A responsive character animation system with smooth transitions is a crucial factor in creating a high-quality and immersive gameplay experience. A common issue that frequently arises is animation that appears rigid or unnatural when a character switches from one action to another. This study aims to implement a Finite State Machine (FSM) to manage player character animation transitions in the game Legacy of the Sunstone. The method employed is a Hierarchical Finite State Machine (HFSM) with Moore Machine characteristics, in which the output in the form of animation is determined by the currently active state at a given time. The implementation was carried out using the Unity Engine and applied the State Pattern to establish a structured, modular, and maintainable code architecture. The CrossFadeInFixedTime technique was utilized to achieve smooth animation blending between states with configurable transition durations. The developed FSM system consists of two main categories: Locomotion states, including Idle, Movement, Jump, Falling, and Crouch, and Combat states, including Aim, Melee, and Takedown. System testing can be conducted using Black Box Testing through an iterative approach across 13 test scenarios that cover all functional requirements of the system.
References
Newzoo, "Gaming Industry Expected to Reach $197 Billion by 2025" PC Gamer, 2026. Diakses melalui https://www.pcgamer.com/gaming-industry/analyst-firm-says-the-games-market-is-expected-to-reach-a-record-breaking-usd197-billion-by-the-end-of-2025-driven-primarily-by-stronger-than-expected-performance-on-pc-and-mobile
Wan Nor Raihan Wan Ramli, dkk, "The Needs in Developing Animation for Games Learning for Game Design Program", Open Access Journal Vol 14, Issue 3, (2025) E-ISSN: 2226-6348.
Xiangjun Tang, dkk, ACM Transactions on Graphics (TOG), Volume 41, Issue 4 Article No.: 137, Pages 1 - 10
M. Sipser, Introduction to the Theory of Computation, 2nd ed. Boston, MA: Thomson Course Technology, 2006.
R. Nystrom, Game Programming Patterns. 2014.
D. Jagdale, “Finite State Machine in Game Development,” International Journal of Advanced Research in Science, Communication and Technology, pp. 384–390, Oct. 2021, doi: 10.48175/ijarsct-2062.
R. Singh and G. Goyal, “Algorithm Design for Deterministic Finite Automata for a Given Regular Language with Prefix Strings,” in SCRS CONFERENCE PROCEEDINGS ON INTELLIGENT SYSTEMS, Soft Computing Research Society, 2021, pp. 133–142. doi: 10.52458/978-93-91842-08-6-11.
E. N. F. Dewi, A. N. Rachman, and R. H. Z. Hartadji, “Implementation of Hierarchical Finite State Machine for Controlling 2D Character Animation in Action Video Game,” in 2023 8th International Conference on Informatics and Computing, ICIC 2023, Institute of Electrical and Electronics Engineers Inc., 2023. doi: 10.1109/ICIC60109.2023.10381978.
M. Sipser, Introduction to the Theory of Computation, 2nd ed. Boston, MA: Thomson Course Technology, 2006.
J. Schell, “The Art of Game Design: A Book of Lenses,” 2019.
R. Zubek, “Elements of Game Design,” 2020.
R. Nystrom, Game Programming Patterns. 2014.
Unity Technologies, “Unity Engine: 2D & 3D Development Platform | Unity.” Accessed: Dec. 19, 2025. [Online]. Available: https://unity.com/products/unity-engine
Microsoft, “Visual Studio Code.” Accessed: Dec. 19, 2025. [Online]. Available: https://code.visualstudio.com/docs/editor/whyvscode
D. Farley, “Continuous Delivery Pipelines How to Build Better Software Faster,” 2020. [Online]. Available: http://leanpub.com/cd-pipelines














