1083 Commits

Author SHA1 Message Date
Krzysztof Wiśniewski
5845da7ca9
Add /rotate command (#1225)
* Revert "Remove rotate command"

This reverts commit 3a84e03d158e5cc038ae3e936384c348431a9ac4.

* Fix stair rotation

* Add rotate fn to Blueprint

* Apply suggestions from code review

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Replace cos sin with switch

* Add angle parameter to /rotate

* Update src/blueprint.zig

* Apply review suggestions

* Fix formatting issues

* Update src/rotation.zig

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-03-22 19:33:53 +01:00
Krzysztof Wiśniewski
e815d98b89
Refactor server.zig to use BinaryWriter and BinaryReader (#1213)
* Refactor update() in server.zig

* Refactor User.receiveData() to use BinaryReader

* Use network.networkEndian
2025-03-22 16:12:46 +01:00
IntegratedQuantum
1268f8e95e Allow specifying all 16 model textures via its index
fixes #1144
2025-03-22 14:26:59 +01:00
IntegratedQuantum
01cfb786aa Use a dedicated ModelIndex and QuadIndex to make more clear what it is and how to use it.
I also bumped model index size to 32 bits (storage is currently limited to 20 bits though)
We can afford this, since it's CPU side and it's only stored perblock type.
2025-03-22 10:45:09 +01:00
Krzysztof Wiśniewski
37eb01ec37
World edit commands for Cubyz (#1141)
* Add basic worldedit commands

* Fix style issues

* Fix style issues and command names

* Fix style issues

* Store worldedit command data in User

* Fix blueprint memory leak

* Add loading from Zon

* Use Block instead of u32

* Add binary storage format

* Add binary blueprint loading

* Fix formatting in copy.zig

* Use BinaryWriter for writing

* Use ReaderWriter for reading

* Add delete command

* Update src/blueprint.zig

* Apply review suggestions

* Fix formatting issues

* Update src/blueprint.zig

* Fix formatting issues

* Fix compilation issue

* make pos1 and pos2 null initially and also show the selection on the client

* fix issue

* Fix formatting issues

* Add deselect command

* Update src/blueprint.zig

* Add clone to Blueprint

* Convert to manual serialization

* Apply review suggestions

* Use Array3D

* Apply suggestions from code review

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Apply review suggestions

* Reorder functions

* Rename

* Apply review suggestions

* Apply review suggestions

* Fix outlines

* Remove append

* Apply review suggestions

* Update src/blueprint.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Replace index with dash

* No green it is

* Update src/server/command/worldedit/pos2.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Update src/server/command/worldedit/pos2.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Update src/server/command/worldedit/pos1.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Apply review suggestions

* Abstract file io to struct

* Revert "Abstract file io to struct"

This reverts commit f0bbe50aad0887d562069cb9ce18085f3de6e4cb.

* Add openBlueprintsDir function

* Apply review suggestions

* Apply review suggestions

* Update src/server/command/worldedit/blueprint.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Apply review suggestions

---------

Co-authored-by: OneAvargeCoder193 <mgiakimenko@outlook.com>
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-03-20 22:07:26 +01:00
Carrie
302544bbcb
Add cactus flowers, tussock, and cactus top texture (#1195)
* Add cactus flowers, tussock, and cactus top texture

* minor cactus flower texture tweaks

* Gradient cactus flower
2025-03-19 21:45:12 +01:00
Krzysztof Wiśniewski
f0eb9f4f5a
Add list palettes and item palette (#1190)
* Add list palettes and item palette

* Fix block-item assignments

* Remove initEmpty

* Replace This() with Palette

* Update src/assets.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Fix duplicated keys in legacy palette issue

* Remove redundant errdefer

* Some more figuring out order of registering

* Remove assertion breaking migrations 2to1

* Apply review suggestions

* Add error log for block and item ID conflict

* Remove migrations file

* Update src/assets.zig

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-03-18 21:25:04 +01:00
IntegratedQuantum
9226d51a8f Add missing trailing comma 2025-03-18 21:21:24 +01:00
IntegratedQuantum
7ff639bf62 Allow structures on the water surface with .generationMode = .water_surface
fixes #841
2025-03-18 21:16:20 +01:00
Krzysztof Wiśniewski
112b1dbc9f
Add rotateZ for all rotations (#1197)
* Add rotateX rotateY rotateZ for all rotations

* Update src/rotation.zig

* Precompute all stair rotations

* Add rotateZ to Planar

* Add rotate functions to Block

* Fix formatting issues

* No X and Y rotations

* Apply suggestions from code review

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Remove z

* Precompute all Z rotations

* Fix Degrees enum values

* Apply review suggestions

* Update src/rotation.zig

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>

* Apply review suggestions

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-03-18 20:01:05 +01:00
IntegratedQuantum
6f26dde472 keepOriginal is now specified in the biome and can be used for subbiomes.
fixes #1135
2025-03-17 21:30:08 +01:00
IntegratedQuantum
2f801c07f4 Define itemdrop gravity in the file and make itemdrops less floaty. 2025-03-17 20:47:38 +01:00
IntegratedQuantum
59fdd1321e Fix formatting 2025-03-17 17:53:27 +01:00
IntegratedQuantum
62f6c5a106 Make sure sub biomes never extent beyond their parent biome.
Also allow subbiomes to extent further if their parent radius is not precisely known.

fixes #917

fixes #1027
2025-03-17 17:45:58 +01:00
IntegratedQuantum
e7ecd161ce Improve how chunk meshes store their mesh data to avoid needless copies and needless allocations.
Instead of storing 14 different array lists, the parts of the mesh are now constructed on the stack and then directly inserted into the full list (which I abstracted into a generic data structure)

fixes #1188

makes #182 less severe (it is now overshadowed by #1202)
2025-03-13 21:59:13 +01:00
Carrie
32269f1f84
New branch textures (#1200)
* Birch branch and start of mahogany branch textures

* Do all the other ones and tweka mahogany
2025-03-13 20:59:22 +01:00
OneAvargeCoder193
35fedba2c6
Change branches so that the textures can be rotated (#1183)
* add pipes, which are like branches but you can have different textures on each mode

* fix formatting

* remove testing block

* fix more formatting issues

* fix more formatting issues

* simplify fromRelPos

* fix fromRelPos and give pipe same properties as branch

* fix flashing dots caused by floating point inaccuracies

* remove debug object

* fix formatting issues

* fix a couple things

* remove debug textures

* fix formatting and also make dir an enum

* fix more formatting issues

* remove branches

* rename pipe to branch

* remove floating point fix

* remove branch model

* Add back branches and add temporary textures

* add back the branches

* fix some stuff

* small changes

* fix compiler error

---------

Co-authored-by: Carrie <carriecapp9@gmail.com>
2025-03-12 18:27:28 +01:00
Krzysztof Wiśniewski
4d7905ce0f
Refactor itemdrop.zig to use BinaryReader (#1189)
* Refactor readPosition to use BinaryReader

* Refactor getPositionAndVelocityData to use BinaryWriter

* Update src/itemdrop.zig
2025-03-11 22:15:23 +01:00
IntegratedQuantum
39fe3bd1a7 Replace tail call recursion in gui.zig with a standard while loop.
This brings us one tiny step closer to overlapping with the set of supported features of the x86 backend.
2025-03-11 21:59:05 +01:00
IntegratedQuantum
4bdf1240b8 Fix ThreadPool trueQueueSize
and along the way I also found a task signaling mistake
And I also fixed memory leaks introduced in the previous PR.

fixes #1193
2025-03-11 21:40:15 +01:00
IntegratedQuantum
2e7372580f Reset models and rotation modes when leaving the world.
fixes #1173
should fix #1167
2025-03-11 21:13:01 +01:00
Krzysztof Wiśniewski
18dbcc4d4f
Double free reported in GUI code (#1191)
* Fix double free

* Update src/gui/windows/delete_world_confirmation.zig
2025-03-11 20:32:15 +01:00
Krzysztof Wiśniewski
0472091d7c
(Probably) better hashGeneric (#1187)
* Make hash function more complicated

* Change seed value for array and vector hashes

* Fix formatting issues

* Fix formatting issues

* Update src/server/terrain/biomes.zig
2025-03-11 19:45:57 +01:00
IntegratedQuantum
b13e835a21 Add memory pools to all terrain generation data structures. 2025-03-09 20:44:05 +01:00
IntegratedQuantum
2452aef769 Add an allocator for the palette compressed chunk data. 2025-03-09 20:08:48 +01:00
IntegratedQuantum
50de67fca1 Introduce our own MemoryPool type for easier locking, more diagnostics and safety. 2025-03-09 17:32:55 +01:00
IntegratedQuantum
f73a36855b Update to the new hash format.
fixes #1186
2025-03-09 17:21:53 +01:00
IntegratedQuantum
09fc516828 Move all the allocators to a separate file. They can now be imported with main.heap (analogous to std.heap)
I also removed the unused BufferFallbackAllocator which was from a time where I was still experimenting with different allocators.
2025-03-09 16:26:41 +01:00
Carrie
3c7231cb43
Darken grass plants for better contrast (#1182)
* Make grass plants darker for better contrast

* Make grass plants blend into grass blocks
2025-03-09 12:57:38 +01:00
archbirdplus
449e9df7e3
Fix page sizes (#1184)
* update VirtualList to new page size API

* Resolve TODO

mprotect needs its slices page-aligned. Since the VirtualList range
is contiguous, using a larger page size wouldn't necessarily reduce
memory anyways. And since pageSize() will only get called when
allocating, it is not particularly expensive.

* replace pageSize() with page_size_max in comptime

* determine maxSizeBytes at runtime

* remove assertion

* add aarch64 linux to CI

* revert CI
2025-03-09 12:52:13 +01:00
IntegratedQuantum
b5df364ab2 Improve DynamicPackedIntArray.resize using a bit-interleaving algorithm, instead of fetching and putting the values one by one.
fixes #322 (SIMD would be even faster, but at 0.05% of the total runtime, it doesn't make sense to go that far)
2025-03-09 12:00:31 +01:00
IntegratedQuantum
435d22083d Fix formatting 2025-03-08 14:17:17 +01:00
IntegratedQuantum
588e12fcdb Restrict palette compression to power of 2 bitSizes and improve the addressing to use aligned reads.
This does make it slightly faster, and due to the missing padding bytes it also slightly reduces memory usage.

fixes #443
would make #322 easier
2025-03-08 14:01:15 +01:00
IntegratedQuantum
b303244773
Run the zon format check with our zig fmt (#1175)
* Format all the zon assets to prepare for running the the format check with our zig fmt

* Update ci.yml

* Remove zon files from the old formatter

* Add a formatting violation to test the CI

* Undo the check
2025-03-07 22:34:55 +01:00
ikabod-kee
5a9e537ed4
Birch, Thin Birch + Rare Chopped Forests (#1170)
* A

* Added Thin Birch Biome

* Density

* Changes

* Changes 2
2025-03-07 22:08:38 +01:00
Carrie
f9c5e4bb98
Glimmergills and Glimmergill caves (#1174)
* Add glimmergills and glimmergill caves

* Lower glimmergill cave height

* Formatting
2025-03-07 22:07:44 +01:00
IntegratedQuantum
17b8c8d8b6 Use the equality operator instead std.meta.eql for packed structs.
progress towards #1160
2025-03-07 21:07:21 +01:00
Krzysztof Wiśniewski
832f5e7e08
Refactor ClientEntityManager.serverUpdate to use BinaryReader (#1171)
* Use ReaderWriter for reading

* Reformat switch

* Apply review suggestions

* Remove redundant comptime

* Remove message length check
2025-03-07 20:49:17 +01:00
Krzysztof Wiśniewski
867e908981
Refactor ChunkCompression to use BinaryReader and BinaryWriter (#1162)
* Refactor compressChunk to use BinaryWriter

* Refactor decompressChunk to use BinaryReader

* Back to fat switch we go

* Yeet  // @import("../utils.zig");

* Update src/server/storage.zig
2025-03-07 20:38:22 +01:00
qFelix
2b3547d103
Simplified Block Touch Detection (#1143)
* Add block touch detection

* Fix touch detection syntax errors

* Remove Whitespace

* Fix off by one in negatives

* Remove Block Touch Detection

* Simpler touch detection as suggested by Quantum

* Remove touchRetraction because for some reason it is no longer needed

* Touch Functions are now function pointers

* Remove unwanted debug prints

* Add parameter names to TouchFunction declaration

* Add error check

---------

Co-authored-by: gfh <@>
Co-authored-by: SuperIceG <102669377+SEGenjoysBlivits@users.noreply.github.com>
2025-03-06 23:30:33 +01:00
IntegratedQuantum
471210f585 Use array @splat
progress towards #1160
2025-03-06 22:08:15 +01:00
Krzysztof Wiśniewski
9d786abcb5
Refactor RegionFile to use BinaryReader and BinaryWriter (#1159)
* Refactor RegionFile to use BinaryReader for loading

* Refactor RegionFile to use BinaryWriter for writing

* Apply review suggestions

* Add trace logging

* Restore region version mismatch message

* Update src/server/storage.zig

* Rename chunkSizes to chunkDataLengths

* Remove redundant whitespace

* Replace readAlloc with readSlice
2025-03-06 21:34:34 +01:00
Carrie
81bb084997
Branches for all wood types + item textures and recipes (#1149)
* Add all branch variants, item textures, recipes

* Delete unused textures

* Fix indentation
2025-03-06 21:32:39 +01:00
Krzysztof Wiśniewski
ac43b7128e
Add biome migrations to mitigate damage after biome renames (#1157)
* Add biomes migrations

* Fix error on empty migration file

* Fix migrations_zig.applyBiomePaletteMigrations call

* Fix formatting issues

* Rename thingsMigrations to thingMigrations

* Change log type for incorrect migrations

* Use comptime enum for migration selection

* Fix formatting issues

* Update src/migrations.zig

* Update src/migrations.zig

* Update src/migrations.zig
2025-03-06 20:49:11 +01:00
Carrie
b497133967
Mushrooms: Bolete and Toadstool (#1165)
* Add bolete and toadstool

* Add item textures and add to biomes
2025-03-06 20:34:47 +01:00
IntegratedQuantum
4b45f4fef5 Rename file to .zig.zon 2025-03-06 20:22:41 +01:00
IntegratedQuantum
1d6ca53cf7 Add the "spawn" biome 2025-03-06 20:18:57 +01:00
ikabod-kee
07a8d4ba5c
Added Limestone Mountains and some sub-biomes (#1131)
* Added Limestone Mountains and some sub-biomes

* Changed chances

* Update base.zig.zon

* Update patchy.zig.zon

* Slight Adjustments

* Fixed the totally-not-embarrassing syntax error
2025-03-06 18:36:39 +01:00
Garrett
1eb813ff51
Reduce Cacti spawn rates (#1163)
This is my first contribution to Cubyz. There were too many cacti spawning in the desert. I adjusted the rates so they would appear more infrequently and make the desert look more natural.
2025-03-06 17:56:04 +01:00
IntegratedQuantum
a033913dbb Link X11 instead of x11
This seems to cause trouble sometimes, not sure why. The library file has a capital X, so I guess somehow there was any alias on my PC.
fixes #1148
fixes #1040
2025-03-06 15:16:35 +01:00