Implementation:
- Works by having an
APingManagerclass (derived fromAInfo)APingManager– Manages all of the pings for all of the players, by assigning 1 ping to 1 player (1:1).
- The
AGameModeclass createsAPingManager - In order to communicate to the
APingManagerclass, any Actor that wishes to ‘ping’ a location, must implementUPingComponent.
Why This Implementation?
- If the ‘pings’ were just handled with an
UActorComponent, and any actor we want to ping implements said component, then when theAPlayerControllerpossess Pawn1 and pings, a ping will appear. If saidAPlayControllerpossess Pawn2 and pings, then there would be 2 pings for 1 PlayerController on screen. I did not want this. - Why not have
APlayerControllerimplement theUPingComponent?- Well,
APlayerControlleronly exists on the Server & the owning client. So, if theAPlayerControllerpings, then no other client will receive said ping.
- Well,
- How about
APlayerState?- Well, while adding the
UPingComponentto theAPlayerStatewill work, sinceAPlayerStateexists on all clients as well as the server. The issue is, theNetUpdateFrequencyforAPlayerStateis very low, thus when pinging, the ping will take a noticeable amount of time to appear.
- Well, while adding the
Leave a Reply