# Skillcraft online ## How a cast goes 1. The owning client presses. The ability activates there at once (Local Predicted): the cost and the cooldown drop on that frame, the cast cue and the cast montage play. 2. When the cast time is over, the client aims (a trace from the pawn's eyes along its view) and sends the aim to the server as target data. 3. The server checks the aim. If it starts more than 250 cm away from where the server has the pawn, or claims a target farther than Range + 150 cm, the server uses its own aim. Then it lands the effects, spawns the projectile or the summon, or starts the channel. 4. A channel ticks and ends on the server, then tells the client. If the client ended it, its end would reach the server before the last tick and cut it. The server decides every landing. A modified client can press faster or aim anywhere, but it can't skip a cooldown, cast without paying, or hit something out of range. ## Projectiles With **Predict Projectile** on, the caster spawns its own copy of the projectile on the press. It flies and hits like the real one but lands nothing. The server's real projectile isn't sent to the caster's machine (it is not net relevant for that connection), so the caster never sees two. Every other player sees the server's. ## What was measured `Tools/net.ps1` runs a server and N clients with no window, with 75 ms of lag each way (150 ms round trip) and 5% of the packets lost. Each client casts six abilities in a row at its own target: Strike (instant, with cast and impact cues), Haste (buff on self), Firebolt (predicted projectile), Nova (area), Drain (4 ticks of channel) and Totem (summon). A passive gives 2 mana back on every cast. On every client, in every run: - each cast was predicted: cost and cooldown on the frame of the press; - the second press inside the cooldown was refused; - the own firebolt was on screen on the frame of the press, and never twice; - the cast cue played once (predicted, not repeated by the server) and the impact cue never played twice. GAS sends an executed cue as an unreliable multicast, so with 5% of the packets lost one can go missing on a client (2 of 12 clients in three runs of a listen server with 4): it's cosmetic, the damage, the cost and the cooldown always arrive. For an effect that must show, put the cue on a gameplay effect with a duration; - the totem showed up 0.2 to 0.4 s after the press; - the end matched the server: 42 mana (100 - 70 spent + 6 x 2 back) and 35 health on the target (100 - 10 - 20 - 15 - 4 x 5); - the component bound the 10 slot keys and the skill tree key on its own (21 bindings). The server landed 14 times per client. Runs: dedicated server with 2 clients, listen server with 4, with the ability system on the pawn and on the player state (Lyra style). All in the replication mode Mixed (what C++ projects set), and two of them again in Full (what a Blueprint project is left with, since the mode is C++ only): dedicated with 2 on the pawn and listen with 4 on the player state, same numbers. Lyra itself, with a dedicated server and a client: see `lyra.md`.