#[closed] Suggestions for futureproofing a data-driven Weapon System

1 messages · Page 1 of 1 (latest)

steel sleet
#

I just keep running into situations where I need to rewrite/refactor sections of my base weapon classes, at which point I have to go through and fix every single one of them. This is becoming more of a problem as I implement more weapons that are less similar.

Here's what I'm working with already. The Weapon constructor just contains some variables that ANY weapon in my game would need to have to work with the UI and such. The SMG constructor is my base gun class. The Shotgun constructor is an example of a weapon implemented from the base SMG class. I feel like this constructor setup is a little unwieldy and just wrong, but the more important issue is just adopting a system that will let me make all kinds of wacky weapons while abstracting as much code as possible.

I'm curious if anyone has any suggestions since I'm entering the content-development phase of my project and it would be good to not need to rewrite all my weapons later.

river venture
#

shout out to iota

#

this looks ... fine?

river venture
#

yeah not sure what feedback you're looking for. what's the friction you're running into?

steel sleet
#

love iota

#

i’ve just had some issues with implementing some weapons (for example, a gun that shoots on both sides of the player and a gun that needs to charge before firing) that i’ve had to do rewrites for and just was wondering if there way to design around that

solemn stratus
#

coming from someone who has written and re-written a few weapon systems - just try and brainstorm all the functionality you'll need. also see if you can use some functionality for more uses - for example, if your shotgun code can shoot out 3 bullets in a spread, you can change the angle between the bullets to 180 degrees so that the other bullet is coming out behind the player

#

i've been an advocate of a constructor base system in the past (vid i made for gm: https://www.youtube.com/watch?v=-1vXQ-eTVsE). this has pretty much everything you'd need (i think) apart from the charge gun functionality

#

i'm not necessarily saying you should do it that way, but with enough forward thinking, i think its a good system

#

on my personal channel i've been experimenting a bit with storing data like this in a google sheet instead of in constructors. it kind of runs into the same problem where everytime you need to add a new variable to the gun, you need to update the data, the constructor, and wherever you're accessing the constructor

steel sleet
#

yeah im just gonna do another look over the code and come up with some more weapon ideas to add some more spots to inject functionality. im probably not gonna rewrite the weapons into objects but i might implement them as structs instead of constructors