Understanding of history decreases with each generation, especially among the younger generation. This happens because the delivery media used is considered less attractive. Games are considered to be an interesting educational medium to increase understanding of history in Indonesia. This research takes the theme of the history of the Islamic Mataram Kingdom. To make an educational game that is interesting and not boring, there are several things you need to pay attention to, such as the behavior of Non-Playable Characters (NPC). Dynamic enemy NPC behavior can provide players with an interactive gaming experience, making the game feel more interesting and not boring. In this research, the game created is an Action Platformer type with a method approach using Finite State Machine (FSM) to shape behavior in NPCs. The parameters used as input are the enemy's health points and the distance between the enemy and the player. The test results in this research show that the enemy's behavior patterns change according to the conditions received by the enemy NPC. These results show that the behavior of enemy NPCs in the Islamic Mataram Kingdom game "Glory of Matawis" has dynamic and interactive behavior with variations in behavioral patterns that can change according to conditions.