Most accurate server-sided physics simulation in SA-MP (using Bullet Physics) (A Ball)
#1

YouTube Link: https://youtu.be/ug2Gp2ELz7M

This is not cimulator, I'm going to release the plugin soon (I'm not, it may upset some people here), it will give you the access to nearly all Bullet Physics features.
The video contains a sample of a ball moving, rolling and bouncing.
Unlike cimulator, the whole simulation and object movement is being controlled by the plugin itself which makes it accurate and you will get more performance when multiple objects are being simulated.

I'm going to make a soccer, billiard pool and tennis script maybe using this and post a video of them soon. (Full feature)
Reply
#2

wow good job!
Reply
#3

This /IS/ accurate! Never thought of anyone creating this. Can't wait for the plugin release. Nice job!
Reply
#4

And whats is the difference between this and PeppeAC his include?
https://sampforum.blast.hk/showthread.php?tid=446286
Reply
#5

Thank you all guys.

Quote:
Originally Posted by Admigo
View Post
And whats is the difference between this and PeppeAC his include?
https://sampforum.blast.hk/showthread.php?tid=446286
That's totally inaccurate and it's a simple include written in PAWN.
Check out http://BulletPhysics.org, it's been used on many games, it's even more powerful than the GTA:SA's physics engine.
However, check this video and tell me if PeppeAC's include is capable of something like this:
YouTube Link: https://youtu.be/8x2slpR7DV0
or this
Link: https://youtu.be/gusdZNvftMM
These are not well configured according to their shapes, better results are expected with more configuration.
http://bulletphysics.org/Bullet/Bull...ionObject.html
Reply
#6

This is certainly revolutionary, can't wait for the release.
But what about the collision with water, vehicles, characters..etc?
Reply
#7

Quote:
Originally Posted by Eoussama
View Post
This is certainly revolutionary, can't wait for the release.
But what about the collision with water, vehicles, characters..etc?
Water, vehicles and characters collision are all supported but there are some issues with vehicles and characters.
For instance unoccupied vehicle returns a wrong quaternion, there is GetVehicleMatrix by IllidanS4 but last time I checked it wasn't working either.
And for character, well, it doesn't support bones movement and such.
Reply
#8

Hoootttt hope to see the release one day
Reply
#9

I don't see much of a difference. You can set object and environment properties in peppe's include to make object react accordingly when collision occurs. Its based on sphere physics and i am pretty sure you are using sphere to stimulate too, if not please tell me. Otherwise how can you call this accurate?

Accurate would be when you define each object models mass and also calculate weight dynamically while processing path.

You haven't provide much information about your plugin and claimed it more accurate.
Reply
#10

That's amazing.
Reply
#11

Awesome! I wonder if there's something similar for SP aswell. Alteast there's a Bullet physics ragdoll mod aviable
Reply
#12

Quote:
Originally Posted by Gammix
View Post
I don't see much of a difference. You can set object and environment properties in peppe's include to make object react accordingly when collision occurs. Its based on sphere physics and i am pretty sure you are using sphere to stimulate too, if not please tell me. Otherwise how can you call this accurate?

Accurate would be when you define each object models mass and also calculate weight dynamically while processing path.

You haven't provide much information about your plugin and claimed it more accurate.
I'm really wondering how can you guys TELL me this and compare a small code written in PAWN with Bullet Physics?
Have you ever paid attention to the videos that Peppe released?? No matter how much mass and what functions he put in his include you use, still it's far from accurate, when the object hits a wall the reaction is awful!
No offense to Peppe, he made an amazing include but you can never compare it to Bullet Physics, come on!

Bullet Physics library is being used by GTA IV and no. You can create both boxes and sphere collisions.

Please fetch more information about Bullet Physics before comparing a BIG Collision and Physics Library to an include written in PAWN.

