View Full Version : Concept: Improving spectator quality

08-15-2012, 02:38 AM
The following post is a quote of a concept I introduced in another community a long time ago:

I've been looking at the code and spectating in first person mode lately.
As you have seen, when spectating, rotation is not replicated from server in a precise way, explanation below.

Rotator is made up of 3 integer components named Pitch, Yaw, Roll.
Though they can have any value any 32 bit signed integer have, there are only 65536 unique operational values for each

component, (65536 = 0 in terms of orientation and so on).
When transmitting rotators through Unreal's replication system, the components are compressed ( [>> 8], then [& 0xFF] ) into

8 bit unsigned integers, which go from 0 to 255 (256 combinations).

The main purpose of this was to obviously save bandwidth by converting a 12 byte struct into a 3 byte one, at the expense of


Ok, then how do our shots hit where we're aiming at if rotation is compressed during transmission?
Simple, view components are not transmitted client to server as a URotator struct, but instead as one 4 byte integer

containing both Pitch and Yaw ranging 0-65535 (2 byte integers compressed into a 4 byte INT).

What can we figure out about this?
Unlike other clients and spectators, the server actually knows where players are aiming at, with full precision.

Is it possible to increase view precision?
No, it is all hardcoded and obvously modifying all player pawns like UTPure did just for this is unnecessary work and


How can it be done then?
A Client-Server simulator belonging to the spectator, the spectator will be spectating the simulator instead of the player,

while the simulator will get accurate ViewRotation updates from the server.

Explaining the concept a little further:

When a spectator types a mutate command to spectate a certain player, a simulator is spawned and attached to the view


Simulator will have the exact same ViewRotation (rotator struct), health and other non-replicated things as the spectated

player, explained later.

Simulator is hidden ingame (bHidden = true), so simulator won't be replicated to clients.

Simulator's owner is the spectator, meaning only the spectator will receive clientside updates.

When the spectator switches to another viewtarget, simulator is destroyed both clientside and serverside, ending the

bandwidth channel.

Simulator will know things not transmitted by the server as ammo count, armor.

With some intrusive processing, the server can use an input grabber from the player's prespective, this one will be enabled

if somebody is speccing him, good to catch input signals.

Since the spectator will be spectating the simulator instead of the actual player, the simulator will try to emulate (only)

clientside weapon firing, armor amount, full weapont list and ammocount without interfering with anything serverside.
With some extra work, it would be possible to display on the screen extra information the player might have transmitted to

the server and clients aren't getting.

08-15-2012, 05:58 AM
you sir, is the next Einstien .

08-17-2012, 11:27 PM
This... wasn't as difficult as expected...

My test spectator gets proper rotation updates, and sets the weapon hand as the player's own handedness, which lets us know their weapon setup now.
Still working on adding the inventory simulation.

08-18-2012, 02:06 AM
Testing phase and adding features.

So far:
- 95% accurate inventory simulation.
- 100% accurate rotation simulation. (capped to server framerate)
- Weapon display identical to the player's.
- Jump key releases the spectator from the player at the player's location.
- Alf fire key (while not chasing player) will chase closest player in the spectator's aim.
- Grab command will teleport the spectator at the wall the spectator's aiming, for fast navigation.
- Fixed legacy log spamming issue for weapons with ammocount (pulse gun and minigun).

Test screenshots with 1 unrealserver and 2 clients.

08-18-2012, 04:43 AM
Wow this looks great. Will you be giving this to SW to compile into the next build? It'd be great if that could be arranged and if SW got off his butt and made that release already. -.-

08-18-2012, 12:16 PM
Wow this looks great. Will you be giving this to SW to compile into the next build? It'd be great if that could be arranged and if SW got off his butt and made that release already. -.-

Dude i had school all summer and had no time. But im done on Monday and free after that.

08-18-2012, 12:31 PM
I was planning to give this out as a separate package, by simply adding it as a ServerPackage and logging in with the enhanced spectator class is enough to use it.
Perhaps I could code a Mutator to replace the spectator class during player login but that will be it.

I would rather keep this away from the main Siege package until it receives extensive testing, it's still too green and besides, as a separate ServerPackage it can be used in any gametype/server and fixed right away if any bug appears.

08-18-2012, 07:47 PM
Feel free to test it:
Read that thread for instructions on how to use.

I tested it on an ACE protected setup and didn't get any kicks, so it shouldn't require whitelist.

08-18-2012, 08:36 PM
im fascinated on how smart you are higor. im amazed. in a very very good way :D

08-18-2012, 09:14 PM
Isn't that what specfix is for?

08-18-2012, 10:30 PM
Specfix is a clientside addition, therefore, doesn't know the extra details the server doesn't send by normal means.

This mod is installed on the server, affects all the spectators and gives them extra functionality when it comes to movement and player chasing (requested by Chan to improve moderation).
The simulator mode lets the spectator know the exact aim (not via smoothing or interpretation) and the weapons/ammo/armor in this player's inventory, as well as his weapon display config and ducking state.

The only question mark here is Demo recording and playback, I have absolutely no idea of what the outcome will be, so I suggest not entering simulation mode while recording.

EDIT: Things that could be simulated, but might not be worth the work are FOV, WalkBob, and Input detection.

08-18-2012, 11:54 PM
I highly doubt anyone is using walkbob, FOV i agree isn't that important if you can see everything as if you were the one playing, might even feel more comfortable watching in your usual FOV. What do you mean by input detection? This is a nice mod and will also help when it comes to streaming matches, thanks for your work.

08-19-2012, 10:57 PM
Updated, fixes a couple of bugs.