1199 Commits

Author SHA1 Message Date
IntegratedQuantum
84fe4088fd
Add testing to the CI (#1246)
* Update ci.yml

* Fix compilation failure of testing code
2025-03-25 21:09:53 +01:00
Krzysztof Wiśniewski
05135f9f4c
Fix biome migrations loading (#1239) 2025-03-25 19:05:42 +01:00
Krzysztof Wiśniewski
12d05a06ff
Add /undo command (#1228)
* Add undo and redo commands

* Remove unintended change

* Remove redo code

* Clean up redo code

* Use CircularBufferQueue

* Fix formatting issues

* Update src/server/server.zig

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

* Apply review requests

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-03-24 21:47:14 +01:00
IntegratedQuantum
fba10a94c2
Update CONTRIBUTING.md
Add file/namespace name convention
2025-03-24 21:30:29 +01:00
IntegratedQuantum
005fb6a3aa Fix missing newline 2025-03-24 20:38:58 +01:00
IntegratedQuantum
1c2899eafd Move rotation modes into separate files. 2025-03-24 20:33:39 +01:00
Krzysztof Wiśniewski
f5a2e3d3c1
Revert "Remove sbb blocks" (#1226)
This reverts commit 65cee0ef1202b3a85f9ac2799dc0f6b902fa4074.
2025-03-24 19:11:10 +01:00
Krzysztof Wiśniewski
d9a4e7cdd9
Extract createAssetStringID (#1229)
* Revert "Remove createAssetStringID"

This reverts commit 2c20a593e55bd84e202b9bfcbf13affb6f83fb96.

* Undo boy scout behavior

* Apply createAssetStringID to readAllObjFilesInAddonsHashmap

* Generialize ID generation

* Fix formatting issues

* Only remove the extension

* Apply review requests
2025-03-24 19:06:08 +01:00
IntegratedQuantum
1559c9d9e8
Update CONTRIBUTING.md
applying changes as suggested in a061dcb254 (r154211561)
2025-03-24 17:04:48 +01:00
IntegratedQuantum
ebf157785a Fix memory leak in the GPU buffer.
mentioned in https://github.com/PixelGuys/Cubyz/issues/1202#issuecomment-2746564753
introduced in e7ecd161ce00851240ad5bb9bcb1aa0bd69dc1d5
2025-03-24 07:51:00 +01:00
IntegratedQuantum
a061dcb254
Update CONTRIBUTING.md, specifically the style guide section
fixes #1152
2025-03-23 22:50:40 +01:00
IntegratedQuantum
42268c4b22 Allow branches to have a shell model that's always rendered and add leafy branches for all wood types. 2025-03-23 20:21:37 +01:00
Carrie
8f0693f7b0
Lily pads / adjust water reflectivity (#1221)
* Add lily pads and reduce water reflectivity

* tweka water reflectivity
2025-03-23 19:36:31 +01:00
Krzysztof Wiśniewski
07f5d823dd
Add pile rotation mode (#1216)
* Add pile rotation mode

* Fix formatting issues

* Rename to .zig.zon

* Update textures to those provided by ikabood-kee

* Add gradual block breaking

* Adapt to new model and texture changes

* New duckweed textures

* Add configurable state count

* Rename to texturePile

* Add moreData storage

* Apply review suggestions

---------

Co-authored-by: Carrie <carriecapp9@gmail.com>
2025-03-23 19:35:38 +01:00
Zachary Hall
20dfc6ba71
Add hunger, hunger bar, and related functions on the Player struct. (#1210)
* Add hunger and hunger bar
 - New functions added to Player struct in game.zig to use and heal hunger.
 - If an attempt is made to use more hunger than there is available, the player is killed.
 - Hunger bar uses placeholder icons.
 - Hunger bar is based on the health bar
 -  Hunger bar is anchored to the left of the hotbar, rather than the right like the health bar.

* Don't kill player when hunger runs out.
- Don't use hunger when there's not enough to use
- Allow for code to know if hunger was used, so that is can handle not having enough hunger.

* New hunger textures

* Desaturate the highlight a little

* Return true if hunger was already true.

* Fix formatting

* Rename hunger to energy, and fix other issues.

* Make energy synchronized between client and server

Also removes the functions that add/remove energy on the game.Player struct

* Run formatter

* Fix incorrect formatting by formatter.

* Remove AddHunger struct and addHunger function

 - Keep base operation so things like accessories and food can use it when syncing

* Fix formatting again.

---------

Co-authored-by: Carrie <carriecapp9@gmail.com>
2025-03-23 17:06:21 +01:00
IntegratedQuantum
ac9f00cb32 Add utility functions to make function pointer casting more safe.
It's now only changing the self parameter, everything else will be checked at compile-time.

fixes #1223
2025-03-22 21:24:53 +01:00
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