Hi retro gamers and retro game devs,
This is my first ever game, or at least the first serious game project I have undertaken. In the past I have only dabbled in BASIC and C and never reached the point where I could create games with graphics. My only other game-related experience was making my own Doom II WAD file for a Doom II-based game engineered for cooperative multiplayer. I spent years working on it but it only ended up having two levels.
After that I created a very simple proof-of-concept project to get familiar with GB Studio. It was just to prove to myself that I could create an RPG battle engine. The game consisted of a few rooms where the player talks to an NPC, which triggers a battle screen. The player fights the enemy until it dies, and that was essentially the whole project.
After getting familiar with the basics of making an RPG in GB Studio, I started working on a story concept for a more serious game. The game is called SeaTropilis, and this is the itch.io page:
https://x-avy.itch.io/seatropilis
The project is currently at v0.025 (it started at v0.001), so it has gone through about 25 revisions. I have been working on it for about a year, although not consistently.

The game follows a character named Leo Xeen, who has just graduated from university with a degree in Marine Biology and gets a job as a field scientist for an organization with a research base located 40 meters underwater near the Galápagos Islands.
The game begins with Leo writing a diary entry explaining to the player that he has just finished university and has accepted a job with Oceanographica Scientifica to work at the underwater base SeaTropilis. After finishing the diary entry, the phone rings. When the player answers it, Leo's new boss tells him to obtain his diving license from the dive shop and gives him access to a company account with $5,000 to purchase diving equipment.
The player then controls Leo and walks outside his house to go to the local dive shop. In the shop there are two characters: one provides Leo with his commercial diving license (which he obtained training for during his studies), and the other sells the SCUBA equipment required for diving. At this point the player can purchase the gear.

Leo then returns home where his parents are now present. The player can talk to them for advice and encouragement. Interacting with the diary gives two options:
-
Write in the diary (save the game)
-
Catch some Z's (sleep until the next day)
Sleeping triggers a cutscene where Leo automatically catches an early-morning flight.
In the next scene, a plane transports Leo across the world from Kraków, Poland, to Rio de Janeiro, Brazil, and then onward to the Galápagos Islands. From there he takes a submarine down to the underwater base SeaTropilis.
When he arrives, the base overseer Captain Murphy greets him and shows him around the facility. Leo then sleeps in his new quarters. The next day he meets the Chief Scientist, Dr. Psy Ants, who assigns his first mission.
The mission involves locating the source of a distress signal coming from an uncharted underwater cave system called Black Caverns. The signal is coming from a dolphin that works for Oceanographica Scientifica as a field agent but has become trapped somewhere in the cave system. Dr. Psy Ants gives Leo a tracker device and a harpoon gun.
Before leaving, Leo must purchase any remaining diving equipment from the SeaTropilis shop (if he hasn't already), including a diving knife for combat. The gear is equipped in the locker room where Leo changes into his dive suit.
Once equipped, Leo can enter the Moon Pool, which provides access to the open ocean. When the player enters the water, Leo is automatically placed in the entryway of the Black Caverns.

Here the player encounters an enemy sprite — a vicious Moray Eel. When the enemy sprite approaches the player sprite, the game switches to a battle scene similar to traditional RPGs.
The battle system itself is intentionally simple and based on randomness combined with player and enemy stats. When the player defeats the Moray Eel using the knife, the battle ends and the player returns to the Black Caverns entryway.
And that is where development currently stands.
The next major problem I need to solve is how to keep track of enemies that have been defeated.
Many RPGs do not display enemy sprites in the overworld, instead triggering random encounters. However, in SeaTropilis the enemies are visible sprites that wander around the screen. After defeating one in battle, I want that sprite to remain gone when the player returns to the overworld.
Using a standard variable seems like the obvious solution, but that would result in potentially hundreds of global variables being added to the game.
I previously asked ChatGPT to help me with this problem, and it suggested a bitwise system where binary values could track which enemies had been defeated. Unfortunately it could not produce a solution that worked properly with the structure of my battle engine.
The battle engine currently works like this:
Each enemy type has its own stat values (Max HP, Strength, Endurance, Agility, etc.). Moray Eels, for example, have a defined set of values for these stats.
I then have a set of global enemy stat variables used during battle (Enemy Max HP, Enemy Strength, Enemy Endurance, Enemy Agility, etc.).
Each enemy type also has an ID number. The Moray Eel has ID 1. A script checks this ID and loads the correct stat values into the global enemy stat variables before the battle begins.

When the enemy sprite moves within a certain range of the player sprite, the current scene is stored on the stack and the game switches to a close-up battle scene.
In that battle scene, a script identifies the enemy type, loads the correct enemy stats, and compares Agility between Leo and the enemy to determine who takes the first turn.
These systems are handled through called scripts, rather than being written directly into the battle scene.
Another script manages the turn system. It generates a random number to determine whether an attack hits or misses, compares player and enemy stats to calculate damage, subtracts the damage from the opponent's HP, and checks whether the opponent's HP has reached zero.
If the opponent is still alive, the turn switches. If HP reaches zero or below, dialogue appears stating the enemy has died and the script returns to the previous scene.

The problem is that when the scripts finish and the game returns to the overworld, the scene loads again from the beginning, so everything resets exactly as it was when the player first entered the Black Caverns entryway. The enemy sprite is still present.
I also tried resuming the previous scene from the stack, but the script still restarts from the beginning, which results in a never-ending loop where the player must keep defeating the same enemy.
At this point I am unsure how to proceed.
Any suggestions, comments, or advice would be greatly appreciated, especially from developers who have experience with GB Studio RPG systems.
If you have any questions about how my systems are structured, I would be happy to provide any additional details.




