#Chat Emotes
1 messages ยท Page 1 of 1 (latest)
This should be possible. we would just need to adapt our mention parsing code to parse arbitrary patterns, not just your specific name
also need to make sure to have img alt be :tower: so you can copy/paste it
All you need is regex for :emoji: and https://deno.land/x/[email protected]
importing regex into our rust program would increase the binary size, and prolong the download
using the web browser's regex engine could work but the code wouldn't be great
since chat messages are not too frequent, we can probably get away with the naive solution of iteratively checking every single possibility against every single instance of : in the message.
We can just implement a Parser on the Sender's side, once he send message. Parser parses only first 5(or any number of your choice) emojis and sends the message including emoji instead of text in that.
All the computation(very small amount) will happen on sender's side
and the server will also receive emoji instead of that :: text
Code would be pretty simple but if you want complex it with some additional features then I can try that too ๐
right now the chat messages are transmitted over the network as a string (raw utf8 characters), which is great for censoring and keeps everything simple
this would require something fancy like a collection of both strings, emoji, and mentions
UTF-8/Unicode supports stuff like ๐ but not :barracks:
yes, that's how the rendering would work
the svg tag or img tag with src of that file(Which will be common for all) will be sent
sending the entire barracks svg in each chat message mentioning the barracks seems inefficient to me
it's like 1+ kilobytes
So we can implement game emoji + some additional reaction emojis
We can use img ๐
with aspect ratio
Btw Why kiomet is not open source
Also I have few questions, is kiomet dependent on Node, like some special API or library. Or it can be written in Deno
because game uses Rust and and Rust + Deno are best ๐
- the img.src attribute would have to point somewhere, but we don't host the tower svg images anywhere
- allowing html into the chat seems like it could have very big security implications
Btw Why kiomet is not open source
I have hopes of eventually open-sourcing it. Right now, doing so would allow too much exploitation due to how much extra data the server sends and the client simply ignores. Changing the code to not ignore the data would constitute relatively easy visibility cheating.
Also I have few questions, is kiomet dependent on Node, like some special API or library. Or it can be written in Deno
Kiomet is entirely written in Rust + Yew framework. Rust compiles to WebAssembly, and a small JavaScript shim. I don't think it depends on node.
-
we can store them in public folder of the Svelte framework.
-
Yeah it is, I will try to see solution for it ๐
-
So you guys don't use Svelte anymore
yeah we no longer use Svelte. the next #mk48 update will port it to Yew
(full disclosure: our reason for Yew over Svelte has to do with code sharing, the benefits of Rust over Javascript, not having to serialize a bunch of props/state to JSON, and working around a small number of bugs seemingly related to Svelte)
finally some good change in source code. Node ducks in all things
JavaScript itself is pretty ducking bad, thanks to Deno it's getting better. I was going to recommend Fresh Framework by Deno team instead of node
Node libraries are bloated, a lot
and confusing, they are not standardized properly, I mean you can use cjs, but you can also use es modules
which creates lots of conflicts. So basically after long long chats, I wanted to say Node is bad
that's it ๐
I have to say I agree ๐
if you get change try Deno though, it's like Rust but with JavaScript Syntax
when I used to write node, I had callback chains about 10 layers deep
haha
now you can use try catch ๐
it's just 2 blocks to check for errors
async/await/Promise is nicer than Rust's async/await/Future support, although at the cost of performance
I have used rust little bit and it's confusing for me
yup, it's confusing for the first few months
I am always confused vector and stuff, where is array, how to write objects
after lots of searching I found out rust don't support classes but struct and impl
but I still love rust, doesn't matter I duck at it
I want to say few things btw, You guys should keep the code common for mk48 and kiomet UI. I mean the things that are supposed to be common, just keep theme separate.
vector
Vec is a dynamically sized collection similar to Javascript's Array in that you can keep calling push to add more items
where is array
you get arrays, which are fixed size collections, using [0u16; 5] syntax (creates an array of 5 u16's each storing 0
how to write objects
with struct and impl
after lots of searching I found out rust don't support classes but struct and impl
rust doesn't really support inheritance of struct
ah okay okay got it
a large part of the code will be shared, by design
some will be separate
our design allows both very well
ye that would reduce confusion and won't create conflicts
yep, as I mentioned, "code sharing" was a big reason to switch from Svelte to Yew
so how do you do OOP
ah I thought you were saying about backend + frontend but you meant both games
OOP meaning inheritance is a big mistake IMO (see: https://betterprogramming.pub/object-oriented-programming-the-trillion-dollar-disaster-92a4b666c7c7 and other criticisms)
OOP meaning dynamic dispatch, objects storing other objects and calling methods, and encapsulation are all fine principles and fully supported by Rust
you have to change your mindset a bit to express your code in an idiomatic way. once you do, you'll find that Rust can express most patterns with extreme ease, flexibility, and performance
ah I thought you were saying about backend + frontend but you meant both games
well, both!

but I love OOP
OOP's inheritance looks great in a 50 line example program, but breaks down spectacularly when a database or serialization is involved
Reason - Because I only know two - Function and OOP, I never tried any other
how often do you actually need inheritance/subclasses, though? that's the main aspect of OOP that Rust (and I) take issue with
the rest of OOP is fair game
well I do need when, building a CSS parser or any other language parser, creating a game
and little more
btw I also wanted to ask
when is team system coming to kiomet
I would love to see allies colored yellow, green, orange
when dealing with a CSS parser, you might think you need a Attribute class and a WidthAttribute/BorderAtribute subclass or something. You could instead use ```rust
enum AttributeData {
Width(String),
Border{
left: String,
right: String,
top: String,
bottom: String
}
}
struct Attribute {
data: AttributeData,
some_other_field_1: ...,
some_other_field_2: ...,
}
IMO `enum` is one of the main advantages of expressing code in Rust, because it can replace much of the need for inheritance.
see: #1020749747784536216 message
never used enums because never understood what they are
btw we are in Chat emotes
#general