Closed Sl4vP0weR closed 3 years ago
Only the CharacterController is loaded on the dedicated server, no character mesh unfortunately.
[SteamCall(ESteamCallValidation.ONLY_FROM_SERVER, legacyName = "tellRaycastRequest")]
public static void ReceiveRaycastRequest(Vector3 origin, Vector3 direction, float distance, int layerMask)
{
var raycastInfo = DamageTool.raycast(new Ray(origin, direction), distance, layerMask, Player.player);
Player.player.input.sendRaycast(raycastInfo, ERaycastInfoUsage.ServerRequest);
}
static readonly ClientStaticMethod<Vector3, Vector3, float, int> SendRaycastRequest = ClientStaticMethod<Vector3, Vector3, float, int>.Get(new ClientStaticMethod<Vector3, Vector3, float, int>.ReceiveDelegate(PlayerInput.ReceiveRaycastRequest));
[NetInvokableGeneratedMethod("ReceiveRaycastRequest", ENetInvokableGeneratedMethodPurpose.Read)]
public static void ReceiveRaycastRequest_Read(in ClientInvocationContext context)
{
NetPakReader reader = context.reader;
reader.ReadClampedVector3(out var origin);
reader.ReadNormalVector3(out var direction);
reader.ReadFloat(out var distance);
reader.ReadInt32(out var mask);
PlayerInput.ReceiveRaycastRequest(origin, direction, distance, mask);
}
Will be better to do RaycastAll too
What do you have in mind to use it for?
What do you have in mind to use it for?
Raycast on the player side will have all meshes and will give the correct Raycast result. That SteamCall will be perfect for plugin developers, cuz will give us view from player side.
We want moooore methods for servers!
@SDGNelson don't listen to them, they are Russian hackers, they want to take control of the players' minds.
@SDGNelson don't listen to them, they are Russian hackers, they want to take control of the players' minds.
c'mon, stop it, only you're russian hacker here
What do you have in mind to use it for?
@SDGNelson, with this I can get more info about what player see
But how exactly you expect raycastInfo to be sent to server? It contains transform that only exists on client, so it WILL be out of sync, and to sync it you should send ALL transforms or ALL gameobjects attached to it that exist on client to properly sync it.
But how exactly you expect raycastInfo to be sent to server? It contains transform that only exists on client, so it WILL be out of sync, and to sync it you should send ALL transforms or ALL gameobjects attached to it that exist on client to properly sync it.
Like in UseableGun.ballistics method. player.input.sendRaycast or like that. Unturned already synchronize some gameobjects, on serverside it's only by info, without rendering.
From SDG.Unturned.PlayerInputPacket:
RaycastInfo info = this.clientsideInputs[i].info;
ERaycastInfoUsage usage = this.clientsideInputs[i].usage;
if (info.player != null)
{
writer.WriteEnum(ERaycastInfoType.PLAYER);
writer.WriteEnum(usage);
writer.WriteClampedVector3(info.point, 13, 7);
writer.WriteNormalVector3(info.direction, 9);
writer.WriteNormalVector3(info.normal, 9);
writer.WriteEnum(info.limb);
writer.WriteSteamID(info.player.channel.owner.playerID.steamID);
}
else if (info.zombie != null)
{
writer.WriteEnum(ERaycastInfoType.ZOMBIE);
writer.WriteEnum(usage);
writer.WriteClampedVector3(info.point, 13, 7);
writer.WriteNormalVector3(info.direction, 9);
writer.WriteNormalVector3(info.normal, 9);
writer.WriteEnum(info.limb);
writer.WriteUInt16(info.zombie.id);
}
If it's possible and won't hit network and cpu usage on client then ok
If it's possible and won't hit network and cpu usage on client then ok
It will be fine. It's like when the player is shooting.
@SDGNelson Will you add this SteamCall?
First of all, I don't see why this SteamCall is being added, as the server already has practically all the client information. Second, what would be the frequency of this call?
First of all, I don't see why this SteamCall is being added, as the server already has practically all the client information. Second, what would be the frequency of this call?
Atm is possible to get all zombies position and u raycast the point at where the player is aiming.
Raycast on the player side will have all meshes and will give the correct Raycast result. That SteamCall will be perfect for plugin developers, cuz will give us view from player side.
What do you want to use it for though? Is it specifically something zombie related as in the OP?
What do you want to use it for though? Is it specifically something zombie related as in the OP?
Not at all, zombie was only as an example, I need to know what around of the player on his side(I can't do that on serverside because serverside doesn't have all meshes) when he did a punch.
Okay getting closer, what do you want to do when a player punches? What do you want to use it for?
Okay getting closer, what do you want to do when a player punches? What do you want to use it for?
Stop asking me, why I need this, it's for my plugin, I don't want to give my plugin idea to the public.
Stop asking me, why I need this, it's for my plugin, I don't want to give my plugin idea to the public.
If you want to keep it secret you can email me nelson@smartlydressedgames.com, but otherwise it would be insane to add features without an actual use case.
@Sl4vP0weR did send an email, but I do not think they are good reasons to add a feature like this to the game.
@Sl4vP0weR did send an email, but I do not think they are good reasons to add a feature like this to the game.
@SDGNelson, Anyways, think about this just more times, it will be very useful for developers, ideas that I sent to you is already will add more interest in gameplay. This SteamCall can have many usages in the development community.
Physics.RaycastAll(ray, range, -1, QueryTriggerInteraction.Collide);
when player watching on zombie returns 0 hits(or some hits of player). Something wrong or it should be like this?