- Home /
Effects architecture akin to Starcraft 2
Link to Reddit, if you want to see what others proposed
Hello, ladies and gentlemen.
Context : I'm a student in game design, making a game for my master's degree.
I worked alone for the first year, doing pre-production things and a small prototype. And in october I'll start the second year, where more people will work with me on the project (namely game designers, and a bunch of graphists and concept artists), all students in the same school.
The problem is that most of them probably don't know C#, but it will be the language I'll use (well, I'll probably be the only programmer).
So, I started to make some ScriptableObjects and things to allow non-programmers to actually contribute to the production without having to do anything in C#.
I started by doing something akin to StarCraft 2's Effects system used in the map editor : as an example, a simple grenade would be a Launch Missile effect, that on impact would make a Search Area effect to take all valid entities in an area around the impact point, and apply on those entities a Damage effect.
I made my EffectBase (ScriptableObject), whom which every other effect type will inherit. This EffectBase have a virtual function called ApplyEffect wihch will do everything the effect is supposed to do.
And of course I have some troubles. Wouldn't be real programmation if there wasn't any trouble, right ?
First, the targeting. In StarCraft, an effect has a specific targeting parameter, taken from a list. The most common are Source Unit, Source Point, Target Unit and Target Point.
I have my Entity script to act as a replacement for Unit, an enum to choose what kind of targeting this effect should have, but I have no idea how to do it. Using all 4 as parameters in the ApplyEffect function ? But what would happen if one of them was null ?Sub-part of that, how about effect that have a predefined targeting by design ? For example, it would make no sense for the Damage effect to target a point. It will always be an Entity. Should I make 2 enums, one for Source/Target and the other for Point/Entity, and hide or show in the inspector whatever is relevant depending on the effect ?
Lesser problem : for all the Area of Effect subtypes (namely conic, rectangular and spherical), I'm using either OverlapSphere or OverlapBox. Those functions are perfect for the job, and return a Collider array.
Is there a quick way to get all Entities from this Collider array, or am I forced to do a loop through all the Colliders ?
That's all for now, I'll edit to add/remove things if necessary.
Thanks in advance for any help you could give !