This conversation took place on the Project Spark forum, recovered from The Wayback Machine
Date: 4 May 2016
OP: The sh0tgun d0g: Hi everyone I’m still new to spark only been on for about a month never knew it existed till then, wish I had discovered it sooner considering how much I could have done by now. Anyways I’m trying to create a game with strongly similar battle system to games such as star ocean, tales of games, radiata stories, etc. Essentially a RPG but instead of random battle encounters I’m trying to have when player bumps an enemy on the world map take it to the battle scene for the actual fight. I’ve played around with it and watched a couple videos here and there mainly referred to mescad battle scene vid but it’s only gotten me so far since I’m going for a different system. Anyone think they have a solution or advice?
Kohldar: Having at least played Star Ocean, I have a few ideas of the logical process you’d want to perhaps start with.
1. Running around the overworld, you run into an enemy
2. Battle scene is created, enemies populated, party members arranged into scene
3. Both teams fight to the death, when one side is wiped out, they are the victor resulting in a either game over or rewards screen
So, to get started, I highly recommend taking this modules of Kode, because you will likely be tweaking a lot of things. Secondly, you will also need a “battle scene” for enemies and the party to be spawned into. The koding is a bit lengthy, so I’ll be summarizing some of the things you may want to consider:
1. When you bump into an enemy, flip a global Boolean value to signal that you are in a Battle state. Use another logic cube to handle all the conditions of this Boolean being flipped (ex. Music, brain enabling/disabling) I generally use a multi-brain approach and disable the players movement channels so they can’t move around while the battle parameters are being loaded.
2. Determine your enemy loadout and where they will be spawned on the battlefield. I would recommend using perhaps a single loadout parameter here and as you hammer out details, you should be able to add more when it is stable.
3. Determine where your party members will be loaded into the battle scene and enable their combat/movement abilities. We obviously don’t want them to be able to use combat abilities outside of the battle scene.
4. When enemies are loaded in, be sure to add them to an object set as well as the party. The purpose of the object set is to determine battle win conditions. For instance, when a party member is KIA, a for each statement may look through this object set to see if the player has been defeated. Same goes for the enemies.
5. When an enemy is killed, there should be some form of RNG that determines whether or not an item was found, but this would be loaded into the Rewards section of the battle scene. THat way, the player is rewarded with their loot upon defeating the enemy.
I had several different projects at one point that had very similar koding that was very reminiscent of what you’re going for. The only other advice I could give is to break everything up into states and work your way down through the sub-states. Example:
1. When the player is running around the Overworld (this is the default state)
a. In this state, the player’s movement controls are enabled
2. When the player has encountered an enemy (Battle state)
a. In addition to movement controls, battle controls are also enabled
3. When the player is in a cutscene (Dialogue state)
a. Movement controls are disabled
4. When the player is in a menu
a. Movement controls are disabled, menu controls enabled
You can kind of see where I’m going with this, but that’s the basic idea. Lots of organization is needed when taking on any RPG project. The Kode is by far some of the lengthiest Kode you’ll encounter, but if you stick with it and develop good koding habits, its no different than any other project. Best of luck!