3
\$\begingroup\$

Do video games often use numerical solutions in their calculations, such as you might generate using software like MATLAB or Mathematica?

Perhaps for making formulas for AI, or for game physics implementations?

\$\endgroup\$
8
  • \$\begingroup\$ Sufficiently complex physics might need integrals that cannot be evaluated symbolically. Possibly also for simulation of non-physics things, perhaps as part of the AI or an economics model. Not an answer because I don't know if this ever happens in practice, though I doubt it. However, approximate solutions certainly happen, and I wouldn't be surprised if a sufficiently accurate numerical solution could be faster than evaluating a "perfect" formula. \$\endgroup\$
    – Steve314
    Dec 8 '13 at 7:27
  • \$\begingroup\$ Thanks steve for your comment, just a question, when you say an approximate solution happens, is this due to programming related issues, such as square root values cannot be used for an x parameter of an object, or equation related solutions? \$\endgroup\$
    – tristo
    Dec 8 '13 at 7:42
  • \$\begingroup\$ Sorry I voted to close this question. Because other than yes it uses numerical analysis especially for collision detection and physics simulation, it's a list generator. And also about which tech to use. Please rephrase it, so it tackles a certain problem that can have a correct answer. \$\endgroup\$
    – concept3d
    Dec 8 '13 at 7:49
  • \$\begingroup\$ @tristo - I don't know what you mean by " such as square root values cannot be used for an x parameter of an object", but sometimes an approximation is faster than a precise solution. Sometimes, a less accurate software solution is even faster than a more accurate hardware solution. One classic approximation for performance is the fast square root, though I suspect it's purely historic by now. BTW - I have no inside knowledge of professional game programming, I've just (probably) been curious a lot longer than you. \$\endgroup\$
    – Steve314
    Dec 8 '13 at 8:20
  • 1
    \$\begingroup\$ Numerical solutions are used in video games although not that often. The most typical case for me has been computations related to spline curves. E.g. finding the closest distance to a curve or moving with constant speed along the curve needs numerical methods to solve. \$\endgroup\$
    – msell
    Dec 8 '13 at 8:32
4
\$\begingroup\$

Mathematics

While I of course can't guarantee that no counterexample exists, in general maths software will not help you write videogames. While such packages can solve some incredible mathematical problems, it is not the kind of problems you generally face when writing a game. Remember, maths software does not write code, it doesn't even write expressions, it merely transforms the expressions that you feed to it.

Almost all the maths I use as a programmer, whether writing games or other software, is basic algebra. The true art of programming is to find solutions to open ended and vaguely defined problems, such as "How can I convey all the relevant information to the user in a simple and intuitive manner?", or "How can I make the jumping mechanic feel good?". Good luck feeding those problems to Mathematica.

Physics

Your question implies being about physics simulation, and that is typically the most maths-heavy part of a videogame. While a good engine will usually use some clever formulas derived using differential maths in order to be as accurate as possible (see for instance Why is RK4 better than Euler integration?), numerical integration is pretty much the only thing you can do.

  • First of all because the objective is not to find a finite solution, it is to produce a game state 60 times per second that can be used to render the world to the user, so no matter the method you would have to make at least that many individual calculations anyway.
  • Second because the simulation is constantly changing, if nothing else at least the user input will be an unpredictable factor, you can't put that in a closed form formula.
  • Third because even moderately complex scenarios are impossible to solve analytically, you don't need to go further than the Three-body problem to find an example, compare the complexity of that to a typical videogame and it is pretty clear that task is hopeless.
\$\endgroup\$
2
  • \$\begingroup\$ Thanks eBusniness, I know many problems regarding videogames are rather physiological, and more based on user experience, or moreso about design, but just on the engineering side of videogames, as I'm not an expert of mathematics I wanted the software to hhelp me understand a problem I need to solve, or the most efficient way to go about it. Thankyou for this answer you have given me the understanding I wanted \$\endgroup\$
    – tristo
    Dec 8 '13 at 20:37
  • \$\begingroup\$ @tristo I don't think there is a lot of understanding to be gained from using mathematics software, learning maths still require reading and working predominantly. But programming doesn't have to take much maths skill, sure it is nice to know, but it is certainly also possible to write games with just basic algebra. \$\endgroup\$ Dec 8 '13 at 20:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.