Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Techno attachment logic #352

Draft
wants to merge 107 commits into
base: develop
Choose a base branch
from
Draft

Techno attachment logic #352

wants to merge 107 commits into from

Conversation

Metadorius
Copy link
Member

@Metadorius Metadorius commented Aug 29, 2021

  • Technos now can be attached one to another in a tree like way. The attached units won't process any locomotion code and act like a part of a parent unit in a configurable.
    • Currently the attached techno may only be a vehicle.
    • When attached, the special Attachment ({C5D54B98-8C98-4275-8CE4-EF75CB0CBE3E}) locomotor is automatically casted on a unit. You may also specify it in the child unit types manually if the unit is not intended to move without a parent (f. ex. a turret).

In rulesmd.ini:

[AttachmentTypes]
0=MNT                                 ; (example)

[MNT]
RespawnAtCreation=true                ; boolean
RespawnDelay=-1                       ; integer, non-negative values enable the respawn timer
InheritOwner=true                     ; boolean, whether the child inherits owner of the parent while it's attached
InheritStateEffects=true              ; boolean (state effects = chaos, iron curtain etc.)
InheritCommands=true                  ; boolean
InheritCommands.StopCommand=true      ; boolean
InheritCommands.DeployCommand=true    ; boolean
LowSelectionPriority=true             ; boolean, whether the child is low priority while attached
YSortPosition=default                 ; Attachment YSort position enumeration - default|underparent|overparent
InheritDestruction=true               ; boolean
InheritHeightStatus=true              ; boolean, whether the layer and InAir/OnGround/IsSurfaced inherited from parent
OccupiesCell=true                     ; boolean
DestructionWeapon.Child=              ; WeaponType, detonated on child when parent is destroyed
DestructionWeapon.Parent=             ; WeaponType, detonated on parent when child is destroyed
ParentDestructionMission=             ; MissionType, queued to child when parent is destroyed
ParentDetachmentMission=              ; MissionType, queued to child when it's detached from parent

[SOMETECHNO]                          ; TechnoTypeClass
; used when this techno is attached
AttachmentTopLayerMinHeight=          ; integer
AttachmentUndergroundLayerMaxHeight=  ; integer
; used for attaching other technos
AttachmentX.Type=MNT                  ; AttachmentType (example)
AttachmentX.TechnoType=               ; TechnoType that can be attached, currently only units are supported
AttachmentX.FLH=0,0,0                 ; integer - Forward, Lateral, Height
AttachmentX.IsOnTurret=false          ; boolean
AttachmentX.RotationAdjust=0          ; rotation in DirType, from -255 to 255

[General]
AttachmentTopLayerMinHeight=500           ; integer,
AttachmentUndergroundLayerMaxHeight=-256  ; integer
  • The semantic locomotor alias feature is also supported for Phobos locomotors.
Alias CLSID
Attachment {C5D54B98-8C98-4275-8CE4-EF75CB0CBE3E}

@Metadorius Metadorius added New / Enhanced Logic Significant stuff that wasn't present in engine and needs to be coded from scratch Major Big stuff to do labels Aug 29, 2021
@Metadorius Metadorius self-assigned this Aug 29, 2021
@Metadorius
Copy link
Member Author

Metadorius commented Aug 29, 2021

