Physics
-
Well, since they also use this for robotics control (all with n axes etc) this works under real conditions. That’s all I can say. I will try to implement it in my engine as soon as I find the time. He also said the advantage is that it reacts good to disturbances.
-
Well, if you get something workable in your engine (C++?), then that would be great, but for the time being I dont think any of us has the time to reinvent the wheel on physics.
Also, a proper physics engine gets us loads of features for free (collisions, etc…)
-
I actually am talking about using a physics engine. As soon as you want to include torque, inertia etc a simple simulation gets quite complex. I think you should try to work with a physics engine to see what I mean. It doesn’t magically solve everything for you. Quite the opposite. Now you can solve all the equations, but since they all work on the force level, you have to calculate every needed force. And that’s what I was getting at all the time.
Btw. my engine is of course written in Freepascal
-
I’d just like to bump this. The primary reason I and w0d are working on this is so we can use a good, modern and fast server for Freeworlds instead of the hacked together mess that is FLServer with all our stuff piled on top.
We cannot afford to wait around for years so that you get your engine working, Schmack. We need something reliable and we need it soon. This is why we’d considered using an existing, proven engine instead.
I’d just like to know whether you guys are even considering the fact that if we don’t release something within the next few months, all this work will largely be rendered void by newer, better games coming out very soon? If we want to make this work and make this be worth something, we need to kick into gear. There are many things to do yet, but we all know that the two core things are collisions and NPCs. If we have both, we have something we can show to the wider world.
So, what do we do now?
-
I think you misunderstood. I only mentioned my engine, because I already have a working physics engine included (actually I have used two with it, now it is Newton, before that it was ODE). I don’t expect it to ever finish, at least not with the very sporadic time investment I am able to do.
I rather tried to explain the problems I see, which is why I suggested to use a rather simple solution. If you want server side physics and an accurate simulation, a physics engine is most probably the easiest solution, although you still have to calculate the factors of the equations. Which is all what physics engines do. You give the values, the solver gives you the solution.
Meaning if you want to let the AI fly a curve, you will have to calculate the forces for each timestep. I guess you could trick and just change rotation etc, but then you would remove the other forces out of the equation, losing the advantage of the physics engine.
I hope that cleared most of the things up.
-
If you take a look at the Bullet API, you’ll find things like
applyTorque
applyImpulse
applyForce
setCenterOfMassTransformThose are the elements we need. We already know what force an engine can provide, and we can interpolate it using throttle. We can also linearly interpolate torque in the same way.
By using this we gain accurate simulation of all the physics we need for free in an efficient manner. We don’t have the code to take inertia, dampening, and torque and compute movement in 3D space; do you? We can’t ignore those, so we have to have something. Libraries hide all of that nasty 3D physics work.
Likewise, we also gain collision detection in the bargain. Do you have collision detection code?
The problem here is that you’re just saying “no” without giving alternatives. Coding it ourselves is going to result in a lot of hair pulling and not much results.
-
I think we are talking at cross-purposes.
I am not saying no. I first suggested to use a rather simple approach without collision, torque, inertia etc., but you did not want that. I then agreed that if you want an accurate simulation, using a physics engine is probably the easiest way, although you still have to provide the forces for each time step. I then asked one of our students how to calculate them and tried explaining that to you, which you also did not like. Since I need that for my engine, which uses a physics engine, I then said, that I will try this approach and that I think it will work.
If you think you can teach the AI flying around using a physics engine without the controller model (this is the one I described), go ahead, I would be very interested to see how that works.
-
You’ve not explained your method properly then because it did not appear to support inertia, torque and dampening calculations. We need a system that basically works like players fly: pick a direction to move to and point there, the ship does the rest in a way that’s accurate depending on its flight characteristics.
If you can do that with your method, then fantastic.
-
That’s what I want to test. The challenge is to get the system stable. There are many algorithms in control theory and most of it is solved. As long as you don’t do to extreme corrections per time step it should work. But I don’t want it to get much complicated.
So I would try a rather simple approach like linearly increased forces and if that is to weak I go exponential (relative to the error). That should keep the ship on the calculated path, which you dynamically adapt (that would be the AI then). So the feedback control keeps it on path an the AI reacts to obstacles, new goals etc and changes it accordingly. Having the ship e.g always vertical to the path would also be the job of the controller.
Dampening would be some sort of max speed, which you also could include, meaning after a certain velocity in direction of the path no speed increase is done, only course corrections.
-
Just to give an update: I am currently learning for my exams and thus couldn’t do much. I have finished the theory (amongst other things cubic bezier curves for path and I got a simple way to calculate the length of the curve, which you need) and am still confident, that it will work. I will post a video of it as soon as I got it working. But feel free to test it yourselves, if you got the time for it.