499 Commits

Author SHA1 Message Date
IntegratedQuantum
69920c343d Don't access the internals of the ChannelChunk.
This makes it easier to swap the implementation for future compression attempts.
2024-02-26 14:59:00 +01:00
IntegratedQuantum
d4f9270fa9 Don't call the compiler twice in the scripts.
Zig sometimes doesn't cache stuff correctly.
In the presence of this bug the game might be recompiled in the second compiler command.
This doubled compile times in the worst case.
2024-02-25 10:39:16 +01:00
IntegratedQuantum
50c20aa28f Don't send empty chat messages(which currently crashes) and display the correct name in the change name gui. 2024-02-16 19:47:54 +01:00
IntegratedQuantum
950933b03f Fix an issue in List.insert*
Fixes #270
2024-02-16 19:40:24 +01:00
IntegratedQuantum
2ba6bfe2bd Officially add the fog testing biome from my videos. 2024-02-14 16:19:10 +01:00
IntegratedQuantum
d08096057f Improve the StackAllocator so it allows all kinds of allocation patterns.
This allows using the StackAllocator for more data structures and library functions.
Fixes #268
Fixes #95 (at least to the point where I can't do anything about it)
2024-02-08 18:01:43 +01:00
IntegratedQuantum
0177099f6b Reduce GPA usage in lighting.zig to improve CPU usage. It's now close to 90%. 2024-02-07 19:00:16 +01:00
IntegratedQuantum
534ca665cb Improve thread utilization from ~40% to ~70%
This is done by reusing the lightQueue instead of allocating new ones(→less locking in the allocator) and by avoiding too frequent task priority updates(→less locking when adding new tasks).
The remaining 30% will hopefully be done by improvements to the zig GPA.
2024-02-07 13:16:20 +01:00
IntegratedQuantum
acd777bf13 Improve light propagation by not walking back in the direction that it came from.
Should be about a 16% improvement and a reduction in scheduled mesh updates.
2024-02-07 11:33:28 +01:00
IntegratedQuantum
781ca89aff Use MemoryPool for chunk and lighting data.
Temporarily fixes #263
2024-02-05 21:33:56 +01:00
IntegratedQuantum
1cca3a5769
Merge pull request #261 from PixelGuys/better_error_handling
Better error handling, instead of merely `try`ing.
2024-02-01 17:46:15 +01:00
IntegratedQuantum
3007dfa15f Properly cleanup resources to avoid leaks on errors. 2024-02-01 17:22:17 +01:00
IntegratedQuantum
74c896c969 Handle errors locally instead of letting them bubble up into the main functions. 2024-01-31 22:42:20 +01:00
IntegratedQuantum
05769cc765 Some improvements to error handling 2024-01-31 15:35:15 +01:00
IntegratedQuantum
2c33f3779d Switch to a self-made list data structure that doesn't return OutOfMemory errors. 2024-01-30 16:34:40 +01:00
IntegratedQuantum
de004841b7 Handle OutOfMemory errors centrally for the globalAllocator and derivatives.
To let the rest of the code know about this decision I implemented a wrapper over the Allocator interface which cannot fail.

