Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Core RPG System

Discussion in 'Editor & General Support' started by anwserman, Nov 10, 2012.

  1. anwserman


    Feb 13, 2012
    I've always wanted to develop an RPG over the years, but the one thing that has always caught me up is gameflow. Basically, all the programs I've made have been "Load Level -> Play Level -> Finish Level -> Load Level.... etc". However, RPG's are a completely different dynamic. They have a more intricate state-based world, with cutscenes and scripted events.

    I'm looking at various editors to make cutscenes, and hell scripting a cutscene would be fantastic. But I'm at a loss on how to string it all together. Such as, "Gameplay in free roaming world -> Cutscene -> Scripted battle". The *only* possible way I can think of this working is that there is a CoreClass that manages the loading and removal of scenes, as well as any variables needed during gameplay.

    Gameplay causes CoreClass to trigger event labeled "CutsceneA"
    CoreClass looks at event "CutsceneA", and loads the scene
    "CutsceneA" plays, at the end triggers CoreClass to trigger an event labeled "BattleA"
    "BattleA" plays out

    Throughout it all, each scene would interact with CoreClass, setting values and flags as needed, and uses it as an intermediary to do such (loading from one map to another could cause too many broken links that would need updating). Does this theory sound correct?

    That if CoreClass is cleared out, it means a new game has started. Shoot off to character creation, and then off to the first scene that starts the rest of the gameplay?...
  2. Dreamwriter


    Jul 22, 2011
    You're close - how you explain it might work. But here's how I personally would change it:

    CoreClass includes an RPG-script interpreter. Not a Unity script, but a simple scripting language you make up for your game, and the interpreter could be something as simple as a switch()/case if you want. So now, gameplay causes CoreClass to trigger RPG-script "ForestFight_A":

    PlayCutscene A
    StartBattle A
    SetQuest 2
    GoToMap Forest_A,3

    Each command plays and does its thing, and runs the next command when it's done. The SetQuest command just sets a variable that you can use to load up different layouts of the map contents if you want (for example, maybe when Forest_A is loaded on Quest 2, the guys you just defeated in battle are standing around so you can talk to them, and the path they were blocking in Quest 1 is now open). The GoToMap comand send you to map Forest_A, spawnpoint 3 (since the Battle loaded a different scene).

    Just an example of how I would do it.