[DSCSSN] Adding the Unit Cannon

Discussion in 'Mod Discussions' started by stuart98, June 23, 2014.

  1. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    Firstly, we really need a rigged unit cannon in order to do anything as the model lacks bones. Next, we need to decide which type of UC we want.
    Factory will be easier to do but less functional.
    "Load N' Shoot" will be harder to do, maybe not even possible with our current tools, but more functional.

    If we do factory, then we need to create a factory that is able to build all land units. Easy enough. Bones should define where they are made, although I suggest somewhere inside of the model. It should have a very high metal consumption and fairly low energy consumption with a high cost. In order to make the units be shot somewhere upon completion, the following code should be used:
    Code:
        "deploy_projectile": "path",
    The deplay projectile should be staged.
    Code:
      "flight_type": "Staged",
    Example stage code from the orbital rocket:
    Code:
      "stages": [
        {
          "ignores_LOS": true,
          "ignores_gravity": true,
          "rotates_to_velocity": true,
          "stage_duration": 300,
          "stage_turn_rate": 0
        },
        {
          "climb_angle": 45,
          "ignores_LOS": true,
          "ignores_gravity": true,
          "rotates_to_velocity": true,
          "stage_change_height": 200,
          "stage_duration": 0,
          "stage_turn_rate": 90
        },
        {
          "apply_thrust": false,
          "climb_angle": 45,
          "ignores_LOS": false,
          "ignores_gravity": false,
          "rotates_to_velocity": true,
          "stage_duration": 1000
        },
        {
          "apply_thrust": false,
          "die_here": true,
          "ignores_LOS": false,
          "ignores_gravity": false,
          "release_payload": true,
          "rotates_to_velocity": true,
          "stage_duration": 0
        }
      ],
    The important part is the section that tells it to die, which I believe is when the projectile is destroyed and the unit is released.
    This should be all it takes to make a factory based unit cannon.

    For it to be a "load and shoot" style unit that loads units and then shoots them, we would have to define a new type of usability. The teleporter has the following code dedicated to this:
    Code:
      "useable": {
        "range": 30,
        "type": "teleporter"
    I am not sure if there is other code somewhere that determines exactly what that type means, so if implementing this is possible at this point is unknown. If anyone knows any further information on this matter, I would appreciate it.

    Thoughts?
  2. liquius

    liquius Well-Known Member

    Messages:
    731
    Likes Received:
    482
    The problem I see is that I think you misinterpreted the stage system (key word being "think"). If you can only control the stage duration then getting the unit to deploy at the right time at any range would be impossible.

    Another way of saying it is that it works for orbital because the orbital layer is at a set height above the ground layer.
  3. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    But you can set rally points for the orbital launcher where the rocket could take the unit to just above the launcher or it could take it halfway around the planet. I'm not sure, but I hypothesize that the second stage with a duration of 0 is sort of an "infinite until it reaches its destination" stage. If someone from Uber could help us out, that'd be great!
  4. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,357
    Honestly I'd suggest just waiting for the unit cannon to be completed by Uber. :p
  5. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    Ye have little faith.
  6. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Maybe make a git repo so that we can take a crack at it.
  7. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    I've begun doing so on Statera. You can take a look.
  8. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    Apparently Uber changed how orbital factory rally points worked recently. Never play orbital so didn't notice. I'll be needing old code in that case. I've already pmed @raevn about it, but if anyone could supply me with some code from mid-beta (about November of 2013 or build 56821) for the orbital launcher and the orbital missile booster I'd be grateful.

    This is actually the last hurdle remaining before I can implement and factory based UC. That and getting a model for the delivery system.
  9. mered4

    mered4 Post Master General

    Messages:
    4,083
    Likes Received:
    3,149
    To get a load-and-shoot UC, stuart, I think you'll need access to the core engine coding so you can add in the physics functionality as well as the background support necessary.

    I'm interested to see where this goes - and hopefully Uber gets the UC done SOON.
  10. JesterMalone

    JesterMalone New Member

    Messages:
    9
    Likes Received:
    3
    I’d ask about the main goal here. If it’s just to get a working UC in the game to prove it can be done so UBER will build it then I’d suggest pirating another unit model. I am new to the modding but I’d like to get into it so forgive any ignorance in my suggestions here.

    If you took say the Holkin unit, and added to it the functionality of say the transport or the astreus, so that you could load units into it. What it fires is a single use pod (a spike) that say has a 12 unit capacity. The UC fires the pod (planet to planet) and either you skip the orbital path entirely and just spawn the pod after a certain duration or you pull the astreus or orbital fighter pathing for the move to send the pod/spike over.

    Then call the shell for when a commander spawns at the beginning of the game and have the pod slam down into the planet, cause a minor area of effect damage (and ideally a small stun state on any units or turrets in the area) and then the spike automatically unloads the units and decays into a reclaimable shell.

    Of course you’d have to change the shot duration for the UC (holkin) so it takes longer to load and shoot. But this unit could actually serve two purposes. Orbital artillery would be a dream to play with, and this UC could serve as both a slow firing, minimal damage but large area, orbital cannon as well as a unit cannon.

    Imagine a stack of bomb bots stuffed in a round shot from such a UC. Having the umbrella system, as well as any anti air weapon able to attack the rounds would probably be ideal for balancing.

    However, having to retreat a base due to shelling from another planet adds another layer to strategy.

    I’m fully in support of your mod here. I’d like to try out anything you have.


    Cheers,

    Jester
  11. philoscience

    philoscience Post Master General

    Messages:
    1,022
    Likes Received:
    1,048
    Wouldn't it be far easier to create a new class of units that are built regularly but act as orbital units (i.e. can be sent between planets)?
    optimi likes this.
  12. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Loading the unit into the factory is only one of two problems.

    The other one is aiming.

    "factory"->"deploy_projectile" creates a projectile with an unit attached and launches it.
    "tools"[]->"ammo_id" creates a projectile which gets it's target from the corresponding tool.

    First one has no target set, and can only go straight in the direction of the spawn bone.
    Second one has no unit attached to the projectile.

    Right now, it's impossible to have a unit canon both launch AND aim a unit.


    Well ok, probably not true. And I already DO have an idea how to hack it in ;)
    First, we must assume that "release_payload" also works for non-staged projectiles. If it doesn't, we are screwed.

    Now we have to create a "TOOL_Weapon" on the unit canon with an invisible, 0-damage projectile which has the same ballistic properties as the unit cannon shell. The aim-bone of the weapon is the same as "factory"->"spawn_points".
    Now the bone will orientate itself in the precise direction required to shoot a ballistic projectile with the specific properties at the location marked with the attack command. When the unit is shot from the same bone, it should travel the precise same course and land in the target location.

    Anyone dares to try?

    Well, there are problems, of course. There is no target selection system which could enforce VALID targets. You might as well target unreachable or completely invalid locations with the unit canon.

    And it's probably going to be rather inaccurate, because even "ballistic" projectiles have "turn_rate" set which is probably used for course correction on long shots. So if no target is passed down from the "TOOL_Weapon", it's probably going to miss.
    Last edited: August 26, 2014

Share This Page