Skip to content

WebMap 連携: アドオンの位置・姿勢を中継に使う機能と、関連する表示・設定の追加 - #1

Open
sk7z-xyz wants to merge 14 commits into
shairo:mainfrom
sk7z-xyz:main
Open

sk7z-xyz wants to merge 14 commits into
shairo:mainfrom
sk7z-xyz:main

Conversation

@sk7z-xyz

Copy link
Copy Markdown

概要

WebMap(Stormworks のアドオン・WebMapBridge・StormWorksMapViewer)と組み合わせて使う機能を追加しました。
WebMap を使っていない環境では、これまでと同じように動きます(アドオンからの情報が IPC で届いたときだけ働きます)。

連携の全体像は webmap-連携.md に、変更点は CHANGELOG.md にまとめています。

追加した機能

同期改善(relay)

  • WebMap アドオンの位置・姿勢を中継の情報源に使う(IPC addon.poses)
    • WebMapBridge から 3 tick ごとに全車両の位置・姿勢が届きます。近くにプレイヤーがいない車両も含むので、サーバー自身の記録が粗い車両でも中継できます。
    • アドオンの tick と世界の tick の対応は自動で見つけます。アドオンを読み込み直したとき(世代 ep が変わったとき)は対応をやり直し、遅れて届いた古い束は捨てます。
  • 車両の種類ごとに、アドオンの位置を使うかを選べる(IPC addon.kinds)
    • 種類は MapViewer の Type です。設定 addonMissile addonShip addonTank addonSub addonAir addonOther で切り替えます。
    • 既定はミサイルだけ有効です(ほかの種類はまだ確かめていないため)。種類の一覧が一度も届いていない間は、これまで通りすべての車両に使います。
  • fake_missile(煙だけの車両)を、追従先のミサイルや船の位置に見せる
    • アドオンが送る al(追従)・fk(待機)・pk(船の下で待機)に従います。アドオンの送信が途絶えたら指示を外します。

実験機能

  • 砲塔・砲の向きを、アドオンが読んだ実際の向きに合わせる(試作)
    • MapViewer で Type が Tank の車両だけが対象です。
    • 全体の許可は設定 bodySync(既定 1、管理者が止めたいときは 0)です。そのうえで、各プレイヤーがゲームのチャットの ?bs on / ?bs off で自分の分だけ切り替えます(既定 OFF、保存しません)。
    • 戦車が多いとアドオン側の getVehiclePos の呼び出しが増え、TPS が下がります(止まった戦車 10 両で約 65 → 約 57)。

表示

  • GUI に「WebMap」タブを追加しました(WebMap補正の切り替え、アドオンの状態、種類ごとのチェック、砲塔・砲の同期)。WebMap補正のボタンとアドオンの状態は「状態」タブからここへ移しています。
  • GUI と swctl status に、プレイヤーごとの Steam P2P の経路(直接 / 中継)と、車両ごとの届け方(pass / relay / addon / fake)を表示するようにしました。

開発者向け

  • IPC に addon.poses・addon.kinds を追加し、status に addon{…} を追加しました(ipc-protocol.md に記載)。SWHOOK_IPC_PROTOCOL は変えていません。
  • サーバーのタグ 0x68 / 0x69 / 0x6A / 0x84(野生の魚など、物の種類)を読めるようにしました(rec.h、tools/swcap)。
  • tools/rectest/test_bodies.cpp と tools/swdump に、砲塔・砲の記録を確かめる処理を追加しました。
  • フォーク側で足していた開発用の IPC(debug.clone・debug.orbit・debug.bodyoff)と、座席のホットキー 6 で砲を回す処理は消しました。元からある debug.hold・debug.nudge・mutate.set・?unstuck は触っていません。

設定の追加(swhook.ini)

設定 既定 内容
addonPoses 1 アドオンの位置・姿勢を中継に使う
addonMissile 1 ミサイルに使う
addonShip addonTank addonSub addonAir addonOther 0 それぞれの種類に使う(未検証のため既定は無効)
bodySync 1 砲塔・砲の同期を許可する(各プレイヤーが ?bs on にしたときだけ働く)

確かめたこと

  • build.bat でビルドし、ゲームサーバーに注入して動作を確かめました(種類ごとの切り替え、?bs on による砲塔の同期)。
  • WebMap を使わない環境(アドオンからの IPC が無い状態)では、これまでと同じ動きになることを前提に作っています。

