← DashboardClara

Creating items/weapons in an MVC architecture?

r/gamedev · 2026-07-07 · status reviewed · open original ↗
Game development · 0.90

Summary · qwen2.5:32b

The developer is facing challenges implementing various game weapons/items using MVC architecture in Roblox Studio, as the standard model does not efficiently handle diverse weapon functionalities. The proposed solution involves creating a registry for weapon definitions and potentially utilizing the strategy pattern to manage different behaviors without cluttering the MVC structure. One concrete detail is the suggestion of using `WeaponModel.new(weapondata)` to instantiate different weapons based on predefined data.

Excerpt

<!-- SC_OFF --><div class="md"><p>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.</p> <p>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 <code>WeaponModel.new(weapondata)</code>.</p> <p>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 it's just going to be a mess. I am curious what can I do in this situation? I have been considering the strategy pattern although I am not quite sure how I'd make that work.</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/3dscartridge"> /u/3dscartridge </a> <br /> <span><a href="https://www.reddit.com/r/gamedev/comments/1uphjgz/creating_itemsweapons_in_an_mvc_architecture/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/gamedev/comments/1uphjgz/creating_itemsweapons_in_an_mvc_architecture/">[comments]</a></span>
Queues it; drafting in your voice happens locally on the 4090.

Draft a post in your voice

Runs locally on SAC-DSK-003 / qwen2.5:32b. Needs an active voice profile.