Hi,
A quick and simple question. Is there any way to increase the game speed, so that everything just happens faster? I was doing a solar-system-like simulation and with the regular game time speed I cannot really simulate anything.
Any ideas?
Hi,
A quick and simple question. Is there any way to increase the game speed, so that everything just happens faster? I was doing a solar-system-like simulation and with the regular game time speed I cannot really simulate anything.
Any ideas?
I guess my slow motion tutorial might help, but instead of decreasing, increase? https://www.youtube.com/watch?v=8m3xCqBwk7E
I already know about Global Time Dilation component, however, it manages to increase game speed to about x20 of the base game speed.
With a solar system I would need a several thousand times increase in game speed. I know it cannot be normally with time dilation, because of performance, but would there be any way to e.g. decrease the number of calculated engine iterations in a time unit in order to achieve the same performance with a game speed somehow (most probably not with Global Time Dilation Component) increased for example 5000 times?
I also thought about changing the math/physics algorithms regarding system bodies’ movement, so that they would create an illusion of being simulated quicker, but what I find troublesome is that most of them are still tightly connected with UE4 physics engine and thus such forced faster simulation is unlikely.
How exactly are you simulating the system?
Thank you for your responses
It is half physically and half with raw mathematics.
The physical part is simply the fact that the bodies have the Simulate Physics property on. Gravity is disabled for them so that they do not fall down freely.
The math part is about calculating instantaneous vectors of velocities (v0+aΔt) and accelerations (GM/r^2e) in a delta time where v0=initial speed of a body (which after every iteration is updated), a=acceleration of a body, G=(Gravitational constant)*(many coefficients scaling the real world units to smaller UE4 ones), M=mass of a central attractor, r=distance between the attractor and a body, e=unit vector determining the acceleration direction.
That is really helpful info, but unfortunately my calculations do not predict the orbit outcomes and it would be hard to change everything now. Also I think that it would be hard to implement in my model, because it is designed so that sometimes there occur some random collisions between bodies in the solar system which could make calculating orbits heavier performance-wise than using a physical collision with an addition of some kinematic vector maths.
I was thinking about one solution. I could do a multiplication on all of the parameters used in kinematic calculations. Because when to think about it, wouldn’t it be the same outcome as speeding up time if the velocity is multiplied by something and the acceleration is multiplied by (something)^2? As the distance travelled by an object is given by the simple equation s=v0t+(at^2)/2 then if we take a certain time t1 and a certain time t2=t1/(2^n), where n=exponent determining the time speed-up (the speed-up values would be the powers of 2), it becomes certain that in order to make the s2=s1, v0_2 must equal v0_12^n and a2=a12^(2n). This will result in the same distances covered in different time periods.
But the thing is here that the physical simulation regarding collisions etc. will still occur in the base game speed. Is there any fix for that?
All that math is way over my head, but, now that you mention physics collisions happening in base game speed it reminds me of a post at AnswerHub(or forum maybe) about physics not working properly with time dilation. I’ll post here if i find it.
Isn’t multiplying delta seconds the same as multiplying variables?
I mean I already use delta seconds to calculate instantaneous vectors, so basically if I multiply delta seconds I will also multiply the variables.
I will try it with delta time then and see what happens. The system was hitherto working properly, but the simpler a BP is the better
There appear two other problems then.
Sorry I misunderstood you. You were saying about moving the objects strictly in a mathematical fasion. But what I do not understand is how would you like then to also simulate collisions, bounces or splitting a body to smaller pieces? I think that calculating a distance to be covered might not be enough and this is why I wanted to implement a more physical model. Basically what I am doing right now is (I didn’t have access to a PC today so I it remained the same as yesterday):
This enables me to mathematically move objects without any loss regarding physical interactions.
This was my first idea I came up with when starting the project. Do you have any other so that the objects remain fully physical in space?
Sorry if I accidentally misunderstood your concept once more
It is from a fundamental kinematic equation s=v0t+(at^2)/2, s=distance, v0=initial speed, t=time, a=acceleration.
If you want to get the same distance covered in different time periods you need to change the velocity and the acceleration. Of course, we get a diophantine equation then, but we need this one most characteristic solution based on the values from previous tick.
So we could for example get an initial velocity of 100m/s, acceleration of 50m/s^2 and time of 2s. It gives us a distance of 300m.
Now let’s speed up things two times. To do that we need to cover the same distance of 300m but in twice shorter time period, 1s.
If we get the velocity and multiply it by 2 and the acceleration by 2 we get a distance of 250m. This is not the same distance as we get before, so something is wrong.
The thing is that in the formula the acceleration is multiplied by the square of time, not by time to the power of one like velocity. This is the reason why the acceleration must be multiplied by square of the number of times the time was dilated in order to preserve the initial distance that needs to be covered in shorter time.
Now if we multiply velocity by 2 and acceleration by 4 we get the result of 300m which is exactly what we wanted to get.
A simple another numerical example with the same values, but with four times speed-up:
1x time: 300=1002+(502^2)/2
4x time: 300=v0.5+(a0.5^2)/2=(notice that the time in acceleration fraction has now became 8 times smaller the it was in 1x time)=0.5v+0.25a/2
The solution which we want for this diophantine equation is v=400m/s and a=800m/s^2. The acceleration at 1x was 50m/s^2 and at 4x it is 800m/s^2. It was increased by 16 times, which is 4^2, so the acceleration must be multiplied by the square of time dilation.
I always say that if there is something already in the engine then don’t try to create your version of it, but simply use what the engine provides. UE4 has a powerful PhysX engine which allows for very realistic physical interactions (including splitting a destructible mesh) between objects and implementing these interactions myself will firstly take a lot of time and secondly will be most likely far worse than UE4 engine.
This is really the base reason why I mix maths and PhysX here.
You really were of assistance. I found some bugs and implemented another functionality when analyzing in response to your comment
I think I will get the whole game speed thing to work eventually.
And do you or anybody have the solution for those float values I talked about in post #11? I can’t figure out how to make it move so slowly without more precision which is not possible, because UE4 world coordinate system is based on floats not doubles. Any ideas?
There is also a different problem that is something very frustrating. I can’t get the velocity even below 0.2, because that is considered as a value with which the engine can turn a body to sleep mode. Even when I turn the Sleep Family to SF Sensitive it zeros itself immediately when the value is below 0.15. Is there any way to tweak this or should I quit the physics stuff already?
After the x coordinate reaches something around 260000 the object simply disappears when I hit Play. It is not like it is not rendered. It is destroyed, because it isn’t visible even in the scene outliner. If I move it below 250000 it starts to work again.
So in my case the limit is around 260000.
If I move the object to 200000 it is 200 times more than it was in the beginning. That means that the velocity of the planet would be increased from 0.0003 to 0.06. Unforunately, this is also the value which triggers sleep mode on my object (see my edit previous post - I edited it when you were typing it seems ).
A value which should not trigger sleep mode would appear when the object was moved about 1000000 from the center. But as I said before my limit is 260000.