Skater effects on other players: costume and board trails, and contact sparks and dust

Other players' skaters and skateboards showed none of the game's skater
effects: not the trail or fire a costume or deck comes with, and not the
sparks, dust and puffs of a skater touching the world.

Costume and skateboard effects. The game gives another player's skater and
skateboard the right effect sets by itself, but builds them before their
outfit is on, so nothing showed. They are now built again half a second after
the outfit is applied. An always-on effect that a skater's item puts on the
skateboard's wheel joints (the Ghost Skater trail) follows the skater's own
copy of those joints, which only this player's skater keeps up to date: for
other players it is taken out of the skater's sets and built on their
skateboard, which has the same joints.

Contact effects. They come from a skater touching the world, which only
happens in that player's own game. Each game now captures its skater's
contacts (position, velocity, surface normal, surface material) and sends up
to three a tick in a new unreliable packet, PacketKind::effects. Other games
play each through the game's own function, so the effect is still chosen from
the surface and the speed. A contact is shown as late as that player's poses
are, only within 30 m of their skater, and only for a material the level's
table has: the game reads that table without a bound.

Server. A dedicated server relays effects packets to players within 150 m of
the sender, at most one packet a tick from each player. New setting
players.sync_effects (default true), console and admin command
"effects on|off". Off: the server relays none, and the roster tells games
neither to send their contacts nor to build other players' costume and
skateboard effects. Player-hosted lobbies relay through the host and always
share them.

The roster carries one more byte for the setting. Still protocol 45, which
has not been released.

New console command "mp effects": what has been captured and played, and why
the last contact was refused if one was.
This commit is contained in:
AyeZeeBB committed 2026-10-09 00:10:11 -05:00
1 parent 574860da72
commit b229062400
23 files changed
+763 -9

No files matched your search

+10 -2
View File
@@ -1,6 +1,7 @@
#include "session_internal.h"
#include "Extension/Multiplayer/Remote/native_cosmetics.h"
#include "Extension/Multiplayer/Remote/native_audio.h"
#include "Extension/Multiplayer/Remote/native_vfx.h"
#include "Extension/Profile/local_profile_runtime.h"
#include "Extension/Objects/network_object_runtime.h"
#include "Extension/Multiplayer/Net/wire_codec.h"
@@ -317,7 +318,8 @@ void broadcast(Session &s, const Packet &packet, bool reliable, bool fresh, std:
std::vector<Outgoing> outgoing;
unsigned direct_sent{};
const bool gameplay = packet.kind == PacketKind::pose || packet.kind == PacketKind::audio ||
packet.kind == PacketKind::voice || packet.kind == PacketKind::cosmetics;
packet.kind == PacketKind::voice || packet.kind == PacketKind::cosmetics ||
packet.kind == PacketKind::effects;
for (auto &p : active_peers(s)) {
if (!p.handshaken || p.member.id == except ||
(s.mode == Mode::host && gameplay && !p.world_ready) ||
@@ -325,7 +327,7 @@ void broadcast(Session &s, const Packet &packet, bool reliable, bool fresh, std:
continue;
// Chat and throwdown messages always travel through the host, which relays
// them once to everyone else; a direct copy as well would deliver them twice.
if ((packet.kind == PacketKind::chat || packet.kind == PacketKind::throwdown) && s.mode == Mode::join &&
if ((packet.kind == PacketKind::chat || packet.kind == PacketKind::throwdown || packet.kind == PacketKind::effects) && s.mode == Mode::join &&
p.member.id != s.host_id)
continue;
if (packet.kind == PacketKind::voice) {
@@ -714,6 +716,12 @@ void send_local(Session &s, const NativeFrame &local, std::uint64_t now, std::ui
}
deliver(a, std::any_of(a.audio.begin(), a.audio.end(), [](const auto &sample) { return sample.event; }), true);
}
// This skater's contacts with the world, for the sparks and dust others see on it.
if (auto impacts = drain_impacts(); !impacts.empty() && s.sync_effects) {
auto e = packet(s, PacketKind::effects, now);
e.impacts = std::move(impacts);
deliver(e, false, true);
}
}
} // namespace session_detail
} // namespace dingosdk::multiplayer