This is just the first step in the upcoming refactoring attempt.
2024-01-29 17:22:20 +01:00
IntegratedQuantum
7565223260 Avoid anyerror in gui components by explicitly giving the error set. 2024-01-26 10:46:36 +01:00
IntegratedQuantum
d215755415 Fix undefined behavior when creating the item slot string.
Fixes #260
2024-01-26 10:10:32 +01:00
IntegratedQuantum
178489b044 Merge All ItemSlot types into one struct.
Fixes #240
2024-01-26 00:14:51 +01:00
IntegratedQuantum
3c6147dc6a Fix double free. 2024-01-25 22:22:35 +01:00
IntegratedQuantum
bcdca0bfdd Catch errors in the audio initialization and continue the game instead of panicing
Should fix #255
2024-01-25 22:13:07 +01:00
archbirdplus
fd332139d7
Progress on making compile errors easier to debug for new users: #241, #251, #252 (#254)
* Rename run_release scripts to run_OS (#241)

* Update README with new script names (#241)

* Fix run_windows infinite loop

* Make debug_linux more verbose.

* Make windows script errors match linux

* Automatically set working directory (#252)

* Remote quotes from echo commands in run_windows

* Replace zig run with zig build run

* Replace spaces with tabs in run scripts.

* Make 'Building Cubyz' message more accurate

* Have run scripts check the machine architecture.

* Add failsafe for unrecognized architecture; erase scratch work in debug_windows

* Replace more spaces with tabs in debug_linux

* Linux run script: don't pause if debug build or NO_PAUSE

* Windows run script: do not pause in debug builds or if NO_PAUSE

* Escape a paren

* Fix x64 typo

* Delete logs about failing to build

* Use `call` to call the batch script on windows

Without `call` windows won't execute the lines after calling the batch script.

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2024-01-23 19:02:51 +01:00
IntegratedQuantum
6ce09c52cd
Update README.md, adding a guide to run Cubyz without using git 2024-01-21 13:54:28 +01:00
IntegratedQuantum
83f04993e8 Fix ReleaseSafe bug caused by undefined memory.
Fixes #169
2024-01-21 12:52:16 +01:00
IntegratedQuantum
08704ef4aa Don't load meshes until all surrounding (3×3×3) chunks finished light propagation.
This fixes a bunch of lighting bugs:
Fixes #219
Fixes #170
Fixes #163
2024-01-20 18:23:09 +01:00
IntegratedQuantum
62d4920869 Cleanup some code and fix a data race. Mesh generation should also be a bit faster now. 2024-01-17 19:21:22 +01:00
IntegratedQuantum
d37589397c Update the dependencies, fixing an issue with cross compilation to windows. 2024-01-16 21:32:34 +01:00
IntegratedQuantum
9b51d3e47d Add new stone texture
Co-Authored-By: careeoki <122191047+careeoki@users.noreply.github.com>
2024-01-15 19:59:08 +01:00
IntegratedQuantum
25e4ba6b84 Split up chunk.zig and renderer.zig
I'm getting tired of scrolling around in those large files.
2024-01-15 18:55:33 +01:00
IntegratedQuantum
5160f22e5c Don't break/place blocks while in the inventory. 2024-01-12 22:59:56 +01:00
IntegratedQuantum
a542fb73e4 Configure glass to correctly absorb light from the lighting system. 2024-01-12 21:55:47 +01:00
IntegratedQuantum
8fc7641d16 Quick and Dirty block breaking, and fixed a lighting bug when breaking blocks. 2024-01-12 21:45:23 +01:00
IntegratedQuantum
8a8af8e46f Update zig version 2024-01-12 20:58:58 +01:00
IntegratedQuantum
d3ad1b4d01 Use bitwise operations to extract data from gl_vertexID.
This seems to fix problems for some people, probably fixing some rare hardware bug here.
2023-12-30 23:22:47 +01:00
IntegratedQuantum
e8f62d5660 Fix #244 and improve performance of light updates. 2023-12-23 20:22:02 +01:00
IntegratedQuantum
4330f33d36 Improve priority calculation for light maps so it always generates the light maps before the contained terrain.
Fixes #243
2023-12-21 22:10:55 +01:00
IntegratedQuantum
f774ccf370 Remove lighting when breaking blocks.
fixes #221
2023-12-21 21:22:39 +01:00
IntegratedQuantum
89438a2e2a Fix problem with negative item colors, which mostly come from the java version. 2023-12-20 19:58:58 +01:00
IntegratedQuantum
3eb3e2b358 Add sunlight. 2023-12-20 14:25:56 +01:00
IntegratedQuantum
dcb76a77a8 Add void caverns. 2023-12-10 13:27:19 +01:00
IntegratedQuantum
05bc3720eb Improve log message when the download process is finished. 2023-12-09 19:55:00 +01:00
IntegratedQuantum
2728e053a5 Avoid loading meshes twice, when receiving a chunk twice from the server (which happens when going out of render distance of a chunk for a short period of time). This caused a ton of problems.
Fixes #208
Should fix #224
2023-12-07 21:11:13 +01:00
IntegratedQuantum
7c1ec82b03 Placing blocks is actually doable (no lagspikes)
Moving the mesh update at high priority into the threadpool, allows for faster and more efficient(previously meshes may have been updated multiple times in a row) updates.
fixes #223
2023-12-07 19:57:51 +01:00
IntegratedQuantum
451cac2923 Use a CircularBufferQueue for lighting instead of a PriorityQueue.
A CircularBufferQueue means that we might revisit some points, for example when there is a dim and a bright light source.
However in practice the performance impact of using a PriorityQueue is huge, so this edge case doesn't matter really.

This makes light propagation about 20 times faster and should help with #223, but it doesn't seem to actually make a difference. There is likely something else going on here.
2023-12-07 16:58:50 +01:00
IntegratedQuantum
048b48e5c7 Update lights when placing emissive blocks and fix ambient occlusion
The ground had no absorption. Fixes #222
Helps with #221
2023-12-05 20:09:52 +01:00
IntegratedQuantum
58b2a2627b Implement light propagation.
Fixes #61
2023-12-04 21:49:54 +01:00
IntegratedQuantum
77716b4679 Change how emission textures work. Also fixed a bug in block placing.
Emission now work as a base light, rather than adding to the ambient light.
This makes them produce the same light strength and bloom regardless of the environment.
2023-12-01 19:45:51 +01:00
IntegratedQuantum
91a52e6dae Add anisotropic filtering and make leaves transparent again. 2023-12-01 16:29:32 +01:00
IntegratedQuantum
7d23411a22 Goodbye voxel models 👋
Fixes #215
Closes #164
Closes #162
Closes #160
Closes #150
Closes #145
2023-12-01 15:50:31 +01:00
IntegratedQuantum
2a46592454 Fix integer overflows when the chunk mesh memory gets past 2 GiB.
This was causing corrupt and missing meshes.
2023-11-30 00:38:49 +01:00