Codeine Posted January 27, 2015 Share Posted January 27, 2015 Hello, Im trying to create animals just randomly walking around in the desert, and i have no idea how to do the syncing between online players, and the people who are coming online. Doing a MySQL query on onClientRender to save position is not an option, i dont want everything to lag. Any idea? Thanks Link to comment
-.Paradox.- Posted January 27, 2015 Share Posted January 27, 2015 https://community.multitheftauto.com/in ... ils&id=672 https://wiki.multitheftauto.com/wiki/Slothman/Slothbot engineLoadTXD engineImportTXD engineLoadDFF engineReplaceModel Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 I know about that, the question was about ped syncing. You dont really understand what im trying to say. Lets say there is an online player, next to a ped, and that ped is walking from point a to point b. when that ped is around middle way, some other player joins the server, and the ped needs to be at that exact same position and do the tasks it started while the other player was online. So basically sync the same thing for the new player, at the same time. Link to comment
manawydan Posted January 27, 2015 Share Posted January 27, 2015 post your script, you have used triggers? triggerClient/triggerServer event? Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 I haven't done anything yet since i dont think its actually possible. It would be if i would save the position to mySQL with onClientRender and load that for the another player, but there probably would be lag and it wouldnt sync probably anyways. Link to comment
.:HyPeX:. Posted January 27, 2015 Share Posted January 27, 2015 Make all ped stuff server side, and send the data client-side. Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 Yeah but lets say you start a ped walking, and a new player logins while its walking. the new player wont see the ped walking, just doing nothing. Link to comment
.:HyPeX:. Posted January 27, 2015 Share Posted January 27, 2015 Yeah but lets say you start a ped walking, and a new player logins while its walking. the new player wont see the ped walking, just doing nothing. Then request it and send it back. https://wiki.multitheftauto.com/wiki/on ... ourceStart https://wiki.multitheftauto.com/wiki/triggerServerEvent https://wiki.multitheftauto.com/wiki/addEvent https://wiki.multitheftauto.com/wiki/addEventHandler https://wiki.multitheftauto.com/wiki/triggerClientEvent Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 so basically send everything from server to all online clients and when a new player comes it requests the stuff from one of the clients and starts it? there would be alot of desync probably. What i want to achieve is random peds walking around randomly, at the same position for everyone in any case. And desyncing wouldnt be so good. Link to comment
.:HyPeX:. Posted January 27, 2015 Share Posted January 27, 2015 so basically send everything from server to all online clients and when a new player comes it requests the stuff from one of the clients and starts it? there would be alot of desync probably. What i want to achieve is random peds walking around randomly, at the same position for everyone in any case. And desyncing wouldnt be so good. as i said, do everything serverside, and once a player is ready, request the server the information. This will still cause a delay, wich will create desync, in wich case, i'd recommend telling every client the new information about the ped to sync. Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 so basically having a bunch of peds in a spot moving around at the same time for everyone is impossible. Link to comment
.:HyPeX:. Posted January 27, 2015 Share Posted January 27, 2015 so basically having a bunch of peds in a spot moving around at the same time for everyone is impossible. Oh god, did you even ready? try it! -Do ALL the ped things server side. -Whenever a ped joins (And finishes downloading), send every client the ped info to achieve maximum syncing. Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 You dont really understand. Lets say i do it serverside. What you are telling me to try is basically resetting everything as soon as a new player joins, and send it to everyone. Since the ped doesnt exist for the new player, it needs to create it, and if it creates it, it resets everything. Link to comment
.:HyPeX:. Posted January 27, 2015 Share Posted January 27, 2015 You dont really understand. Lets say i do it serverside. What you are telling me to try is basically resetting everything as soon as a new player joins, and send it to everyone. Since the ped doesnt exist for the new player, it needs to create it, and if it creates it, it resets everything. add the option to just update its position and movement if already created? its not that hard imo.. Link to comment
Codeine Posted January 27, 2015 Author Share Posted January 27, 2015 I have no idea how to start really. been messing with this all day, i wrote inventories and stuff like that but i cant get this one to work. Link to comment
-.Paradox.- Posted January 28, 2015 Share Posted January 28, 2015 I know about that, the question was about ped syncing. You dont really understand what im trying to say. Lets say there is an online player, next to a ped, and that ped is walking from point a to point b. when that ped is around middle way, some other player joins the server, and the ped needs to be at that exact same position and do the tasks it started while the other player was online. So basically sync the same thing for the new player, at the same time. I still don't understand, Just trying to help, my bad. I'm out. Link to comment
.:HyPeX:. Posted January 28, 2015 Share Posted January 28, 2015 Post what you've tried so far. Link to comment
Dealman Posted January 28, 2015 Share Posted January 28, 2015 What they mean is that when a new client joins, it requests an update. What peds are there? Their stats? What is their current behaviour and position/rotation? The server then responds to this via latest available data. It is very possible to do. You can also ask other clients for their data, and if it's vastly different - try to interpolate it. Either way I don't see the issue because you could just use getElementPosition. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now