However here are some functions to make it ACCURATE (I'm still working on it to add more):
Code:
native SetLinearVelocity(index, Float:vx, Float:vy, Float:vz);
native SetAngularVelocity(index, Float:vx, Float:vy, Float:vz);
native SetTorque(index, Float:tx, Float:ty, Float:tz);
native SetFriction(index, Float:friction);
native SetRollingFriction(index, Float:friction);
native SetSpinningFriction(index, Float:friction);
native SetAnisotropicFriction(index, Float:x, Float:y, Float:z, mode);
native SetRestitution(index, Float:rest);
native SetDamping(index, Float:lin_damping, Float:ang_damping);
native SetContactProcessingThres(index, Float:contactProcessingThres);
native SetHitFraction(index, Float:hitFraction);
native SetMass(index, Float:mass);
native SetSleepingThresholds(index, Float:linear, Float:angular);
native SetWorldGravity(Float:x, Float:y, Float:z);
native SetStaticFriction(index, Float:friction);
native SetStaticRollingFriction(index, Float:friction);
native SetStaticSpinningFriction(index, Float:friction);
native SetStaticAnisotropicFriction(index, Float:x, Float:y, Float:z, mode);
native SetStaticRestitution(index, Float:rest);
native SetStaticContactProcessingThres(index, Float:contactProcessingThres);
native SetStaticHitFraction(index, Float:hitFraction);
Quote:
Originally Posted by davve95
View Post
Awesome! I wonder if there's something similar for SP aswell. Alteast there's a Bullet physics ragdoll mod aviable
Game's CCollision and Physics simulation are also poor, I'm working on a mod to replace CCollision and simulation with Bullet Physics and release it on GTAForums That would be a performance optimization for GTA:SA and much features can be used.
Vehicle doors got collision with that mod!
Reply
#13

From the functions I'd say its better than peppe's include but only way to make this accurate is when you define mass.

And yes atleast my modification of peppe's include uses bullet physics i.e. colandreas.

Anyways i am loooking forward to see the source code. Then only i can leave a proper feedback.
Reply
#14

lol I can confirm this is 100% better than my include, as it is based on a real physics engine (Bullet Physics)

Mine was just an include, the best I could do with my knowledge, time and SA-MP/Pawn resources. Also, ColAndreas implementation was very basic and only for testing purposes.


It would be interesting to know how this plugin affects the performance of the server (I think it takes a lot of resources) and if it would be possible for SA-MP developers to implement a proper collision engine on client-side, with syncing code on server-side.
Reply
#15

Quote:
Originally Posted by PeppeAC
View Post
lol I can confirm this is 100% better than my include, as it is based on a real physics engine (Bullet Physics)

Mine was just an include, the best I could do with my knowledge, time and SA-MP/Pawn resources. Also, ColAndreas implementation was very basic and only for testing purposes.


It would be interesting to know how this plugin affects the performance of the server (I think it takes a lot of resources) and if it would be possible for SA-MP developers to implement a proper collision engine on client-side, with syncing code on server-side.
It is however technically wrong to say your include doesn't use Bullet Physics, it does with ColAndreas....
Reply
#16

What happens if there is lag?
Reply
#17

Quote:
Originally Posted by PeppeAC
View Post
It would be interesting to know how this plugin affects the performance of the server (I think it takes a lot of resources) and if it would be possible for SA-MP developers to implement a proper collision engine on client-side, with syncing code on server-side.
Not much RAM, a little bit less than ColAndreas with all collisions initialized (Because of using CollisionObject instead of RigidBody for the San Andreas world)

Also not much CPU because I have limited stepSimulation to be called in a rate instead of being called rapidly.

Well, it depends on your CPU mostly, more powerful CPU, more objects can be simulated at once, however you should also consider RakNet and ackslimit when simulating lots of objects in a specific streamed area, it will send 2RPCs per step simulation (per-player ofcourse)
And about doing it in client-side, well, still you need to put some checks and communication between the server and the client, it won't look pretty that way.

Quote:
Originally Posted by Yashas
View Post
What happens if there is lag?
SA-MP's ped movement synchronization contains velocity, let's consider Counter-Strike 1.6 as our synchronization doesn't contain velocity and just the position and rotation, have you played it? Have you seen how lag looks like there? That's exactly how lag looks like with simulation.
Reply
#18

Hmm interesting


The physics are a bit off than what I see in other modern games, but I guess that's only because of it being an example (?)

EDIT: inb4, I just would like to know what are the limitations of this plugin, I don't have past experience with physics engine I just want to know what I could do and if the physics can be a match for modern games, because as I see Bullet Physics itself is pretty capable of being one
https://www.youtube.com/watch?v=FIPu9_OGFgc
https://www.youtube.com/watch?v=PfezSJB21vk
Reply
#19

Quote:
Originally Posted by Kaperstone
View Post
Hmm interesting


The physics are a bit off than what I see in other modern games, but I guess that's only because of it being an example (?)

EDIT: inb4, I just would like to know what are the limitations of this plugin, I don't have past experience with physics engine I just want to know what I could do and if the physics can be a match for modern games, because as I see Bullet Physics itself is pretty capable of being one
https://www.youtube.com/watch?v=FIPu9_OGFgc
https://www.youtube.com/watch?v=PfezSJB21vk
It's useful when you are trying to throw a gun or a ball to make a ball game like bowling or soccer, game's physics are different, I am just using a little part of Bullet Physics for simulation, games use most of its parts.

The first video you have put, the breaking part is impossible in SA:MP, what you saw in that video are not just one mesh, GTA:SA models aren't this way...
And about the second video, it's possible with smaller amount of planks. (Do we have planks model in SAMP at all?)
Reply
#20

Quote:
Originally Posted by Aliassassin123456
View Post
It's useful when you are trying to throw a gun or a ball to make a ball game like bowling or soccer, game's physics are different, I am just using a little part of Bullet Physics for simulation, games use most of its parts.

The first video you have put, the breaking part is impossible in SA:MP, what you saw in that video are not just one mesh, GTA:SA models aren't this way...
And about the second video, it's possible with smaller amount of planks. (Do we have planks model in SAMP at all?)
How many objects could we simulate simultaneously to many players without creating a desync between them or a lag?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)