ok yet another TODO with current things to finish

  • Handling different locomotors being attached
    • TunnelLoco currently leaves the initial place as if it was left there, crashes the game on destruction
    • Jumpjets stay invincible when attached
    • Review the possibility of adding a custom attachment locomotor instead of a locomotor + skipping Loco process code and changing to it and back
    • loosely related - turret is rendered wrong for TunnelLocoClass when going up
  • Sync up the phasing in state for Teleport locomotor
  • IsOnTurret is broken visually
  • Shadows need to be fixed too
  • Latest build crashes on release/devbuild but not on debug when children is yeeted, most likely some piggybacking refcount screwery
  • Jumpjets crash improperly when they are crashable=yes and destroyed with children destruction
  • Handle placing the detached children into the correct place (they are not centered at the cell or the correct position for inf atm)
  • Add a flag to force same mission and target to attachments (piss easy, probably 6 lines in total), shouldn't be mixed with commandability
  • Make attached units untargetable and non-damageable using regular weapons via a tag
  • Check AI shenanigans
  • Make attached units unselectable (transparent to selection) via a tag
  • Make attached units be transparent for pathfinding and building placement but still targetable and damageable
  • Handle movement command issued with command inheritance enabled (i.e. optionally reset targets like vanilla units do). possibly just reset the mission when movement command is given and recursed into children instead of doing nothing for that command
  • The source of destruction on parent unit specifically appears to be null for cargo (and consequently the children), see 0x7384AB which later calls Kill_Cargo. Needs context and/or earlier Kill_Cargo/On_Destroyed call
  • Rotation adjustment tag
  • Non-omnifire units without turret rotate and snap back even though the code, test if still happens
  • Units now could clip into each other for some reason sometimes, need to review the passability hook again to see what changed
  • When ordering a vehicle with attachments that offset the "center of mass" to move arrives at offset cell
  • ConsideredAircraft still crashes when combined with AttachmentLocomotion, something related to AircraftTracker
  • Attachment loco does not provide sensors or sight currently
  • Sort out speed=0 while being attached interaction (may just block speed=0 features if attached) and review similar hooks with Techno Attachment
  • Investigate Per_Cell_Process for useful stuff for TA
  • Check interaction with cloak inheritance and other state effect inheritance
  • Improve scatter when something tries to enter the cell on cell-occupying attached technos to make the parent scatter instead
  • Weird bug when cell stays semi-occupied after the children gets destoyed with parent on that cell? might be related to RotE's husks
  • Implement handling of deploy
  • Implement handling of conversion
  • Implement building upgrades support
  • Implement children appearing/disappearing on buildup end (or selldown start)
  • Fix bugged loading of unrelated units into transport when multiple units are on cell
  • AttachmentX.IsOnBarrel
  • Units still clip into each other sometimes (unconfirmed)

Known issues:

  • The attachment jitter when they are offset from the 0,0,0 point. This is most likely a precision issue that is impossible to fix without a lot of code to draw the voxel relative to the main point and canvas enlargement. Prototype code exists but commented out and a bit outdated due to locomotors, it needs further work.
  • Shadows currently don't behave like parts of the same unit (aka being on one single plane). If that's undesirable - disable children shadows and make shadows via main unit VXL (maybe shadow section hack with transparent voxels).
  • Sight may be hacky as it abuses the in-air sight timer, might need testing, especially with height changes.

@github-actions

This comment was marked as outdated.

@Metadorius
Copy link
Member Author

Q: How do I make turrets that don't act like a separate unit? (can't be targeted, destroyed, don't have health)
A: Use HealthBar.Hide, Selectable and a custom armor type with some HP that is destroyed with DestructionWeapon.Child.

@Metadorius

This comment was marked as outdated.

@Metadorius
Copy link
Member Author

<none> on *Weapons doesn't work.

@Talafhah1
Copy link

chrono:
on parent: works but only children in the sw range actually teleport with the parent, rest get stuck in limbo; they die once the parent dies or is sent to a grinder
on child: doenst have any effect

ic:
on parent: works; affects all children too
on child: no effect

chaos:
on parent: colours all children but only parents and children in range of the weap are affected, sometimes children who are really far away (3k leptons) are affected too even tho the weap only has a range and cell spread of 1
on children: only affects children in range of the weap, they dont get coloured tho, and they seem to target themselves

temporal weaps:
parent: targeting affects all children, stopping the attack makes them stuck in place, if u target them with a temporal weap then stop the go back to being attached like normally, if u kill the parent the game crashes
child: gets stuck in place, stopping the atk returns the child to the parent like youd expect

@4SGX
Copy link
Contributor

