Skip to content

Signs#1446

Merged
IntegratedQuantum merged 41 commits into
masterfrom
signs
May 31, 2025
Merged

Signs#1446
IntegratedQuantum merged 41 commits into
masterfrom
signs

Conversation

@IntegratedQuantum

@IntegratedQuantum IntegratedQuantum commented May 14, 2025

Copy link
Copy Markdown
Member
  • Rotation (already merged)
  • basic GUI
  • sign models and textures
  • sign blocks
  • update the text on the client
  • Figure out block entity rendering
  • Render the text to a texture on update
  • Render the texture in the world in the location of the sign
  • Use varint instead of u32 for storing the block data lengths, (now, while we can still change it)
  • Sync the text with the server and all clients
  • Figure out block entity storage on the server
  • Send the entity data of the initial chunk
  • Store the text on the server
  • Set the chunk as changed whenever a block entity data update happens, so we actually store it
  • Disable or figure out optimized local chunk transmission
  • fix memory leak
  • Rethink some of the API (do we need onPlace/onBreak, when there is unload and updateData?)
  • Remove the background shadow from text, it produces too much aliasing
  • Figure out if the default should be black or white
  • Correctly center the text
  • Why are newlines not working?
  • 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.
  • Set the text margin and sizes reasonably
  • Make sure the GUI fits with the sign width
  • Create an issue for configurable sign texture size and configurable default color

fixes #367

Comment thread src/gui/windows/sign_editor.zig Outdated
@Argmaster

Argmaster commented May 29, 2025

Copy link
Copy Markdown
Collaborator

oPlace / onBreak can be used to implement trap side effects, like spawning hostile entities, exploding etc so they are not the same as onLoad / onUnload. They could be merged into onInteract tho if you really want to, with some enum parameter (ehh switches again) since they are kind of player interaction. But what if we want a block that converts into different block on break? Could be treasure chest that requires a key and converts into a model with no padlock, likely other stuff?

@Argmaster

Copy link
Copy Markdown
Collaborator

How do we make rendering for BlockEntities scalable? For example so mods can make double sided signs? Animations, dynamic models? That can be truly an end of rotation era and begining of dynamic models era.

@IntegratedQuantum

Copy link
Copy Markdown
Member Author

oPlace / onBreak can be used to implement trap side effects, like spawning hostile entities, exploding etc so they are not the same as onLoad / onUnload.

This could also be done in the new onUpdate functions, which are also sensitive to changes and not just create/destroy.

@IntegratedQuantum

Copy link
Copy Markdown
Member Author

How do we make rendering for BlockEntities scalable?

I plan to just add a render function which gets executed once per frame for each type, then the type can iterate over all of its block entities.

@IntegratedQuantum

Copy link
Copy Markdown
Member Author

Yeah, that's an issue with the font, it has that problem with all kinds of emoji

@ikabod-kee

Copy link
Copy Markdown
Collaborator

I'll have to check what that emoji looks like in LanaPixel

fn apply(_: usize) void {
const visibleCharacterCount = main.graphics.TextBuffer.Parser.countVisibleCharacters(textComponent.currentString.items);
if(textComponent.currentString.items.len > 500 or visibleCharacterCount > 100) {
std.log.err("Text is too long with {}/{} characters. Limits are 100/500", .{visibleCharacterCount, textComponent.currentString.items.len});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this is a temporary solution, that is a poor user experience. But for sake of innovation it can stay I guess.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it's solved for other limits as well.

@Argmaster Argmaster May 30, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

But that was not advertised ^
ie. it doesn't consistently error, it sometimes truncates part of the message.
(I am not dumb, I clicked apply and reopened to make screenshot)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah it's poor user experience.
My plan is to have the error pop-up show the actual error message in the future.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best user experience would be to actively disable the apply button / showing label when message exceeds the limits and enabling it when its ok.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ie. it doesn't consistently error, it sometimes truncates part of the message.

Yeah, but we cannot really fix that because this depends on the font size and such.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best user experience would be to actively disable the apply button / showing label when message exceeds the limits and enabling it when its ok.

Yeah, right

@RanPix RanPix May 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could limit the amount of text by calculating the size taken by each character in a line.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I turned both into issues #1554 #1555

Comment thread src/block_entity.zig Outdated
Comment thread src/renderer/chunk_meshing.zig
Comment thread src/renderer/mesh_storage.zig Outdated
Comment thread src/renderer/mesh_storage.zig Outdated
Comment thread src/renderer/mesh_storage.zig Outdated
Comment thread src/server/storage.zig
Comment thread src/server/storage.zig Outdated
Comment thread src/server/storage.zig
if(reader.remaining.len == 0) return;

const compressionAlgo = try reader.readEnum(BlockEntityCompressionAlgo);
std.debug.assert(compressionAlgo == .raw);

@Argmaster Argmaster May 30, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why assert here but only try in block data?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently only raw data is handled and I want there to be an immediate crash here when someone tries to add a first compression algorithm and forgets to change it here.

@Argmaster

Argmaster commented May 30, 2025

Copy link
Copy Markdown
Collaborator

image

image

There are some problems with it, since signs can be placed on signs and the block entity data isn't updated correctly
@careeoki

Copy link
Copy Markdown
Contributor

It's working fine for me now btw

just something i noticed while playing
@IntegratedQuantum IntegratedQuantum merged commit eaaf524 into master May 31, 2025
1 check passed
@IntegratedQuantum IntegratedQuantum deleted the signs branch June 7, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signs

6 participants