mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 19:47:08 +02:00
Follow-ups to the trainer (PR 37), and one multiplayer change.
Off until asked for (Extension/Trainer)
- The jump read-out and the LB+RB controller shortcuts start off. Jumps
are logged only while the read-out or telemetry recording is on, and
trick launches only when the trainer scaled them. A saved trainer.json
keeps what the player chose.
Memory search on demand (trainer.cpp, trainer_classes.cpp)
- The search for the game's tuning classes reads all writable memory.
It ran for every player after a level loaded, and up to seven times
when it found nothing. It now runs only when a class value or the flip
speed is not the game's own (the player's, or a host's they skate
with) or the EVERYTHING list is open, and at most three times a level.
- For those players it runs again on each level, which brings fresh
copies; a search from an earlier level used to count as done.
Guests under enforced physics
- A guest is locked by the session's enforce setting, from the moment
of joining (Engine/Game/Multiplayer/session_physics.h), not by whether
the enforcement status text was set yet.
- A guest's class values no longer come back after a map change.
The host's whole setup reaches its guests (protocol 39)
- Only Gameplay/SkatePhysicsTuning travelled, so a host could push,
sprint or jump further than the guests it held to the game's own.
- New packet physics_extras (30): the host's class values, trick
multipliers and auto push (trainer_session.h), sent when they change
and to players who join later, taken from the host only. A dedicated
server's are the game's own and it ignores the packet.
- Under enforcement a guest's own trick multipliers stand down for the
host's, whatever the boosts switch says. With enforcement off nothing
changes.
- A guest refuses bytes that are not an encoding, holds values to the
trainer's own ranges, and leaves out class values written for another
game build's table.
- protocol_version 38 -> 39: released versions disconnect from a peer
that sends a packet they cannot decode.
Out-of-view players are posed every frame again (Session/session.cpp)
- Players outside the camera's view and past 8 m were sampled at 20 Hz
(b763631). The game's replays record each skater as it stood every
frame and their camera looks anywhere, so those players moved at
20 Hz in replays. Removed; the distance rule (20 Hz past 200 m, 10 Hz
past 350 m) stays. This gives back the client-tick time it saved on
busy servers.
42 lines
2.3 KiB
C++
42 lines
2.3 KiB
C++
#pragma once
|
|
// What the trainer changes outside Gameplay/SkatePhysicsTuning, as a session's host shares it
|
|
// with its guests: the tuning asset travels as the session's physics tuning already
|
|
// (Extension/Skater/physics_tuning.h); this is the rest, so that "the host's physics for
|
|
// everyone" means all of it. The bytes are the session's physics extras
|
|
// (Engine/Game/Multiplayer/session_physics.h). No game access: plain data in, plain data out.
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <span>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace dingosdk::trainer {
|
|
// What the trick multipliers may be, here and in the trainer's own options.
|
|
inline constexpr float height_low = 0.05f, height_high = 1.0e6f; // heights; the sliders stop far short, a typed number need not
|
|
inline constexpr float flip_low = 0.1f, flip_high = 3.0f; // board flip speed: the game's own limit takes over above
|
|
inline constexpr float cruise_high = 100.0f; // auto push, m/s
|
|
|
|
struct SessionExtras {
|
|
// x of the game's own: board flip speed, and the heights of the hippy jump, no comply,
|
|
// boneless and on-foot jump.
|
|
float flip_speed{1}, hippy_height{1}, nocomply_height{1}, boneless_height{1}, offboard_height{1};
|
|
// Auto push: the speed a rolling skater is carried up to, m/s; 0: off.
|
|
float cruise{};
|
|
// Values of the game's tuning classes that are not the game's own: an index into
|
|
// class_fields (trainer_classes.h) and the value, by ascending index.
|
|
std::vector<std::pair<std::uint16_t, float>> classes;
|
|
bool operator==(const SessionExtras &) const = default;
|
|
// Nothing differs from the game's own.
|
|
bool stock() const { return *this == SessionExtras{}; }
|
|
};
|
|
// Identifies the table of class fields the indices refer to (the game build's): a host and a
|
|
// guest whose tables differ share the multipliers only.
|
|
std::uint32_t class_table_id() noexcept;
|
|
// Nothing at all for extras that are the game's own.
|
|
std::vector<std::uint8_t> encode_session_extras(const SessionExtras &extras);
|
|
// A host's bytes: empty is the game's own; nullopt is not an encoding (also the game's own to
|
|
// whoever asks, and worth a log line). Multipliers are held to the ranges above, and class
|
|
// values written for another table are left out.
|
|
std::optional<SessionExtras> decode_session_extras(std::span<const std::uint8_t> bytes);
|
|
} // namespace dingosdk::trainer
|