4SGX commented Aug 29, 2021

BuildingTypes have several bugs.

Attached BuildingTypes keep their anims when removed from the map if deployed and BuildingTypes attached to a movable techno will be placed at the position the parent was created until the parent techno deploys or is destroyed. Chronosphere-ing a unit with attached BuildingTypes will also rarely create impassible/unbuildable terrain when the parent deploys/is destroyed.
Video

Having a child techno be important to the game ending (e.g. being the last building) the game will simply not end when destroyed.

@gangster-ppm
Copy link

Attach passanger to a projectiles:

  • Magnetron pulls its target, absorbs, then launches it away with inviso V3
  • RA3 Bullfrogs

@4SGX
Copy link
Contributor

4SGX commented Sep 4, 2021

Crash on having attached base destroyed and continuing-despite-short-game-on bug I mentioned earlier then creating a new attached building. Code, video, and snapshot in link below.
https://discord.com/channels/338055131666972683/773636942775582720/883466977761435668

@FS-21
Copy link
Contributor

FS-21 commented Sep 4, 2021

Wish:
Could all units (master & attached) optionally share Ammo=?

Implement ParentDestructionMission & ParentDetachmentMission


"Fixed" chronowarping children

Add children skip for ChronoWarp

Rewritten and fixed a hook


Loop over attachment AI separately from other AI routines
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member Author

  • Implemented sight and sensors support. Sight may be hacky as it abuses the in-air sight timer, might need testing, especially with height changes.
  • Improved scatter when something tries to enter the cell on cell-occupying attached technos to make the parent scatter instead.
  • Found a weird bug when cell stays semi-occupied after the children gets destoyed with parent on that cell, although this might be related to RotE's husks and not this feature. Needs verification.

@github-actions
Copy link

github-actions bot commented Sep 9, 2023

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Kn-geSponge
Copy link

The collisions are a little broken, they need to be fixed.
I’m posting a video to make it clearer.
-!!MR..NK

vid_muted.mp4

@Kn-geSponge
Copy link

compiled-dll-57594129a99096552a449eace1ffdf3527bd27ac.zip

Nightly build for this pull request:

* [compiled-dll-57594129a99096552a449eace1ffdf3527bd27ac.zip](https://nightly.link/Phobos-developers/Phobos/actions/artifacts/913163876.zip)
  These artifacts will expire in 90 days and will not be available for download after that time.

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Copy link

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member Author

Metadorius commented May 5, 2024

Transports appear to be fixed. When the build finishes please test if anything that is linked with loading up passengers (initial passengers, reinforcements w/ paradrop etc) is broken.

Copy link

github-actions bot commented May 5, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@mevitar
Copy link

mevitar commented May 7, 2024

The collisions are a little broken, they need to be fixed. I’m posting a video to make it clearer.

I just had an instance of this happening in the newest build, except for the "walker" locomotor. I'll see if i can trigger it again.

@mevitar
Copy link

mevitar commented May 9, 2024

Yup, it definitely happens. Can't really get it to trigger when just moving units, but if they are moving and then they try to attack, then they might walk right on top of eachother trying to get in attack range.

@Multfinite
Copy link

With @Metadorius we found bug with Speed=0 with attachments.
At least, if attach can not fire while parent can (different ranges) in this case attachment will keep the last target.
Need to add in each places which hadnles Speed=0 check for Techno to test is it attachment chlid or not.

@mevitar
Copy link

mevitar commented Aug 16, 2024

I just had an instance of this happening in the newest build, except for the "walker" locomotor. I'll see if i can trigger it again.

Good news, this might not be a Phobos or this build issue, as i managed to get it with just Ares alone. Bad news, that probably means that the walker locomotor is unsafe to use...

Copy link

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Copy link

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Major Big stuff to do Needs testing New / Enhanced Logic Significant stuff that wasn't present in engine and needs to be coded from scratch
Projects
None yet
Development

Successfully merging this pull request may close these issues.