217 Commits

Author SHA1 Message Date
IntegratedQuantum
7aa35798be Fix chisel behavior for blocks with resistance
Until we have a proper tool for it #760 it should break the corners in one hit independently of resistance
2025-07-20 22:46:37 +02:00
codemob
f2dc3faec2
Place certain blocks on water (#1672)
Fixes #1218

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-07-20 11:10:16 +02:00
IntegratedQuantum
5a80a2d281
Speed boost when breaking a block based on leftover damage (#1658)
This makes the DPS statistic more accurate and reduces the impact from
off-by-one errors as described in #1643

fixes #1656 

@ikabod-kee please check this out
2025-07-06 21:49:45 +02:00
IntegratedQuantum
24a1fcdc69
Use world-space dithering as well as a better dither matrix to handle transparency in mipmapping/anisotropic filtering (#1641)
- [x] Prototype
- [x] Remove old code
- [x] ~~Apply this form of dithering to other shaders as well (item
drop)~~ → old dither looks better for items and display model
- [x] Can we finally remove the dither seed?
- [x] Check performance impact → it's slightly (insignificantly) faster
even
2025-06-26 20:14:54 +02:00
OneAvargeCoder193
4898012311
Use comptime modding for rotation loading (#1509)
Related to: #1507
closes #1533 

I'm pretty sure that the rest of the moving into a comptime mod
interface can be done in a future pr

---------

Co-authored-by: Krzysztof Wiśniewski <argmaster.world@gmail.com>
2025-06-17 18:13:48 +02:00
IntegratedQuantum
bf7d20f11e
Separate the face buffer based on LOD (#1609)
- reduces allocator overhead (less items in the free list of each
buffer)
- reduces the chance to run out of fake GPU memory (we can now
effectively store 50% more faces than before)
- reduces the chance to run out of actual GPU memory
- reduces height of lag spikes of buffer resizes (but increases their
frequency)
- makes it more clear in which LOD (LOD1) the main memory bottlenecks
are
- reduces the occlusion culling lag (#1161) after disocclusion of parts
of the screen (roughly halving the impact).

It however does decrease the granularity of timing information, since I
can no longer look at the passes separately, but I think that's a fair
price to pay

- [x] cleanup
2025-06-07 09:32:05 +02:00
IntegratedQuantum
eaaf524f99
Signs (#1446)
- [x] Rotation (already merged)
- [x] basic GUI
- [x] sign models and textures
- [x] sign blocks
- [x] update the text on the client
- [x] Figure out block entity rendering
- [x] Render the text to a texture on update
- [x] Render the texture in the world in the location of the sign
- [x] Use varint instead of u32 for storing the block data lengths,
(now, while we can still change it)
- [x] Sync the text with the server and all clients
- [x] Figure out block entity storage on the server
- [x] Send the entity data of the initial chunk
- [x] Store the text on the server
- [x] Set the chunk as changed whenever a block entity data update
happens, so we actually store it
- [x] Disable or figure out optimized local chunk transmission
- [x] fix memory leak
- [x] Rethink some of the API (do we need onPlace/onBreak, when there is
unload and updateData?)
- [x] Remove the background shadow from text, it produces too much
aliasing
- [x] Figure out if the default should be black or white
- [x] Correctly center the text
- [x] Why are newlines not working?
- [x] Check if a deadlock is possible on deinit --- it would be possible
only if another thread has a reference to it, which should not be the
case when unload is called.
- [x] Set the text margin and sizes reasonably
- [x] Make sure the GUI fits with the sign width
- [x] Create an issue for configurable sign texture size and
configurable default color

fixes #367

---------

Co-authored-by: Carrie <122191047+careeoki@users.noreply.github.com>
Co-authored-by: OneAvargeCoder193 <85588535+OneAvargeCoder193@users.noreply.github.com>
2025-05-31 10:49:50 +02:00
MnHs
de304e49d3
Particles (#1367)
https://github.com/user-attachments/assets/de82e298-acfb-431d-973a-2d37b9a707ae

resolves #293

---------

Co-authored-by: Krzysztof Wiśniewski <argmaster.world@gmail.com>
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
Co-authored-by: Krzysztof Wiśniewski <Argmaster@users.noreply.github.com>
2025-05-25 20:53:05 +02:00
Krzysztof Wiśniewski
53d6cc70e9
Add BaseItemIndex struct (#1445)
* Add BaseItemIndex struct

* Please fix

* Update src/Inventory.zig

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

* Sticks and stones may break my bones but pr will always need fixes

* Update src/assets.zig

* Replace break with return in Inventory.update

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-17 15:51:21 +02:00
IntegratedQuantum
3db8c22b5d Fix number of indices
fixes #1437
2025-05-12 20:28:03 +02:00
IntegratedQuantum
4d62da9ae8 Rename solid to replacable
fixes #1358
2025-05-12 18:06:21 +02:00
IntegratedQuantum
2f3a25dfb3
Draw a thicker selection box (#1435)
* Draw a thicker bounding box

* Draw an actual 3d model for the selection box.

This is done using a line model with a cubiod offset model.
2025-05-12 17:47:14 +02:00
IntegratedQuantum
c04819c5af
Compile shaders in the CI, to validate that their syntax is correct (#1427)
* Move to glslang's convention for shader file suffix

* Update ci.yml

* Oops, a mistake in the shader, how could that happen?

* Does the command error on its own?

* Update ci.yml

* Revert "Oops, a mistake in the shader, how could that happen?"

This reverts commit 869c3323f3d3b5fa607b40e7847c389a12b01f33.

* Update ci.yml
2025-05-10 12:32:51 +02:00
IntegratedQuantum
2cbc6a79d2 Add a ComputePipeline and make Shader private
fixes #1417
2025-05-09 14:12:42 +02:00
IntegratedQuantum
c2b03ff437
Add an abstraction for the Graphics pipeline (#1405)
* Add the vulkan headers from the new Cubyz-libs version

* Add a GraphicsPipeline abstraction that's based on Vulkan's pipeline parameters.

This will help get rid of all the glEnable implicit state, and it will make #102 easier.

* I'm leaving out the viewport for now, it seems that it would make migration difficult

* Small fixes and rename graphics.GraphicsPipeline to just graphics.Pipeline

* Pipelinify the UI shaders

* Fix formatting

* Pipelines everywhere

* Fix the crosshair and remove remaining glEnable and related calls

* fix format

* How many more things does it need to clear the thing correctly?

* Fix selection

* Fix bloom
2025-05-08 19:37:26 +02:00
IntegratedQuantum
5a1a824e05
Add SPIR-V compilation to ensure our shaders remain SPIR-V compatible (#1404)
* Remove unused `directionalLight` uniform

* Add glslang libraries

* Update to the new Cubyz-libs version

* Dehardcode OS-dependent library file name stuff

* Audio somehow crashes on close, not sure why but I assume it's probably because of the library being compiled with a new zig version.

* Remove irrelevant uniforms from Window uniform list

* Remove unused itemdrop uniform

* Implement SPIR-V compilation code, the actual output is discarded

* Improve linking shader errors by passing a file path

* Fix formatting
2025-05-05 20:20:11 +02:00
IntegratedQuantum
3ba4d5fd14 Explicitly specify image bindings for all sampler uniforms.
progress towards #1376
2025-05-02 15:49:01 +02:00
Krzysztof Wiśniewski
64ce0ed991
Batch block updates (#1313)
* Batch block updates

* Apply review change requests

* Allow blockUpdate to carry multiple block updates in single message

* Read until there is nothing left

* Use mesh_storage.BlockUpdate

* Break instead of boolean

* Restore client side neighbor updates

* Move side check in blockUpdate out of the loop

* Update src/utils.zig

* Fix minor issues

* Reverse ownership logic + change contains into liesInChunk

* Update liesInChunk

* No name for upadeBlock param

* Apply review change requests

* Fix formatting

* Restore onBreakClient where it should be

* Update src/renderer/chunk_meshing.zig

* Update src/renderer/chunk_meshing.zig

* Converge formatting with master

* fix formatting (https://github.com/ziglang/zig-spec/issues/38 is so stupid)

---------

Co-authored-by: IntegratedQuantum <jahe788@gmail.com>
2025-05-01 10:10:03 +02:00
OneAvargeCoder193
9181b31a6d
Add stars and a simple skybox (#1043)
* really bad and inefficient star code i think

* add stars that dont work during the day but look cool

* remove galaxy shape and replace it with a simple sphere

* add broken background

* make stars affected by fog

* make the stars additive

* remove commented code in shaders

* remove unused variables in the shader

* make the stars spin

* make stars not have bloom

* fix formatting

* temp changes

* fix formatting (still temp changes)

* switch to cubyz random numbers

* multiply star matrix in cpu instead of gpu

* changed star to be twice as big, not affect by resolution as much, and also be loaded from a texture

* remove trailing whitespaces

* remove unused constants

* simplify the code by removing a log and power

* optimizing the stars

* remove debug code

* make stars triangles instead of points

* simplify the math more

* give star ssbo unique id

* fix formatting issues

* make array multiline

* fix formatting

* remove files i accidentally added

* remove random obj file

* fix some issues

* use square distance

* fix formatting

* small change

* fix some stuff

* fix other things

* comp error

* more stuff

* fix some stuff with the stars

* test

* fix formatting

* fix more formatting

* test 2

* fixes

* changes

* changes

* fix formatting

* fixes

* remove patch
2025-04-27 20:29:19 +02:00
Krzysztof Wiśniewski
668f9d0a9a
Directional drops (#1251)
* Add some crazy complicated logic to unstuck items

* Add bouncinessFactor

* Fix formatting issues

* Use rayIntersection to determine direction of drop

* Simplify blockDrop() code

* Apply review change requests

* Send bounding box for block drops

* Rename BlockDrop to BlockDropLocation

* Apply review change requests

* Apply review change requests

* Update src/Inventory.zig

* Apply review change requests

* Remove code reversing direction for carpet

* Update src/Inventory.zig

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

* Update src/Inventory.zig

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

* Remove factors variable

* Strip types from randomOffset

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-04-27 17:29:02 +02:00
Krzysztof Wiśniewski
fde5a69cdc
Add selection wand (#1298)
* Add selection wand

* Update zon file extension

* Apply review change requests

* Simplify receive logic for worldEditPos

* Convert isServerSide to method
2025-04-25 20:49:37 +02:00
IntegratedQuantum
1b7102768f Remove the time from itemdrop rendering.
This was used for animated textures which isn't necessary anymore.
2025-03-30 12:13:15 +02:00
MnHs
f8210eb7b4
Add player item display (#1109)
* extract item model storage from itemdrop renderer to its own struct

* render player held item

* render display item on top of everything

* add custom projection matrix that ignores fov settings

* fixed item display position

* change indentation from spaces to tabs

* improved item display, added interpolation and hiding

* fix formatting

* cleanup

* cleanup, made item movement

* localize item display projection matrix

* fix formatting

* add lighting interpolation, remove item sway

* fix formatting

* switch to trilinear interpolation

* fix light interpolation

* fix formatting

* small tweaks

* small tweaks, move item hiding to f2 button

* some rendering tweaks

* fix item clipping

* resolve conflict
2025-03-30 12:09:24 +02:00
IntegratedQuantum
c2ef9aba62 Remove the root . . . . . . . . . . import, replacing it with @import("main")
To fully solve the ZLS issues I had to also add the import to the other executables.
2025-03-27 21:16:35 +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
IntegratedQuantum
17b8c8d8b6 Use the equality operator instead std.meta.eql for packed structs.
progress towards #1160
2025-03-07 21:07:21 +01:00
IntegratedQuantum
bc02bb0587
Use (an adapted version) of zig fmt to format the source code. (#1140)
* Format all the files

* Fix compilation error.

* The install scripts now patch render.zig from the zig standard library.

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update the formatter, it doesn't need to run on .zig files anymore.

* Update ci.yml

* Update ci.yml

* Add a mistake to check if it works

* IT WORKS!
2025-03-02 16:36:58 +01:00
IntegratedQuantum
e7b3bf5727 Introduce block resistance, remove breakingPower and rename power to damage.
fixes #935
2025-02-28 21:32:47 +01:00
IntegratedQuantum
6f20f71737 Calculate block damage as individual swings.
fixes #953
2025-02-27 21:19:15 +01:00
IntegratedQuantum
163db4929a Introduce modifiers that allow changing the power based on the block type.
Basically https://github.com/PixelGuys/Cubyz/issues/172#issuecomment-2685028175
2025-02-26 23:02:18 +01:00
IntegratedQuantum
54c2d2afc6 Replace blockClass with block tags.
This allows defining custom block tags, and multiple of them.

fixes #948
2025-02-26 21:11:08 +01:00
IntegratedQuantum
22488a28ae CI: Check for trailing spaces and (missing) newlines at the end of the file
fixes #737
2025-02-12 17:36:44 +01:00
IntegratedQuantum
a0663d7338 Allow sticking ores back into the ground (and other things)
fixes #982
2025-02-09 19:57:46 +01:00
IntegratedQuantum
35883591d2 Hardcode the chisel break time to 0.5 seconds, to make it easier in survival. 2025-02-08 15:30:35 +01:00
IntegratedQuantum
f8a8d19759 Fix discrepancy between client-side and server-side torch placement.
fixes #993
2025-02-02 22:42:47 +01:00
IntegratedQuantum
ee4e2a7015 Add a linear gradient to the atmospheric fog, starting at 100 blocks, reaching 0 at 1000 blocks.
fixes #961
2025-01-27 18:39:02 +01:00
ikabod-kee
0f4b93330e
Add Block Health (ft. QuantumDeveloper) (#945)
* PR!

* Rename hardness to blockHealth

* Replaced Hardness!

* Adjusted new blocks

---------

Co-authored-by: IntegratedQuantum <jahe788@gmail.com>
2025-01-23 22:35:00 +01:00
IntegratedQuantum
faaae6ff4a Add a block breaking animation
fixes #620
2025-01-22 21:32:10 +01:00
IntegratedQuantum
211641d324 Calculate the block breaking time from the block and tool properties in survival mode.
progress towards #620
2025-01-15 23:33:14 +01:00
IntegratedQuantum
9f3c63ebff Split the server mutex into multiple different mutexes that are used in smaller scopes.
fixes #864
Also fixed a data race in the itemdrop manager
2024-12-31 14:53:42 +01:00
IntegratedQuantum
0c0ca2ed15 Synchronize block breaking and placing throug the inventory synchronization system.
fixes #751
This allowed reenabling item consumption when placing blocks. Durability and item drops are still work in progress.
Currently all game modes consume items. Temporarily reverts some changes from #739, until the game mode is synchronized to the server as well.

progress towards #670
2024-12-24 23:52:11 +01:00
IntegratedQuantum
1455605387 Use a lower precision buffer for bloom calculation.
Slightly (~100 µs) improves performance of bloom, but might open up more detailed (→less jitter) bloom implementations.
2024-12-02 20:43:58 +01:00
IntegratedQuantum
154dc76c4a Place carpets in parallel to selected carpet where possible.
fixes #786
fixes #789
2024-11-26 21:39:51 +01:00
IntegratedQuantum
0d50346fad Unhardcode how chiselling is handled, given the opportunity for other rotation modes to do similar things.
Preparing for #798
2024-11-25 17:42:44 +01:00
IntegratedQuantum
1fffecb870 Only display the selection box of the currently selected submodel of torch and carpet rotation modes.
fixes #784
2024-11-25 17:00:55 +01:00
IntegratedQuantum
a0dce26ac2 Move the glPolygonOffset into a tighter scope so it doesn't affect the occlusion tests.
should fix the most severe problem of #765
2024-11-04 20:53:48 +01:00
IntegratedQuantum
377c2269cc Disable item consumption on block placement for now.
I'll figure out how to synchronize these changes in the future.
For now I'll just disable it to progress faster towards #643
2024-10-25 19:36:42 +02:00
IntegratedQuantum
bc96144b18 Fix z-fighting for stairs behind glass
fixes #696
2024-10-19 15:19:49 +02:00
ataman6
02387a099d
Add gamemode and unlimited blocks key (#739)
* Add gamemode and unlimited blocks key

* Remove separate unlimited blocks key

* Make middle click work only in creative mode

* Rewrite code a bit
2024-10-08 19:02:24 +02:00
IntegratedQuantum
3a4a695e3d Move all inventory operations that change the inventory into the Inventory struct.
Another important preparation step for #643

It does break a few things regarding inventory ui/ux, but those can be fixed over time.
2024-10-06 14:28:31 +02:00