Hello,
I've been trying to make an MMORPG of large scale (open-world, PvP, PvE..) with a team of 3 but i'm the only developer. So long i've been using unity3d for the client c# the server, i'm not perfect in programming but i can translate a "solution" into code. Every time i do progress in unity i discover bigger problems. this my architecture for the process.i'm very bad at explaining anything but i will try my best so please bare with me:
that's how I THINK mmo works so now i'm stuck on sending B pos of A before B spawns. in the server i save last position of the character in a variable, of course its applied to every player. so if there is like 3 already online before the 4th logs in and i need to send the 4th the other 3 players pos how is that possible using 1 variable? like this:
so when any player moves he goes through this loop and his last pos is saved in lastpos. the 3 already online players goes through this too so there is a lastpos for everyone of them and i need to get it to send it to the 4th so he sees them when he spawn. how can i get it? how can i get every "lastpos" variable of every player there?
I've been trying to make an MMORPG of large scale (open-world, PvP, PvE..) with a team of 3 but i'm the only developer. So long i've been using unity3d for the client c# the server, i'm not perfect in programming but i can translate a "solution" into code. Every time i do progress in unity i discover bigger problems. this my architecture for the process.i'm very bad at explaining anything but i will try my best so please bare with me:
Code:
player A requested login..
after authentication,
3d model (character spawned) by a request from the server to spawn that model in a specific location.
another player B logs in,
there is A is already online so B needs to see A on his screen
so the server must send B pos of A WITHOUT requesting it
cuz it should be already saved from move sync class.
server send pos A to B just before spawning
then he send B pos of A so A sees B spawned too.
B made a move,
packet to the server sent with the updated pos of B
server confirms it (collusion detection) and then sent the updated pos of B to A.
Code:
//processing packet handler of player movement
.
.
.
//collusion check
if (col != true)
{
//send back that the pos is confirmed to the client
// saving that pos in variable
lastpos = pos;
// send the updated pos to all other clients
broadcast(playerid, x,y,z);
}