Class System In Abeyance–Update

I’ve not posted much Abeyance stuff and to be fair, I was away in Germany last week and this week my brain has literally been fried. Some of the stuff I was working on in Dark Basic Pro was experimentation leading up to the code I’d be using in Abeyance to implement my classes and in the process I have made update to skills and items (due to discovering a more convenient method).

In theory, I could have as many classes as I’d like without changing any code in C#.


See, I can just define everything inside of the editor. Keats’ Class is also listed there, his current class will be set to whatever the string ‘Class’ says. The default is Whisperer. But in mid battle whilst testing I could change this and everything would adapt.


Current stats are set to ‘Whisperer’. But in editor all I have to do is type a different class.


And automatically the player data changes to that specific class. I am not going to implement a system where the player can change class, but this demonstrates a much more sensible way of handling classes. Also, lets say I wanted to add a new class?


No changes to code were necessary.In fact, all of these screenshots were all taken from the same test run and we made whilst debugging. See, this is what I love about Unity3D – I can write my code to make as much use of the editor as I need.

So what about the code? Essentially I am using a class in C#, previously I was using structs, but you can’t get a struct to show in the editor, but you can get a class to if you use this command:


It goes before you create the class:

  public class Classes
      public string name;
       public string magic1;
       public string magic2;
       public string skill;
       public string weapon;
       public string armor;
       public float HP;
       public float MP;
       public float Speed;
       public float STR;
       public float VIT;
       public float MND;
       public float DEL;
       public float DEX;
      public float AGI;

In DBP it’s like using UDTs.

With having the ability to level up in game, I can’t have set the HP, MP and so on from just within the class. Instead I use a base stat. You’ll notice above the Demoniser class had ‘24hp’ but Keats actually has ‘120hp’. It’s because I use that ‘24’ as part of a calculation to get the player’s final stat, which scales as the player levels up.

So how has this affected my inventory & abilities. With the ability to use a class inside of the editor it means I can throw my old system out of the window, the DBP version of that system can be found here Like with the classes I can just define all of these variables from within the editor and not compile anything.

image. image

So with this system, how would make class specific abilities? I haven’t implemented this system yet, but you’ll notice in each class/path, there’s Magic1 and Magic2, this would work nicely as a place holder for creating different types of spells. In Abeyance there’s only 2 types of ‘magic’ and that’s Neuro and Psycho and they’re hardwired into every class/path. However, each class has a set of exclusive ‘Neuro’ and ‘Psycho’, so I can still take advantage of ‘Magic1’ and ‘Magic2’ to give categories for exclusive spells, these would have to match with a spell’s particular school. Why have I done it as “Magic1’” and “Magic2”? It’d make the code re-useable for future projects without change. For now the school is just defaulted ‘neuro’ or ‘psycho’. But in actuality for ‘Shadower’ I might have magic1 as “shadow” and magic2 as “darkblade” and Mindjolt’s school could be ‘shadow’. So when Keats’ Neuro list appears as a Shadower it’ll show Mindjolt, but no other class could see it unless there’s another class with ‘shadow’ as magic1. The advantage here is that you could actually mix and match some classes – for example 2 classes might share the same Neuro attacks but have different Psycho attacks. And should I introduce a new class I could easily set up a new series of spells without coding or recompiling.

What about animation? I can just add 1 extra line of code in my class and have my animation code use that line to grab the animation from that line of code. Simple.Thank Satan for Object Orientated Programming.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s