- Home /
How to implement a party creation system?
I would like to implement in my game a party creation system like those seen in old rpg games like Wizardry 8 or Might and Magic 6/7/10. I'm not talking about skin customization, i will just give some sprite and voice choice for that. I want to make a party creation in which the player can set the stats, starting skills, race and class of 2 or more characters and instantiate those characters in one single body with multiple health bars.
i've learned how to make a character creation screen and how to save the character ready to get in the game, but i cannot find indications on how to manage multiple characters the same way for one single player body.
Is someone aware of a method? or maybe a link to a tutorial. Thanks in advance!
Answer by pauldarius98 · Feb 24, 2021 at 08:02 PM
You could use inheritance. For example, you could start from this:
public abstract class CharacterClass
{
public abstract ISkill startingSkill { get; }
public abstract Race race { get; }
public abstract float MaxHealth { get; }
}
public class Wizzard : CharacterClass
{
public override float MaxHealth => 50;
public override ISkill startingSkill => FireBall;
public override Race race => SomeRace;
}
public class Archer : CharacterClass
{
public override float MaxHealth => 50;
public override ISkill startingSkill => ArrowsRain;
public override Race race => SomeOtherRace;
}
You define a base abstract class with the fields that you want to have and then you create derrived classes which represent the actual character types. Then, in the body you have an CharacterClass which can be changed to any derived simply trough refference (like below)
public class Body
{
public CharacterClass currentClass;
public void ChangeClass(CharacterClass newClass)
{
currentClass = newClass;
}
}
public class Test
{
Body body = new Body();
body.ChangeClass(new Wizzard()); //Now you have a wizzard
body.ChangeClass(new Archer()); //Now you have an archer
}
This is just a small example to give you an idea of how you could implement. I suggest you to take a look at Inheritance, Composition, Interfaces (very usefull for Skills for example) and Abstract classes
Answer by Nekrell · Feb 24, 2021 at 11:09 PM
Thank you very much! it will help a lot! But i'm going to keep the question open to more answers to come, in case someone can suggest some more ideas about managing a party of characters during and after the creation.
Your answer
Follow this Question
Related Questions
Caracter customization 1 Answer
How can I change character? 0 Answers
Unity networking create & join with custom character?, 0 Answers
Character Creation Screen 2 Answers
Should I have a root bone? 0 Answers