How would I implement game modes for my round-based game?

I want to know how would I implement game modes for my game, like for an example: “Selected map: ABC, Game Mode: Classic” or “Selected map: ABC, Game Mode: Mutations”, and different things happen in a round yk.
How would I able to achieve that? I’m not an inexperienced developer but neither a professional one, im still trying, and currently my biggest problem is (also what caused this problem) me cannot be creating complex logics, like I can do 1+1 = 2 but I can’t do 1+1*1 = 2 (weird example I know). I would like to know how to implement such thing but also the best way to get over this problem.

Note: The only topic I could’ve find was advising me to use “promises” and I don’t really want to get into that level of complexity, but if you guys also advice me to learn how to use promises I probably would have to anyway.

You can use different functions for handling rounds like this:

local function main() : ()
    while true do
        intermission()

        local map = chooseMap()

        local gamemode = chooseGamemode()
        if gamemode == "classic" then
            gamemodeClassic()
        elseif gamemode == "mutations" then
            gamemodeMutations()
        end
    end
end
main()

Psuedocode example that can be tidied up or adjusted however, but that’s how I’ve done it in past projects; it’s simple and gets the job done

1 Like

You could probably use module scripts for each game mode where you implement logic for each mode and load them from a script based on a vote.

Maps can be clonedfrom replicated storage and parented to workspace. I also recommend using a module script with functions for copying maps and deleting old ones.

You can have the main game logic in a server script whilst keeping everything organised and running the map and gamemode choice from a modulescript

Make a folder for maps and a folder for moduleScripts which will have the logic for different gamemodes. After that’s all setup just get the children of each folder and choose a random one from each folder.

1 Like

a better idea would be a table of functions like this

local gamemodes = {
           ["Deathmatch"] = function()
                  print("Deathmatch gamemode starting!")
           end
}
2 Likes

That works as well, I wrote my example the way I did for readability

1 Like