So now that I have the basic content organized, I guess I do a bit of explaining as to how exactly the ‘modular’ part of the system is designed.
Basically instead of having a unique properties file (OPR in GameCore-speak) for each weapon as a whole, the system is broken up into literally dozens of different OPR / properties files that are compiled together on load (and eventually configured at runtime).
So the weapon directory structure looks like this:
- weapons
– attachments
– materials
– models
The attachment’s directory has all of the assorted models & opr files for the attachments. Each attachment is loaded & setup with it’s own properties (OPR) file.
The models directory is what will store each of the base weapons themselves (such as the M4 and the SCAR), and also contains a special OPR file that I’ve simply called ‘modularweapons.opr’.
I guess it probably would be simpler to just show you how things are structured:
What I’m doing (as you can see from the image above) is using a little-known trick in GameCore that allows you to ‘nest’ OPR properties files. This allows me to modularize each of the components into their own little sub-system and compile them into the primary weapons systems on load.
As you can see from the above image, the modularweapons.opr file loads each of the attachments as seperate OPR files, and does some basic configuration of which attachment is visible or not (via the EditObject property).
Then all I need to do in the main weapon properties file (m4a1.opr in the example) is load the modular weapons properties file and it all just magically works ;}
Each attachment (such as the flashlight.opr in the image) can have their own properties (such as a light) or whatever (remapping textures if necessary, although I’m trying to go out of my way to make sure that all of the objects load without any warnings), and then for each additional weapon that I create, I just load up the modular weapons system and the attachments get added to the parent.
This way I can keep adding new attachments to the modular weapons system and all of the various weapons that use the attachments will update themselves automatically the next time they are loaded by the engine.
Pretty cool, no?
Related posts:
