|Topic was automatically imported from the old Question2Answer platform.
I’m making an Among Us clone, and I have it to where you can join the server and it shows the kill button if you’re the Imposter, but I need help making the functionality.
The game is a 2d Top-Down server-client game.
I really need to check if the closest player is less than __ away and if the cool-down is = 0, and then if so, send an
rpc_id function of
KILL or something to that client, but I don’t know how to do that.
Thanks in advance!
Setting up an rpc loop is a complex topic, I couldn’t hope to begin cover it in a single text comment.
I recommend you watch this excellent series by Stefan at the Game Development Center YT channel which walks you through the whole process and discusses the pitfalls: https://youtu.be/lnFN6YabFKg
Thanks, but I was really trying to keep away from that. It’s really advanced, and I was really wondering how to tell the distance between players
Well yes, online multiplayer is advanced… That’s like saying you want to design a microchip but you don’t want it to be complicated.
At it’s most basic I suppose you can make a dict containing the player id and Transform and each player can send their position to the server. Then server side you loop through the players and return an array with the other players and their Transforms. Then client side you loop through it, get your distances and pick the closest one.
DaddyMonster | 2021-09-24 16:46
Thanks, I’ll try that.
When I started this, I never thought it would be easy, but I guess I never thought it would be this complex.