Difficulty Implementation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By slyyy

If I would like to implement different difficulty levels such as Easy, Medium, Hard in a game. How do I do that?

Do I need to create a scene for each difficulty?

:bust_in_silhouette: Reply From: timothybrentwood

This completely depends on what kind of game you’re making. In chess you would let the computer calculate more moves ahead before making a move. In a FPS you might make weapons spawn more rarely, health packs heal less, ammo crates replenish less ammo and have more units per level.

In the chess scenario, you wouldn’t need to create an entirely different scene per difficulty, you would just need to adjust the variable in charge of the number of moves a computer can calculate before moving.

In the FPS scenario you might need to do a combination of both: adjust the variables related to weapon spawn odds, health pack healing, and ammo crate replenishing AND create a new scene with more enemies. You could get around making a new scene by creating spawners for your enemies and adjusting the amount of enemies spawned from a spawner per difficulty though.

Ultimately it’s up to you as a designer to determine what best fits your game.

What are the requirements of needing to add a new scene?

Lets say I’m making a guessing card game where you have to click on a card that matches the one that is shown previously. If difficulty would differ in terms of the amount of card and the variety of pictures shown in the cards, which category would it fall to? The chess or the FPS?

slyyy | 2021-05-06 18:57

There aren’t any strict requirements in my opinion. It’s more how you structure your game. Like in Resident Evil additional healing items and ammo will spawn at lower difficulties. I could see them creating an item spawn location for all items in one master scene then turning off certain item spawn locations using a Dictionary at higher difficulties. Another way to handle that would be to duplicate the scene and don’t include certain item spawn locations.

It could be either. If you’re creating a tailored experience, where you progress through levels, you’d probably want to create different level scenes per difficulty. If you’re trying to create a randomized feel, you could use just use one scene and alter variables:

const card_types = [star, square, circle, triangle, hexagon, smiley, frownie]
var available_card_types = []
var time_to_solve = 5

func set_difficulty(parameters : Dictionary)
    time_to_solve = parameters.get("time_limit")
    solve_timer.wait_time = time_to_solve
    var num_card_types = parameters.get("number_of_types")
    available_card_types = card_types.slice(0, num_card_types)

timothybrentwood | 2021-05-06 19:42