SAN AI project

GAME DEV — a PC and VR horror game prototype in Godot

The SAN AI team's first game. A 3D horror prototype for PC and a VR test scene were built in Godot. As the map grew, rendering was optimised for the forest, grass and objects obscured by fog.

Project contributors (alphabetical order)

In September 2025, a 3D horror prototype for PC with a separate VR test scene was developed within SAN AI. It was the team’s first game, and its members had no previous experience in game development. The prototype featured exploration by lantern light, collectible clues and a ghost that pursued the player using Godot’s navigation system.

As the map expanded, the frame rate fell from around 120 to 30 frames per second, reaching roughly 16 FPS in some tests. One contributing factor was the render distance, which covered almost the entire map. Thick fog obscured distant objects from the player, while the engine continued to render them. Reducing that distance was one of the changes after which the game ran more smoothly.

A lantern illuminates grass and tree trunks. A ghost's glowing face is visible deeper in the forest.Open the full-size image
Figure 1. The forest from the player's perspective. The lantern illuminates the nearest trees.

Choosing a game engine for PC and VR

The project began with a comparison of Unreal Engine, Unity and Godot. The aim was to develop a simple first-person horror prototype for PC and VR.

Unreal Engine was ruled out early because its development environment was considered too extensive for the scope of the project. Unity was considered next. The team found its environment relatively heavyweight, and some members preferred to work in a language other than C#.

Godot Engine was selected for its small installation footprint and the accessibility of GDScript. Most team members already knew JavaScript and expected to get started with GDScript quickly. This mattered on a first game project, where the team was learning to work with 3D scenes while creating models and implementing gameplay.

Gameplay and enemy navigation in Godot

Gameplay centred on exploring the map and collecting notes containing clues. The player could pick up, equip and light a lantern, then read collected clues in a journal. The map included a cemetery, a forest, a factory and a manor. Lighting and fog were used to limit visibility and shape the atmosphere of each location.

The Godot test window shows a first-person view of the cemetery, with gravestones and a lantern at the bottom of the frame.Open the full-size image
Figure 2. Testing cemetery lighting from the player's perspective.

The ghost used Godot’s NavigationAgent3D component. The player’s current position was supplied as the agent’s target. The ghost’s script retrieved the next point on the path and moved the enemy towards it. When the player was caught, the character was sent back to the starting point. An encounter with the ghost could therefore interrupt the search for clues.

How A* found a path for the ghost

The prototype used Godot 4.5’s default pathfinding algorithm, A*. A navigation mesh described the area available to the enemy as a set of connected polygons. During the search, A* prioritises candidates using the sum of the cost of reaching a point and the estimated cost of continuing from there to the destination. Godot uses this search to find a corridor of connected polygons towards the player’s position. Godot 4.5 path query parameters — opens in a new tab

By default, Godot post-processes the path with a funnel algorithm. It determines waypoints inside the corridor to shorten the route around corners. The ghost’s script retrieved the next waypoint with get_next_path_position(), accelerated towards it and moved using move_and_slide(). A separate RayCast3D check determined when the player had been caught. Godot 4.5 path post-processing documentation — opens in a new tab

3D game optimisation — MultiMesh, shadows and render distance

Frame-rate drops were observed as the scene was expanded over successive iterations. The FPS figures are approximate observations from the development of the prototype. Optimisation focused on three rendering costs.

  • Repeated geometry. Many repeated elements were initially placed as separate objects. The forest scene used MultiMesh to draw multiple instances of the same 3D mesh more efficiently across different positions.
  • Grass shadows. Grass was initially set to cast shadows. Rendering shadows for a large number of blades added to the cost of the scene, so shadow casting was disabled for the grass.
  • Render distance. The original distance covered nearly the entire map. It was reduced to better match the distance the player could see through the fog. The map script also checked the distance to the player at intervals and toggled the visibility and selected physics components of designated objects.

LOD (level of detail) was also implemented. Render distance determined how far away objects could be drawn. LOD reduced the detail of objects that remained visible farther from the player.

A scene with thick orange fog and Godot's performance monitor showing 13 FPS.Open the full-size image
Figure 3. A reading of 13 FPS during one test of the scene with thick fog.

Tree instancing and collisions in the forest

Forest rendering followed the principle of the Flyweight pattern. Each MultiMesh group shared the model’s geometry, while each tree had its own position, rotation and scale. Instancing allowed Godot to draw many trees without issuing a separate draw call for each one. Godot 4.5 MultiMesh documentation — opens in a new tab · Game Programming Patterns — Flyweight — opens in a new tab

The forest scene was configured with two groups of 65,536 grass instances each and one group of 200 tree instances. These counts were stored in the MultiMesh resources. The number of elements visible in a given view depended on the camera position. Shadow casting was disabled for the grass, and a separate script handled physical collisions with tree trunks.

Tree positions were read from the MultiMesh instances. At intervals, the script checked the player’s distance from the trees and considered the nearest ones first. For a nearby tree, a static body with a capsule collision shape was taken from a pool and placed at the trunk. When the player moved away, the capsule was disabled and the body was returned to the pool for reuse at another tree.

The deactivation threshold was set farther away than the activation threshold. This gap, known as hysteresis, reduced repeated switching when the player moved near the boundary. Tree rendering and trunk collisions could thus be controlled independently.

Developer console and VR testing with OpenXR

A developer console was built for testing and could be opened with F2. Opening it paused the game, and closing it resumed the same scene. Movement speed or jump settings could be changed and tested immediately in the current location.

The developer console shows a change in player speed using spd 60 and a list of commands after help is entered.Open the full-size image
Figure 4. Testing a change to player speed in the developer console.

The Command pattern and command parser

The Command design pattern was used. Each command was implemented as a separate object with a name, aliases, a description and an execute method. The interface accepted text and displayed the result, while CommandBus maintained the command registry and looked up the corresponding object by name or alias. With a common interface, adding a command such as jump required implementing and registering it. The same text input handling could be reused.

On submission, the parser split the input into tokens and kept quoted text together as a single argument. The first token was treated as the command name. The remaining tokens were parsed as positional arguments or named options. Both --value 60 and --value=60 were supported. Recognised numbers and Boolean values were converted to their corresponding types.

For example, spd 60 and speed --value=60 resolved to the same command object. The value was read from a positional argument in the first case and from the value option in the second. The command checked that it had received a number, updated the speed of the player supplied through the execution context and returned a confirmation displayed in the console history.

VR test scene with OpenXR

A separate scene with an XR camera was prepared for VR. The code checked whether the OpenXR interface had been initialised and enabled headset rendering when it was available. PC gameplay and VR integration were developed within the same Godot project.

Project outcome and team contributions

The resulting prototype allowed players to explore the map, use the lantern, collect notes and flee from the ghost. In its first game project, the team progressed from choosing an engine and building the initial scenes to integrating gameplay mechanics, testing VR and optimising the map.

  • Michał Korczyński, Anna Czechowicz and Wojciech Krata developed the gameplay mechanics, 3D models and game logic.
  • Jakub Tabachowicz and Michał Wasiel were responsible for preparing the VR test version.
  • Krystian Gumiński developed the developer console, implemented LOD, led the game’s optimisation work and coordinated the team.