Skip to content

Techno attachment logic #352

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

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

Techno attachment logic #352

wants to merge 125 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}

TODO:

  • 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, 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)
  • Shadow scale on children of jumpjets is incorrect
  • Units with attachment at 0, 0, 0 can't exit War Factory once again for some reason despite the handling code existing and working previously

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.

@Metadorius Metadorius added ❓New feature Major Big stuff to do labels Aug 29, 2021
@Metadorius Metadorius self-assigned this Aug 29, 2021
@Metadorius

This comment was marked as outdated.

@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
Copy link

github-actions bot commented Feb 4, 2025

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 Metadorius added the ⚙️T2 T2 maintainer review is sufficient label Feb 20, 2025
@ZivDero ZivDero force-pushed the feature/techno-attachment branch from 09d84bd to e38b338 Compare March 7, 2025 16:41
Copy link

github-actions bot commented Mar 7, 2025

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

github-actions bot commented Mar 9, 2025

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

github-actions bot commented Mar 9, 2025

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 Mar 9, 2025

  • Infantry not being able to enter cells that contain multiple objects have been fixed. I am not sure if the implementation has side effects though; PLEASE test whether infantry can still enter transports, just vehicles (pilots/hijackers), buildings correctly like before and when there are multiple units on the cell (can be achieved via attachment).
  • Fixed casemate units still being able to erratically turn when attached, credits to @ZivDero.
  • Fixed residual occupations caused by an improperly ported Ares fix that I had to touch.

TY @ZivDero for help with a lot of those.

@SCIPCION
Copy link

first vehicle hasnt any TA.
Second one uses TA, cant leave the factory

Desktop.28-04-2025.6-21-54.AM.mp4

@SCIPCION
Copy link

SCIPCION commented Jun 6, 2025

After months constantly using TA and making one of my factions totally dependent of TA, i need to ask for some requested features:

-If child techno die also parent will die, the child object as the main unit is usefull in many scenarios.
-Child and parent sharing Streng.
-TA doesnt follow parent IsTilted=no
-VirtualUnit=yes this is a kratos feature, making the child completely invisible or not interactive is not possible only with vanilla codes
-Child and parent needs to share missions, or at least sleep/stop missions

@Metadorius
Copy link
Member Author

almost all of the requested features are planned, but I currently lack motivation/capacity to work on almost any programming stuff. sorry :(

@NetsuNegi
Copy link
Contributor

almost all of the requested features are planned, but I currently lack motivation/capacity to work on almost any programming stuff. sorry :(

maybe I can help with VirtualUnit

@Metadorius
Copy link
Member Author

would be appreciated. also check out the todo list on the second post

@Starkku Starkku force-pushed the develop branch 2 times, most recently from b429215 to 280b1c8 Compare June 29, 2025 19:13
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 feature ⚙️T2 T2 maintainer review is sufficient
Projects
None yet
Development

Successfully merging this pull request may close these issues.