# Design and Implementation of a Compiled Declarative Language for Game AI Control
###### Abstract
In the context of video games, the use of declarative languages for programming agents' behavior in video games has been carried out from different points of view. We can group the works into four categories: (i) based on the Prolog language [17; 18; 19]; (ii) based on the GOLOG language [15]; (iii) based on Planning [20]; and (iv) based on Answer Set Programming (ASP) [12; 21]. Here, we review the studies most relevant to our work. In [15], the authors describe and explain a logical programming language called GOLOG that allows for the implementation of FPS (First Person Shooters) style game agents and to face them against NPCs. The type of A.I. used is goal-based and employs planning techniques. Additionally, the article [14] explains creating and implementing a script based on the Prolog language within an FPS (First Person Shooter) style game to create different behavioral tactics in a bot team made up of agents. The agent used in this project is of the objective-based rational type, based on a decision tree with conditional instructions. On the other hand, in [12], an ASP extension is used to model discrete knowledge about the game and the situations that can be experienced in a 2D physics-based game. Unlike other scripting languages, Obelisk is a compiled and declarative programming language that gives programmers a double advantage: (i) it performs better as the compilation is completed before the code is executed and (ii) the declarative language allows the bots to be programmed, indicating how the behavior should be performed from a visual point of view. Still, we only tell the agent what they should do, that is, how it behaves regardless of the computer graphics aspects. The Table 1 shows the key differences between Obelisk and the rest of the mentioned scripting languages for agent programming. The primary innovation of our proposal is the skillful combination of several concepts, approaches, techniques and components, such as Game Artificial Intelligence, Scripting Programming Language, and Computer Games. In particular, the design, implementation, and evaluation of a declarative scripting language using C++, which translates instructions into a knowledge representation stored in SQLite. Additionally, we developed a video game using the Godot engine and created a library that enables communication between the language and the engine, facilitating practical application in real-world scenarios. In fact, we tested the language by using a video game that was created using the Godot game engine and it allowed us to demonstrate the correct functionality of our scripting language to program the AIs of the video game. Finally, for evaluating the behavior of the bots programmed with our language, we created an analysis platform using Go and R. This platform assesses the quality of the AIs based on the behavior of the entities compared to human players. While the nature of video games presents challenges in comparing our proposal to others--due to variations in games--our language is fully prepared for integration into any development project. Therefore, the highlights of the paper are as follows:  
* A new declarative and compiled scripting language is presented
* We explain its main features from two points of view: its syntax and performance (computational and behavioral). * We test it by using classical and statistical techniques
* We show that the process of programming is transparent and very interpretable
* A complete platform for game play analytics is also detailed  
The rest of the paper is organized as follows: Section 2 introduces several general concepts related to computer games and provides a brief overview of ALAI, the computer game where our language was implemented. Section 3 presents the Obelisk language using an illustrative example, and we focus on syntax, semantics, and the architecture of the system, explaining each of its modules in detail.