Basic architecture and organization

Hey everyone,

my question is a bit wide, not really precise, so sorry if there is no clear answer for you guys.

So here is the thing. I am creating a “customizer”. Basically, the player drags weapons in a ship, then use them in game.
Weapons can level up, and be improved in the game.

So my question is: how would you start? How would you organize your scripts and stats from the customizer to the battle, manage a large amount of variables, etc.

I know the question is kina tricky, so thanks in advance just for reading :wink:

Cheers,

Hi, feydfeyd.
I would make it in this way:

As for me, if I have to manage a lot of variables, I’m using xml insted scrupt with a lot public variables on prefab.
So, for customizer level, data loads from shop.xml

shop.xml will be like this:

<items>
  <item type="weapon" prefab="railgun", id="1". sortorder="1"/>
 <item type="close" prefab="bighat", id="243". sortorder="2"/>
</items>

I gues no need to explain the purpose of the variables and how to use them.

After player has applied some close and weapons. We will save his choise to PlayerPrefs
something like this:

PlayerPrefs.SetInt("acriveWepond", ChoisedWeaponID)

Then on game scene load we will load acriveWepond ID and applay stats form weapons.xml

weapons.xml example:

<weapons>
  <weapon range="200" dmg="500" splash="30" speed="200"   prefab="railgun", id="1"/>
  <weapon range="100" dmg="2500" splash="300"  speed="2"  prefab="shotgun", id="2"/>
</weapons>

Hope it helps

I know PlayerPrefs indeed.
This + xml files sounds like a good solution.

So on your shop, you store all the variables, then to a specific slot, you apply the stats of the selected weapon, then save it as a PlayerPrefs, and finally load it in the fight level?
Something like this right?

Thanks a lot
Cheers

Yes.
shop.xml for customizer scene, with it help you should load your shop comtent, and models.
On customizer scene, when player whear weapon or close, you will save slot and weapon/close id.
Then on fight level, from Player Prefs you will get slot’s and appropriate weapon/close id. Fromons weapons.xml you will get model’s and stats for your character. And this is it.