Jump to content

Synced Ped Movements


Codeine

Recommended Posts

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

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
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

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
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
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

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
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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...