Skip to main content
GameDev.net gamedev.net
🔒 Locked

How would I create create items/weapons in an MVC architecture?

Started by RipFish Jul 7 at 3:22 AM 0 replies 250+ views
Original Post
RipFish
RipFish

I am creating a game in Roblox Studio and I was recently recommended the MVC/MVCS architecture (or at least an adapted version) as somewhat of a sane way to organize my codebase, and to easily add new features, and for most things it has been working quite well. However, I need to create various weapons/items in my game and this doesn't seem to work so well in MVC, or at least I am not sure how to make it work.

The first issue is even if I create WeaponModel, WeaponController, and WeaponView, it doesn't address or solve how I'd actually have different weapons. However, the solution to this seems to be having a registry/definitions and then doing WeaponModel.new(weapondata).

The next and main issue is that I have ranged, melee, bombs, healing items, etc. They all do different things. There is likely going to be some overlap, like they all need to play sounds, animations, VFX, etc which I assume would be part of the views responsibility., but it's all different the model, view, controller would have branching paths for each weapon, and I just know that isn't right, but I don't know how else I'd do it. I have been considering the strategy pattern although I am not quite sure how I'd make that work.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.