Sign in to follow this  
pro-mos

[Question] How to render something smoothly ?

Recommended Posts

I have a table full of x and y's and z of positions.

Lets say i want to move a car from point A to B using the positions table (many positions). If i used the event "onClientRender" to move the car, the car will move too fast.

The other option is to use a timer of 50 ms to set the position of the car, but this makes the car move too slow and jumps a little.

What else can i try?

Share this post


Link to post

onClientPreRender 

onClientRender renders too late.

Share this post


Link to post
onClientPreRender 

onClientRender renders too late.

Well according to this diagram, both events are rendered "too late" to move an object.

On both events the vehicle's position will be visually updated at the next frame and both events are triggered at the same frequency so onClientRender is totally fine.

Share this post


Link to post

That is fine when you have a pc that can handle everything.

If the map you run renders very slowly, you might end up inside the vehicle when you are standing on it.

As for the amount of dx you render (depending on the handler priority), the longer the delay will be.

The moment when updating the position of the player and the vehicle, it should be as close as possible to each other.

Syncs should have priority over effects. If you disagree with that, it is fine.

Share this post


Link to post

How are you storing the data? I wrote a killcam of sorts for destruction derby a while back and I recall using both position, rotation and velocity.

I never got around to finishing it before I left MTA, so I can't speak for its efficiency but it "replayed" vehicle movement pretty nicely.

Share this post


Link to post
How are you storing the data? I wrote a killcam of sorts for destruction derby a while back and I recall using both position, rotation and velocity.

I never got around to finishing it before I left MTA, so I can't speak for its efficiency but it "replayed" vehicle movement pretty nicely.

It's something like killcam, it just rewinds what you've done in your vehicle

I'm storing the data (pos, velocity, rotation) in a table

I'm using onClientRender, but it's too fast and if you use rewind over and over, the speed increases insanely for no obvious reason.

Still haven't tried to use tick count with it.

Share this post


Link to post

The most important thing when are recording MTA, is to detect (important/large) changes. You can reduce a lot of data when you do that. You want to make the data as small as possible.

So when you walk one direction and the rotation and Z as doesn't change much. You can delete all points in between.

Of course you can record it first and later optimise.

Share this post


Link to post
The most important thing when are recording MTA, is to detect (important/large) changes. You can reduce a lot of data when you do that. You want to make the data as small as possible.

Great idea tho, but I think no one will face a problem with big data, except crappy computers.

Share this post


Link to post

GTA san is limited to only 1 CPU core and MTA is also limited to 1 core. If you make your code unoptimised, new CPU's with more cores will not make a lot of difference. The Ghz per core isn't something that will be increased dramatically, so yes a little bit optimisation isn't too much to ask.

I am having an Intel i7-3770K 3.50Ghz 4 cores with multithreading to virtual 8 cores.

If I write very unoptimised code, I am still stuck at only 1 core. That is when my GTA san is starting to crash.

Good CPU? Not for MTA and unoptimised code.

And if you want to share it with your friends = download speed.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.