This tower system was created back in April 2023 by myself for the popular Roblox game “Ghost Simulator” during my time as the lead developer there.
The system comes in one main script which holds all of the server-side logic, from matchmaking players, handling the sequential gameplay logic, rewarding players, listening and reacting to events, and much more.
The Invasion event was part of Ghost Simulator’s Easter 2023 event, in which players were able to participate in an Invasion minigame which was cycled through with other core, permanent minigames that Ghost Simulator offers. Players would be able to enter into the event, in which they were teleported to a specially designed map for the event. The invasion system had 3 main difficulties (small, medium & large).
These difficulties would determine how many waves of ghosts to spawn, as well as the values determined for things such as ghost health, time to kill, etc. Players had to defend 3 wardstones, which essentially represented the health pool for the event. If players were able to defeat all the waves before the time ran out, and without losing any of their wardstones, then they won the event. Anything else would result in a loss. Players would receive rewards for winning the event, as well as for how many wardstones that were left alive.
I also implemented a relatively crude logging system for the event which I had originally planned to use internally during the testing phase of the event. I later decided to leave it in as part of the event due to the little logging that would realistically take place over the course of a server’s lifetime. In the end, this actually proved to be extremely useful in diagnosing any problems that may have arisen for the duration of the event, as well as gathering statistical and analytical information for general maintenance, rebalancing and future content.
There was a complimentary second script which was used for this event, consisting of a number of client functions which would be used here and there. Due to the relatively simplistic nature of the code in said script and the short length, I opted to not include it here; however you can see references to it in the main script as noted by calls to ClientModuleEvent
which effectively tells the client to run code defined in a module script.
This system was written in the Luau scripting language, a derivation of Lua, which is what Roblox experiences are programmed in. As of posting this, there isn’t support for this language on Github, and so all code will be represented as Lua code. As such, there may be inconsistencies with syntax highlighting when representing features of Luau that are not supported in the native Lua language.
This system can be seen in action here: https://www.youtube.com/watch?v=44fvIGAHZ-8
The code for this system can be seen here: