Best way to make round based games?

Hello, I am working on a game called Left behind it is actually a story game, but this is for PVP mode, the problem is… How to make a round based system?

  1. Map changing.
  2. How should the interval look like when they are not in game?
  3. Reviving
  4. How should it look like when they are not in game?

This might be better in Game Design Support – this forum’s more for specific questions about scripting.

1 Like

Fixed

Cool. So general outline then:

  1. Map changing.
  • Build your maps as single models
  • Put them in a folder in ServerStorage
  • Have a script that, every X seconds, deletes the map currently in workspace, chooses one randomly from the folder, and copies it into the workspace
  1. How should the interval look like when they are not in game?
  • Up to you - you could have a lobby which is far away from the map and teleport people between it and the map when they’re not playing. You could also delete their character and have a spectator system or something.
  1. Reviving
  • No idea what you mean
  1. How should it look like when they are not in game?
  • See 2
1 Like

Reviving = Revive players that are downed
1 the game has a several problem = Terrain maps.

1 Like

Good info here: How do I make a map changer for terrain maps?

See crazyman32’s plugin, especially.

As for reviving, I dunno - you’d have to implement your own health system or just don’t kill characters whose health is below a certain %. Then when a friendly player comes over to them give em a button prompt that refills their health.

2 Likes

For reviving, I would say make the weapons only drop them to 1 health so it looks like it’s just about gone.

1 Like

It might be good to look into minigame systems as a basis for how to construct a round system since minigames are also split into rounds and thus follow the same principles as any other round game. Ideally you’ll have an intermission before selecting a map in whichever way you want, put the players in the map and then allow the round to run before stopping it and repeating the cycle.

Map changing is as simple as parenting or destroying maps you want to use or don’t want to use for the current round. The selection process as well will depend on how you want to select a map. If you have terrain built for a map, then use the CopyRegion and PasteRegion of Terrain to help and Clear when you’re also removing the map parts themselves. Best to split it into folders or use a model.

Interval’s also your own choice. Often at times for a round-based game, those who are not currently playing will be forced into spectate mode for the players who are currently alive. This allows them to watch what’s unraveling and have a spectacle to observe while not playing.

Reviving’s up to you. You can either use a fake health system (not directly use the Humanoid while doing damage), or a mix of both Humanoid and custom health management. For example, to make sure the Humanoid stays alive, make sure their health stays above at least 0.01 and treat any numbers lower than 1 as pseudo-dead. You can then decrease a timer or something before they fully die and reviving would put their health somewhere above 1, thus reversing the aforementioned pseudo-death.

Crude code example:

-- Any changes to Humanoid.Health will call this function. When revive timer
-- is out, set health to 0 and change will be registered. If time is not
-- out, change will be ignored and Health will go to 0.01.
Humanoid.HealthChanged:Connect(function (newHealth)
    if (newHealth < 1) and not (reviveTimerIsOut) then
        Humanoid.Health = 0.01
    end
end)
1 Like

Thanks! This will help me a lot! But how to make the intermission to regen when one team fully dies?

That’ll come down to the way you manage the round loop. You’re going to have a for or while statement to control the round depending on which one is most applicable to your case and that loop is going to be responsible for, say, counting down time. That timer needs to go until it hits zero, so using any keywords or conditions for the loop, you can fine tune the round.

-- 1:
local roundShouldStop = false

while not roundShouldStop do
    something()
end

-- 2:
local roundShouldStop = false

while true do
    if roundShouldStop then
        roundShouldStop = false
        break
    end

    something()
end

-- 3:
local ROUND_TIME_MAX = 300
local roundShouldStop = false

for i = ROUND_TIME_MAX, 0, -1 do
    if roundShouldStop then
        break
    end

    possiblySomething()
end

You may want to scavenge for open source round-based games that can help you with this, if any are available. Most of them have their rounds run for the full length but some games end their times prematurely due to meeting conditions such as a survivor team all dying.

Okay… But stop when one team dies?

Same response is still applicable. That all comes down to how you want to set up such a system. For example: if you change the team of players from an alive team to a lobby team to signify that they’re dead, then you can simply check if the alive team has no players on it every round step.

Thanks, but how?

I’ve already told you how. It’s up to you to do your own research and testing from here on, using what I’ve said as advice or a starting line to help you build the system. I’m not going to be spoonfeeding you any code or exact answers - the explanation I gave should be sufficient for you to start putting in your own effort to make the system. :slightly_smiling_face:

1 Like

Thank you soo much!
–30chars–