Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions rust/crates/aaemu-game/PORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,24 @@ is no longer mirrored (see "Known deviations", dead NPC returned and healed).
fabricated. RedeemBuff's second and third value slots (the damage / cap slots of other special
actions), recipe/account/cinema placeholders, several other special actions and generic
Anchor/Flowgraph still need authoritative behavior or protocol evidence. Passing covered tests does not certify every data-defined skill.
* systems::skills (2026-10-27, `check_obstacle`): the C# tree had no obstacle check at all
(`git show a2ab80abd^:AAEmu.Game/Models/Game/Skills/Skill.cs`), but the 1.2 skills data has
the retail column. The 1.2 client is the oracle (`x2game_unpacked.dll`; Ghidra `aa12u`):
`FUN_390B5540` calls `RayWorldIntersection(Game)` with objtypes **7** (static + sleeping rigid
+ rigid), or **0x107** when `check_terrain` is set, ray flags **0x2048F** (colltype-any,
collision class 2, ignore back faces, pierceability 15) and one hit; a hit maps to skill
result 0xC (`skill_obstacle`). `FUN_390B5650` shortens the end point by the target radius and
casts no ray when `distance <= radius`. Unit targets (`FUN_390B5C60` -> `FUN_3989C0D0`) run at
unit position height and skip the source and target colliders; position (ground) targets
(`FUN_390B5A30` -> `FUN_390B5790`) use the constant 0.5 (`DAT_3999C47C`) and skip only the
source. The former Rust ray was 1 m above both ends, used static+terrain (0x101) and the
default collision class, and had no radius gate; it rejected ground-anchored doodad
interactions through nearby doodad colliders (entrance doodad template 3674 / skill 10999,
exit 4535 / skill 16560) and re-checked at fire time with the same wrong rule. Rejections are
logged at `warn` with character, skill, target and result key. The flow tests in
`cast_validation_tests.rs` cover the height/mask/class rule, the radius gate, the 0.5 m
position radius and the terrain gate. Not modelled: the multi-part target variant
`FUN_3989DAE0` (loops the target's sub-shapes and passes if any part passes).
* systems::skills: the labor margin requirement uses `GetMaxLabor(Payment.PremiumState)`; every
connection has the default C# `AccountPayment` (premium until 2030), so the cap is 5000.
* systems::skills (in-place resurrection, 2026-10-20): `CSResurrectCharacterPacket(in_place =
Expand Down
36 changes: 36 additions & 0 deletions rust/crates/aaemu-game/src/systems/ai/collision/flow_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,42 @@ async fn queries_and_doodad_colliders() {
assert!((g - 100.0).abs() < 1e-3);
}

#[tokio::test]
async fn unit_colliders_are_skippable_by_obj_id() {
let s = server(100.0);
let pw = super::phys_world(&s, 0).unwrap();
// A living proxy is stored under `living`, not `objects`: the ignore list must find it
// there, or a caster's or target's own collider can block its interaction ray.
pw.lock().sync_living(
7,
&super::data::LivingParams::default(),
Vec3::new(500.0, 500.0, 100.0),
);
let from = [495.0, 500.0, 100.5];
let to = [505.0, 500.0, 100.5];
let query = |ignored| {
super::raycast_ignoring_objects(
&s,
0,
from,
to,
super::query::mask::ALL_TERRAIN_WATER,
super::query::ray_flags::WZ_RAYCASTING,
ignored,
)
};
assert!(matches!(
query(&[]),
Some(Some(hit))
if hit.owner
== Some(Owner::Object {
kind: ObjKind::Unit,
obj_id: 7,
})
));
assert_eq!(query(&[(ObjKind::Unit, 7)]), Some(None));
}

#[tokio::test]
async fn zone_fall_gate_in_the_movement_path() {
// ground above the synthetic world's ocean level (100): no swimming
Expand Down
6 changes: 5 additions & 1 deletion rust/crates/aaemu-game/src/systems/ai/collision/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ pub fn raycast_ignoring_objects(
let mut st = pw.lock();
let skip: Vec<_> = ignored
.iter()
.filter_map(|key| st.objects.get(key).map(|c| c.ent))
.filter_map(|key| match key.0 {
// Living proxies are the units' colliders; they are not in `objects`.
world::ObjKind::Unit => st.living.get(&key.1).copied(),
_ => st.objects.get(key).map(|c| c.ent),
})
.collect();
Some(st.raycast(a, b, objtypes, flags, &skip))
}
Expand Down
6 changes: 6 additions & 0 deletions rust/crates/aaemu-game/src/systems/ai/collision/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ pub mod mask {
/// static + sleeping + rigid + terrain: unmount check `sub_3972C690`, building
/// `sub_398351E0`.
pub const SOLID_TERRAIN: u32 = 0x107;
/// static + sleeping + rigid: the 1.2 skill obstacle ray without `check_terrain`
/// (`FUN_390B5540`, `x2game.dll.c:149916`).
pub const SOLID: u32 = 0x007;
/// all entities + terrain: tornado `sub_3920FE10`, surface id `sub_394B6660`.
pub const ALL_TERRAIN: u32 = 0x11F;
/// all + terrain + water: `WZRayCasting` `sub_3936F340`.
Expand All @@ -34,6 +37,9 @@ pub mod mask {
pub mod ray_flags {
/// `rwi_stop_at_pierceable | rwi_ignore_back_faces` (0x8F): most x2game rays.
pub const DEFAULT: u32 = 0x8F;
/// Skill obstacle ray (`FUN_390B5540`, `x2game.dll.c:149930`): colltype-any with
/// collision class 2, ignore back faces, pierceability 15.
pub const SKILL_OBSTACLE: u32 = 0x0002_048F;
/// `WZRayCasting` (0xFFFE048F: colltype-any with every class but 0).
pub const WZ_RAYCASTING: u32 = 0xFFFE_048F;
}
Expand Down
Loading
Loading