So I'm currently working on a rogue-like top-down game that features melee combat. Getting basic weapon stats like power, weight, and range is not a problem. I am, however, having a problem with coming up with a flexible and dynamic system to allow me to quickly create unique effects for the weapons. I want to essentially create a sort of API that is called when appropriate and gives whatever information is necessary (For example, I could opt to use methods called OnPlayerHit() or IfPlayerBleeding() to implement behavior for each weapon). The issue is, I've never actually made a system as flexible as this.
My current idea is to make a base abstract weapon class, and then have calls to all the methods when appropriate in there (OnPlayerHit() would be called whenever the player's health is subtracted from, for example). This would involve creating a sub-class for every weapon type and overriding each method to make sure the behavior works appropriately. This does not feel very efficient or clean at all. I was thinking of using interfaces to allow for the implementation of whatever "event" is needed (such as having an interface for OnPlayerAttack(), which would force the creation of a method that is called whenever the player attacks something).
Here's a couple unique weapon ideas I have:
Explosion sword: Create explosion in attack direction.
Cold sword: Chance to freeze enemies when they are hit.
Electric sword: On attack, electricity chains damage to nearby enemies.
I'm basically trying to create a sort of API that'll allow me to easily inherit from a base weapon class and add additional behaviors somehow. One thing to know is that I'm on Unity, and swapping the weapon object's weapon component whenever the weapon changes is not at all a good idea. I need some way to contain all this varying data in one Unity component that can contain a Weapon field to hold all this data. Any ideas?
I'm currently considering having a WeaponController class that can contain a Weapon class, which calls all the methods I use to create unique effects in the weapon (Such as OnPlayerAttack()) when appropriate.
I'm not a beginner per se, but I don't see an introduce yourself section, so I figured this was the best place for this.
I'm an Indie Game dev, I have had one finished game place well in a Jam and consider myself primarily a writer. I also have a YouTube channel where I review mostly game jam entries for the various game jams held throughout the year, but I enjoy playing all kinds of indie games regardless.
If you would like to see some of the games and jams I've covered, please feel free to check out my channel
Here's a link to my latest vid, this game was STELLAR
EDIT* I see now I should have put this in Announcements, sorry guys!
So I've decided to make a multiplayer mod for dark souls, the idea was to cut a lot out of the game and make a multiplayer 5v5 or 3v3 with Stat and Item presets so the player could just go in with out the steep learning curve.
I have no experience what so ever. But a lot of time and patience.
I'm kind of late to this party but I thought I would ask anyway as I haven't found a concrete answer.
When creating a game engine, when should you choose one methodology over another (more specifically OOP and DOD)?
Which areas benefit from DOD?
Which areas benefit from OOP?
Do people typically mix multiple methodologies throughout a project?
I.e. certain sub-systems created in one, and others in the another?
DOD - Data Oriented Design
OOP - Object Oriented Design