Quick Start

You can either evolve your own weapons in WeaponEvolutionScene or choose from 70 pre-configured weapons.


Table of contents

  1. Using pre-made weapons
  2. Evolving new weapons
  3. Creating ScriptableObjects for new weapons
  4. Using combined weapons

Using pre-made weapons

If you want to use one of the 70 pre-made weapons, follow these steps:

  1. Place the EvolutionAlgorithm.prefab and EvoSceneWeapon.prefab into your scene.

  2. Choose an instance of Weapon Params SO and drag it into the Weapon SO property of the EvoSceneWeapon in your scene. All instances of Weapon Params SO follow this name convention WP_<UniqueHash>. Use search to find them. picture

  3. Select the gameobject that will be the parent for the instantiated projectiles. Drag it into the Projectiles Parent Transform property of the EvoSceneWeapon in your scene.

  4. Press the play button.

Evolving new weapons

If you want to evolve your own weapons, follow these steps:

  1. Open WeaponEvolutionScene and press the play button.

  2. Find ScriptableObject EvoWeaponParams and use its inspector to adjust weapon parameters.

  3. Select good weapons using Select as parent for next get button in the EvoWeapon inspector. Press New Generation button.

  4. If you found the weapon you like, you can save it by clicking on Save button in the EvoWeapon inspector. The two files that represent the weapon will be created Genome_<UniqueHash>.xml and Params_<UniqueHash>.json. These files will be saved to the directory Resources\ProjectileGenomes\<UniqueHash>.

picture

EvoWeapon custom editor supports editing of multiple objects. If you select multiple EvoWeapons, Select as parent for next get and Save buttons would work correctly.

Creating ScriptableObjects for new weapons

Lets suppose you evolved and saved a lot of weapons, now you have a bunch of folders with Genome_<UniqueHash>.xml and Params_<UniqueHash>.json files inside. How to use them?

  1. You need to create WeaponParamsSO in every folder:
    1. Create WeaponParamsSO:
      1. RightClick on the folder in project view
      2. Create –> ScriptableObjects –> WeaponParamsSO
    2. Copy and Paste the created WeaponParamsSO into every folder
  2. Search for “WP” within the Resources\ProjectileGenomes folder

  3. Select all of them and press Load files from folder button in the inspector (press it twice if Rename option is checked). Then press Load button. picture

  4. Now you can use these new weapons. See Using pre-made weapons.

Using combined weapons

Combined weapon is a weapon with moving or rotating coordinate systems. 10 combined weapons are available. Follow these steps to use them:

  1. Place the EvolutionAlgorithm.prefab and EvoSceneWeapon.prefab into your scene.

  2. Choose a combined weapon from the CombinedWeapon script. Let’s choose #8. Copy and paste the contents of the Fire8 method into EvoWeapon script and override the Fire method of EvoWeapon. (Or you can just copy and paste the code below into the EvoWeapon script)
    public override IEnumerator Fire() {
       _shotsCount = 0;
       while (true) {
             yield return Fire8();
       }
    }
    
    // based on WP#43
    private int _shotsCount;
    public IEnumerator Fire8() {
       _weaponParamsLocal.SpeedRange = new Vector2(2f, 5f);
       _weaponParamsLocal.NNControlDistance = 1.2f;
       _weaponParamsLocal.ProjectilesInOneShot = 12;
          
       base.FireMultiShot();
       yield return new WaitForSeconds(0.5f);
          
       var system = CoordinateSystems.Last();
       system.IsRotating = true;
       system.RotatingSpeed = 120f;
       system.RotationAcc = _shotsCount % 2 == 0 ? 80f : -80f;
    
       system.IsMoving = true;
       system.MoveSpeed = 6f;
       system.MoveAcc = 10f;
       system.Direction = ProjectileSpawnPoint.up;
          
       _shotsCount += 1;
    }
    
  3. Find the WP_7621C6D0 and drag it into the Weapon SO property of the EvoSceneWeapon in your scene.

  4. Select the gameobject that will be the parent for the instantiated projectiles. Drag it into the Projectiles Parent Transform property of the EvoSceneWeapon in your scene.

  5. Press the play button. picture

Back to top

Page last modified: Jun 25 2024 at 02:51 AM.