Need help implementing game modes

Hello all!

I’m not a great programmer, but I know that if I have any questions I should consult the API or come here, but I’m not great at thinking of how to go about coding something. And therein lies my issue: I don’t know where to start in implementing game modes/different objectives to my game.

I’ve looked all over YouTube and online hoping to find something but I can’t find anything that is more conceptual and less tied to existing framework. I suppose I could watch or read through these resources and then find ways of implementing their ideas, but I don’t think I would learn much. I certainly wouldn’t learn how to adopt the right mindset I think is necessary for laying out the broad strokes in this area (something I would very much like to know more about) or which implementations of these systems is the most efficient.

The long and short of it is that I have a rogue-like which will assign a random objective upon entering a zone. That much I do know how to go about coding. But it’s integrating all the different “modes of play” that I can’t seem to figure out how to go about doing. My initial ideas are as follows:

  • Eliminate

  • Terminate a target and/or clear the zone of all enemies before you are allowed to continue

  • (I have a good idea on this one, but it still ties into my initial problem of adding it to the list that the picker has)

  • Secure Item

  • Find a specific item (a key or code) to allow the player access to the next zone.

  • Survive

  • The player(s) must survive for the allotted time and/or eliminate all the enemies that are in their way (the enemies would come in waves that increase in difficulty)

  • (A way I find interesting is having the waves on a timer, so as to avoid the COD: Zombies strategy of killing all but one so the player(s) can regroup before the next wave; again, this I can do given some time, but I need help with how this should be set up with a modePicker)

I feel I’m knowledgeable enough to have these modes implemented on their own, but the modePicker system itself is what I’m not sure how to do. There are loading breaks in gameplay when moving from one zone to the next, and that’s clearly where the system would be working, but how should that system be implemented, and how would it go about doing this?

I’d love to get some guidance (not necessarily hand-holding, but certainly some pointing in the theoretical right direction). Any and all help is greatly appreciated. I’d like to give you all thanks in advance, and if anything is unclear, I’d be happy to elaborate!

TL;DR - I have a game that needs a system to pick different game modes for the various zones but I have no idea how to go about creating something like this. I can explain the game further if needed, but I’ve tried to include (what I believe are) the necessities.

Many thanks and much love!

So you know how to implement game modes themselves, but don’t know how to plug that into your current game flow control? Separate it via interface. On start instantiate appopriate class and pass in to your game flow control system. Let the flow ask the mode if game completed, whon wins, and what actions should be taken on this. That’s it.

That would work for the multiplayer side of things. But I’m curious how I would approach this during the singleplayer/coop portion. The player(s) are meant to go through the zones to finish the final boss at the end of the level, but each zone would have a different objective. I’d like to find the best way of tracking whether or not the objective(s) are completed and how to pick and start the next set for the next zone. Perhaps I’m misunderstanding you. Combining different systems in this way is new to me.

This will work for single/coop too, why not?. Imagine

interface IGameMode {
  public bool CheckGameover();
}

public CoopGameMode : MoonoBehaviour, IGameMode {
  public LevelZones[] zonesToComplete;
  public bool CheckGameover() {
    return zonesToComplete.All(zone => zone.passed);
  }
}

And suddenly it all makes sense! Would it be best to have the modes in the same script or have this one simply be the controller? And thank you!

That’s up to you how you organize it. I prefer to have any single type in separate file, but it just my personal preference.