Commit graph

143 commits

Author SHA1 Message Date
ostermine
cb39ed464a use double precision for positions of entities and players
Transform::pos, Hitbox::position and Player::position were floats. At
65k blocks the float step is 8 mm, at 1M it is 6-12 cm, at 30M it is
2 m. The physics moves a body by 3 cm or less per substep and pushes it
out of a wall by 10 cm or less: steps got rounded to the grid (the body
changed its speed, then stopped), the AABB of a body was off by a float
step and gave false collisions with the blocks around.

Positions of bodies, entity transforms, players, spawn points and the
skeleton position interpolation are worldvec3 now. Collisions are still
calculated in floats, but in the coordinates relative to the block the
body is in: the solver takes the origin, block lookups and hitboxes of
other bodies are shifted by it, the result is added back in doubles.
So the precision of the physics is the same anywhere in the world.

A calculated sensor is stored relative to the position of its entity.
Entities::getAllInside takes the corners in doubles,
Entities::hasBlockingInside takes the origin of the AABB.

The save format does not change: positions are written as numbers
(float64) as before, saves are compatible in both directions. Lua
functions keep their signatures, they only stop rounding to float.
2026-11-12 10:05:07 +03:00
MihailRis
a7ad219261 test environment (sky) 2026-05-12 02:02:06 +03:00
MihailRis
5583734bc2 refactor 2025-08-09 22:43:06 +03:00
MihailRis
799d712447 update ContentGfxCache 2025-07-24 22:51:53 +03:00
MihailRis
1bdb5c3145 add dv::to_value for std::vector 2025-04-22 19:30:25 +03:00
MihailRis
7749675a61 add EnumMetadata 2025-04-13 13:53:59 +03:00
MihailRis
881edb7b28 rename keycode, mousecode enumerations 2025-04-02 17:39:31 +03:00
MihailRis
3beafe953f add observer_handler class 2025-04-02 14:55:53 +03:00
MihailRis
b3feb5945b reduce extra includes 2025-04-02 14:55:53 +03:00
MihailRis
3d22de761f fix compiler warnings (GCC + Clang) 2025-03-20 22:04:29 +03:00
MihailRis
84d5b5d1a8 add dv::merge & update EnginePaths::readCombinedObject 2025-02-20 22:08:09 +03:00
MihailRis
f2101f6504 add entity:set_enabled(...) 2025-01-21 05:31:07 +03:00
MihailRis
0494db9187 fix infinite block fields conversion requests 2025-01-18 21:00:58 +03:00
MihailRis
17dcbe98ab fix clang-check warnings 2025-01-01 16:06:44 +03:00
MihailRis
a43002cf54 add 'def' to settings info 2024-10-30 11:50:39 +03:00
MihailRis
26d92750f2 fix dv::is_numeric 2024-10-18 11:02:48 +03:00
MihailRis
cc6891dde8 feat: boolean type support finally 2024-10-14 19:38:30 +03:00
MihailRis
e7d7753d47 Merge branch 'main' into heightmaps 2024-10-13 12:20:21 +03:00
MihailRis
abe004c3d5 revert operator<< overload of dv::value 2024-10-12 17:37:06 +03:00
MihailRis
d14548cff8 feat: toml lvalues support 2024-10-12 00:23:52 +03:00
MihailRis
66825d62aa feat: toml arrays and inline tables support 2024-10-11 20:43:37 +03:00
MihailRis
ea9ad08bfd Merge branch 'main' into heightmaps 2024-10-03 19:12:37 +03:00
MihailRis
ab53922474 extend user block fields check 2024-10-03 16:08:40 +03:00
MihailRis
8f1eae4330 add dv::object(std::initializer_list<dv::pair>) 2024-10-03 01:32:57 +03:00
MihailRis
5ff00df527 micro refactor 2024-10-02 20:24:50 +03:00
MihailRis
87cf6c41bc update block.get_field, block.set_field and fields-related docs 2024-10-02 17:56:19 +03:00
MihailRis
99e8764907 fix setAscii, setUnicode 2024-10-01 22:06:57 +03:00
MihailRis
024dccb135 fix: no blocks data conversion if no data loss detected 2024-10-01 21:05:08 +03:00
MihailRis
bc05716772 implement blocks data conversion 2024-10-01 19:08:45 +03:00
MihailRis
fc99343fb5 add block.get_field(...), block.set_field(...) 2024-09-30 18:55:01 +03:00
MihailRis
bf9f81a98c Merge branch 'main' into heightmaps 2024-09-19 15:16:14 +03:00
MihailRis
28b6ec2a0e Merge branch 'main' into blocks-metadata 2024-09-19 14:51:47 +03:00
MihailRis
3953583605 minimize extra dv::value copies 2024-09-19 13:45:32 +03:00
MihailRis
bd176f24e1 add some 'noexcept's 2024-09-19 12:36:00 +03:00
MihailRis
fa3e98e3e4 fix 2024-09-19 04:30:01 +03:00
MihailRis
4ae141d982 limit dv::value templated constructors & refactor 2024-09-19 04:22:57 +03:00
MihailRis
827a09b1d0 refactor data/dv & update data/dv-related tests 2024-09-19 00:40:06 +03:00
MihailRis
d6d07f0a3a update dv::elementreference::get(T) integer specializations 2024-09-19 00:23:24 +03:00
MihailRis
3613e31909 update dv::value::operator=(T) integer specializations 2024-09-19 00:10:15 +03:00
MihailRis
13edcd8700 add missing include 2024-09-18 23:56:06 +03:00
MihailRis
3717af34ae add missing include 2024-09-18 23:42:29 +03:00
MihailRis
34d2e6d400 migrate from dynamic::Value to dv::value & total erase namespace 'dynamic' 2024-09-18 23:31:18 +03:00
MihailRis
d3ba4b2e3e update move assignment 2024-09-17 14:04:23 +03:00
MihailRis
afbef198c6 add dv::value.operator=(value&&) 2024-09-17 13:41:02 +03:00
MihailRis
a886404940 optimize move constructor 2024-09-17 01:17:27 +03:00
MihailRis
27c8307562 add dv::value support to binary_json 2024-09-16 22:53:27 +03:00
MihailRis
ceaa676a3a add dv::value support to json::stringify & add dv.cpp 2024-09-16 21:36:35 +03:00
MihailRis
9badc0a022 add dv::value.getType(), .empty() 2024-09-16 20:49:39 +03:00
MihailRis
9b26758519 add dv::value.size/length, .asObject() 2024-09-16 20:21:28 +03:00
MihailRis
3bc329041a add dv::list(initializer_list<value>) 2024-09-16 19:43:20 +03:00