Hello fellows,
I'm looking for some alternatives to typical physics calculations for a grid-based game. For a game where you only have a grid and no exact floating point position between the grid squares (like in a roguelike). Every object on this grid can only move by placing it + x/y/z from the original position. I just need a simple gravity physics that works fine with integer grid positons.
At first I tried a more realistic version by implementing a frequency-based system (x steps every second, for each axis a single timer). It's unpredictable, not very stable and needs a lot more workarounds. Since I'm seemingly the only person on the internet who does something like this I don't know where to get help.
Anyelse an idea? I'm somehow stuck. Again.
What exactly are you trying to do? What sort of precision do you want? How accurately do you want to model physics?
Here's the thing, any physics implementation which works for floating point vectors will work for integer vectors. It would be a trivial task to implement a basic floating point physics engine and then round off the vectors to your grid space.
But if you must make it fully discrete, just assign every object in the world a 3-dimensional vector corresponding to its position, velocity, and the sum of forces acting on it as integers. This is basically exactly what you were doing when you did "for each axis a single timer."
If you don't want things to behave realistically, you can just give each object a z speed and increase that constantly if it is not touching the ground.