1
\$\begingroup\$

I'd like to prototype a game with custom, very simple physics. Something similar to older games, anything from Super Mario to Quake 3 Arena.

I'd prefer to avoid realistic physics engine because they usually reduce the control you have over your objects and require you to manipulate such objects in a specific way.

I'd want to be able to update the objects' physical state using my own rules. E.g. I'd like to implement and apply gravity, movements and all the rest using my own logic.

I believe that what I need is a small engine that handles an efficient representation of objects in a space and offers an interface to query it.
I'd also need it to offer decent utilities for very common problems such as collision detection, ray casting, moving overlapping objects away from each other etc.

Do similar engines even have a name?
They're not considered physics engine, are they?

I was planning to work on a 3D prototype, and use JavaScript and Three.js as a language and scene-graph/renderer. However I might be open to 2D environments and/or different technologies.
I'd love it if I could find a set of libraries that are meant to work with each other, so that I don't need to write a lot of glue code.

\$\endgroup\$
  • \$\begingroup\$ Why not just use the built in Physics engine? You can add forces gravity etc with rigidbodies, and even change the transform directly. What is there in the built in physics engine that you don't like? \$\endgroup\$ – Rowan Radosav - McRae Jun 1 at 22:13
  • \$\begingroup\$ @RowanRadosav-McRae: a very common and simple example is moving a character when you press a key, or drag something with your mouse. With realistic physics engines (the ones I tried at least) you need to apply forces and constrains to the objects in order to move them; you can't easily set the object's position to match the mouse coordinate, or move an object by V when the key is pressed, and by 0 when the key is released. \$\endgroup\$ – peoro Jun 2 at 9:20
  • \$\begingroup\$ I don't need (and don't want) the realistic physics - I'd be happier to just set the position of my objects (handling velocity, acceleration on my own, without even giving this information to the engine), and just use the engine to detect collisions so that I can choose how to handle situation I want to avoid (e.g. certain objects overlapping) \$\endgroup\$ – peoro Jun 2 at 9:23
  • \$\begingroup\$ What is the built in Physics engine? From what I understand there's no physics engine shipped with Three.js. There are external physics engine like physijs, but they have the "problems" I described above. \$\endgroup\$ – peoro Jun 2 at 9:24
1
\$\begingroup\$

You have just described my understanding of a game engine. A program that lets you build a game, and offers lots and lots of solutions to common problems in game development. In every game engine I know, there are options to disable, or just to ignore, the built-in physics system. I recommend Unity, but you should research pros and cons of different systems.

tldr; You are looking for a "game engine", not a "physics engine".

\$\endgroup\$
  • 1
    \$\begingroup\$ As Alex F says, typical game engines, even ones with rich physics, give you options to use just what you need. Usually you can mark a body as "kinematic" to tell the engine "I'll handle moving this one myself, don't simulate it for me" while still having the convenience of the physics engine for collision checks, ray & shape casts, etc. \$\endgroup\$ – DMGregory Jun 1 at 23:13
  • \$\begingroup\$ Thanks. I was not quite aware of that. I'll try to see whether I can achieve that using Physijs (a physics engine for Three.js). \$\endgroup\$ – peoro Jun 2 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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