気になる点・相談したいこと

  • 砲塔・砲の同期は試作です。不要であれば bodySync の既定を 0 にするか、この部分だけ外すこともできます。
  • 版番号は変えていません。リリースの際に決めていただければと思います。

よろしくお願いします。

sk7z-xyz and others added 14 commits November 8, 2026 05:16
Fixed lengths 52/8/38/52, pinned with swcap lens/solve on
session_20261108_045606_169 (walk 67.2% -> 100%). The 2026-09 legacy
captures rise from 76-93% to 99.8-100%; append-sim bad stays 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- addon.h: vehicle poses from the Stormworks addon over IPC as an extra
  relay source (addon.poses)
- alias ("al"): show fake F at target T, snap on start/end, trail 5 m behind
- standby ("fk"): un-aliased fakes shown 500 m below their real pose
- last-promise cache so a new alias jumps in the next send
- park ("pk"): fakes mirrored 300 m below a ship until it launches
- stats: alias/standby/park counters; GUI shows addon sync state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matched session_20261108_045606_169 against the save's <wildlife><fish>
entries: same uid range and counter, same area at y ~ -5, 0x6A carries
target_heading plus jump_timer 180 / out_of_water_timer 2000, 0x68 carries
fish_type (15, 37), heading and scale 1.0. 0x68 spawn, 0x69 remove,
0x6A state, 0x84 pose. swcap notes now print uid / fish_type / heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ass / relay / WebMap / fake)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- addon.poses may carry "ep" (WebMapBridge). A new ep restarts the offset
  estimation; within one ep a batch whose tc went back arrived late and is
  dropped instead of resetting the offset. Without ep the old rule stays.
- The fake_missile alias / standby / park lists are dropped when no batch came
  for `stale` ticks (the Bridge or the addon stopped).
- status: staleBatches, epChanges, fakeExpired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The addon sends the pose of the gun / turret bodies of Tank vehicles (vpos
"bp"); the relay measures each body's offset against the native 0x81 and
writes those bodies into the records it sends.

- Far records: pass 1 / pass 2 fill the type-2 slots, appended records
  turn type-0 slots into type 2.
- Near records: a type-0 body whose true angle differs from what that
  client was last shown by more than 0.01 deg is sent as type 2, so small
  gun nudges reach the client.
- Per player: `?bs` shows, `?bs on` / `?bs off` sets the rewrite for that
  player alone (default off). bodySync stays the server-wide switch.
  `?multisync` and `swctl status` (bodies.players) show the state.
- qangle_deg uses atan2 (acos lost ~0.05 deg near zero).
- debug.bodyoff and seat hotkey 6 nudge a body for experiments.
- tools/rectest/test_bodies.cpp, tools/swdump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the IPC experiments added in this fork (debug.clone, debug.orbit,
debug.bodyoff) and the seat hotkey 6 gun nudge (key_step). Debug tools from
upstream (debug.hold, debug.nudge, mutate.set, ?unstuck) stay.

Add webmap-連携.md: how the WebMap addon, WebMapBridge and MapViewer feed
MultiSync (vpos -> addon.poses, peers.get -> adc, tank_vehicles, bp, ?bs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot switch)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…poses

IPC addon.kinds (MapViewer Type via WebMapBridge) gates the addon ->
body0 source per kind: addonMissile (default 1), addonShip, addonTank,
addonSub, addonAir, addonOther (default 0, not verified yet). Until the
first list arrives every vehicle is fed as before. Turning a kind off
drops its addon-fed poses at once. bodySync now defaults to 1 (master
switch; players still opt in with ?bs on). The GUI gets a WebMap tab with
the WebMap correction button, the addon status and the checkboxes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on off, budget)

- bodysync.peer IPC command: the same per-player switch as ?bs on/off,
  so the CLI and other tools can reach it (control-plane rule).
- A release snap counts as a write, so a message whose only change is the
  snap is sent instead of discarded.
- Turning addonPoses off drops addon-fed poses at once (same sweep as the
  per-kind gate; also run on config.set / config.reload).
- Charge the bandwidth budget with the final record length after
  body_build has grown the turret / gun slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n unload

Codex review on PR #1:
- Pass 1 shortened the ETA of records whose body0 is not type 1 while fill_pose left the
  pose untouched. Such records now pass through (protocol/sync.md) and are marked handled.
- A fake unloaded by a client (0x2C) kept its snapped state, so on reload it glided to the
  target. Reset snapped / sentEta and the standby mark for that (peer, fake).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat: WebMap addon feed, fake_missile, turret sync and per-kind gate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant