Published on Monday, April 24, 2023
Small week-end project!
The idea with this one was to create a n-body particles simulation in Minecraft using the minimum resources to run it. That is, running it within a complexity (triangular).
So I got started with small planets i could generate summon with different weights and sizes ti see how the influence themselves.
Here are few notes about this project:
Despite using only Newton's formula which I thought would be fairly simple and wouldn't git any lack of precision due to its simplicity, going further than 2000 blocks from (0, 0) started creating int overflows.
This is due to the fact that I used a fixed point, which was required as I noticed that tends to lead to instabillity and reach singularities. This may happens to the model too, so I also implemented a cap to the jerk (rate of change of the acceleration).
I could have implemented instead a cap onto the acceleration, however i got better results in capping the jerk so it permitted to avoid placing any hard limit for the acceleration.
To come back about precision, with a fixed point value of , it limited the project within a range of blocks:
I could have increased this by doing the division first before multiplying back the element, but I would have lost precision for it.
Just a quick remark about how mcf is once more boring to execute what we want to do. actually takes up to 10 commands to be executed member per member, however once optimized, it can be done in only 6 operations.
scoreboard players operation .F_ab temp = .m_a temp
scoreboard players operation .F_ab temp *= .m_b temp
scoreboard players operation .F_ab temp /= #1000 const
scoreboard players operation .d_ab temp *= .d_ab temp
scoreboard players operation .F_ab temp *= #G const
scoreboard players operation .F_ab temp /= .d_ab temp
This is a very simple example with a low number of commands, but once optimized changing any of the parmameters (or adding new ones) might break the algorithm (or permit new optimizations).
I keep that in mind for a possible future project.