[ad_1]
LorenzoGatti said:
even in the simple case JoeJ discusses, uniform gravity and initial velocity without angular momentum and without air resistance
Angular momentum does not affect the linear trajectory, but linear damping might a bit. If enabled, that’s the same as air resistance, so i would turn it off for the projectile body.
It also depends on the integrator and timestep a lot ofc.
I have used a physics engine with RK4 integrator, and the projectile followed the predicted parabola very precisely. For a distance of 100m, the error was in the range of centimeters.
LorenzoGatti said:
You have to simulate throwing the object, with more or less “physics based” calculations, measure how it moves and turn those collected points into a trajectory preview.
I would not say that. Even if you need 100% accuracy and are willing to pay the cost, you likely can’t predict the future of all other objects in the scene, which might then still cause unexpected collisions in rare cases anyway, so i don’t see a reason to pay the cost.
I also assume the indicator is mainly used to assist aiming, but things like predicting moving targets or moving obstacles are left to the player.
I did a code example recently btw: https://www.gamedev.net/forums/topic/715283-aiming-feature-like-angry-bird/5460529/
Jikoob said:
What approach would you use and why? Do you see any other valid approach to this problem? Which approach do you think is used the most in video games? Did you implement such mechanic in any of your shipped titles?
I think it needs the approach that feels right to the game. If the purpose is to challenge the player in delivering the object exactly there, you get a whole different setup than if the purpose is more story-oriented, and throwing the object is just a visualization of the narrative.
As to other approaches, my thoughts are running wild. A rectangular trajectory could be fun, throw it up, and the wind carries it in? A parabola is sooo common 🙂
Don’t know. I guess physics based, because everybody seems to have physics these days.
Nope.
Alberth said:
Don’t know. I guess physics based, because everybody seems to have physics these days. Nope.
Sounds you do not really like the boredom from attempting to simulate reality?
I think it’s good in general. Because, if things behave realistically, the player can apply real world experience to make predictions. And predictions are essential to make action games work at all. I could not make much sense out of a rectangular trajectory maybe, or it would take me too much time to learn it, causing frustration. But if the trajectory as a boring parabola, i can predict and don’t need to learn anything. It just works, and likely what makes the game interesting is something else, but not really the shape of trajectories.
Super Mario is a good example. There were surely earlier games which introduced acceleration, but it’s just the perfect action game. It still uses constant velocity movement for most enemies. This eases gameplay, because the players skills are already taxed with predicting Marios accelerating trajectory. So the simple enemy movement makes it easier and more fun to predict the whole game.
But the interesting thing is Marios movement, based on controlling acceleration instead velocity. This introduces lag. Usually we don’t like lag, but here we do, simply because it behaves like in the real world.
We could say the lag forces us to plan ahead, but we can also say it gives us more time to plan our strategy.
And this latter point is what makes the game great, and why we usually want to respect laws of physics in games.
That said to defend what’s imo the sleeping princess of video games: Physics simulation. : )
If you think it’s boring, then i assume you think so because currently physics is much too passive. Stacks of boxes, ragdoll deaths, even destruction – that’s all passive stuff. We need more motors. Robotics, moving platforms, vehicles, etc. That’s where the opportunity is, imo.
Thank you all for your answers!
@JoeJ I do agree, in most games I can see the physics based approach to be the way to go. Regarding your Super Mario example, I feel the same way for Half-Life 2 and source engine which brought a lot of physics play onto the playground which was awesome.
When narrowing down my question to the simple diagonal throw/free fall problem I do agree that the math here is not complicated and it’s probably the best way to implement such mechanic. Since in most game engines now we use physics (applying force to a rigidbody) to throw something, it would be wise to use physics and math to actually calculate the travel path of the thrown object.
Although if I would have to make a boomerang throw mechanic with travel path indication in a isometric 2.5D game that doesn’t really rely on physics, I think I would seriously consider writing a parametrized boomerang path generator and then simply move the boomerang along generated path.
Jikoob said:
When narrowing down my question to the simple diagonal throw/free fall problem I do agree that the math here is not complicated and it’s probably the best way to implement such mechanic.
To me, the argument usually is: If the problem has an analytical solution, then i really want to use it. It’s like free lunch.
Contrary, if i need to solve something iteratively, e.g. hitting a moving target, then i’m always a bit frustrated about the cost.
Jikoob said:
Regarding your Super Mario example, I feel the same way for Half-Life 2
Yeah, i always thought HL2 is the most innovative game ever, due to it’s introduction of physics. (i’ve missed Trespasser)
But then, many years later, i started to play Super Mario because my wife likes it.
And i found out: Super Mario has done everything HL2 did long before. 😀
[ad_2]
Source link