Next, we have Thierry with Journey to an open source contribution.
Thank you.
So thank you for coming.
I'm Thierry Berger.
I love open source and I'm here with you today to tell you about a few open source fixes
or stories I've done.
So follow me.
Let's make things better.
I don't know about you, but I have a dream.
My dream is that different players from different backgrounds, okay, it's a problem technical,
but yeah, with different backgrounds, with different interests, players could still be
able to play together.
So you can imagine an old grandmother playing her match three game, you can see the three
candies, and she will be able to share it with her grandchild.
Hey, I'm a grandchild.
And that grandchild will be able to share that candy to another game, or like a pet's
life simulator game, something.
So even though they have different interests, they can play together.
And it's awesome, so I'm very motivated in that pitch.
So I started a hobby project by using the Bay V game engine, which is an open source
game engine made in Rust.
And the project was going smoothly until I hit a problem.
I couldn't input an ad, and it's a big problem because I want my players authenticated.
And yeah, every email address is AvanHAT, so that's a problem.
So time to fix it.
I have to tell you about my keyboard.
I'm French, I'm using Azure keyboard.
So that means I have to input ALT GRZN0 to input an ad.
And actually, behind the scenes on Windows, it's actually equivalent to control and ALT
and GRZN0.
And that control mapping is pretty important because control can have a lot of capabilities.
It can scroll with the mouse wheel, it can copy, cut-paste, it can move the cursor, it
can scroll with mouse wheel and move the cursor with arrow keys.
Well, anyway, it can do a lot of things, open the task manager and other stuff.
So I opened an issue and the library I'm using, it says bevy edui, a bridge to edui, a UI
library.
Hold the term.
But yeah, I opened that issue.
It's actually scrolling, it's a very long discussion.
You can see it now because I'm using a PDF, but yep.
And eventually we landed on a fix.
It was a very long discussion.
And yeah, I think it's pretty important, pretty interesting when discussions are way longer
than the actual fix because it really shows that communication, software development is
very important.
And yeah, so if you have a problem, just ask questions and eventually everything will
progress.
So now we fixed our at sign, we can progress, right?
That password field was my next difficulty.
I have to tell you a bit more about my project.
I want to support one-time authentication.
So when the user registers to the application, it sends an email to the user.
The user copies that email from their email client and copies that into the application,
into that password field.
And then web.
It was working fine on a native, but on web, it's a bit complicated.
So bevy edui, I told you a little bit about that, uses AR board, which is a library to
support clipboard, but it's mainly focusing on native clients.
So it's a synchronous API and web, it's a problem because we cannot really block the
browser as it would freeze the entire browser.
So it's just not allowed.
And AR board desires to say simple, so that means we cannot add web support to it.
So bevy edui implemented the local only clipboard, which is handy to copy from inside our application
into our application, but that's not enough for my use case because I want to copy from
outside my application.
So time to fix it.
So to fix it, first I checked what were my options and how other projects were doing
it, mainly eFrame, an official framework from e4egui.
And I could quickly have something working by using the web sys create, create to interface
with JavaScript.
And I had the copy, cut and paste event going through JavaScript directly from the browser
and bypassing all the bevy machinery, which is great.
But then I had another problem.
I noticed that on Mac web, the controller command was not very well implemented because
on Mac user, they don't control A or control C, they command C and command V.
So we don't want to support correctly command C and command V to paste and then control A
to select all text that's inconsistent, so time to fix it.
So I fixed that by using the user agent on web and to detect on which platform I was,
so eventually all my controls were consistent.
So at this point, my pull request is the state of my whole adventure is that I have a pull
request waiting for fixing the clipboard and it's on review.
It can be a lot complicated.
We did see a lot of little devils in the details.
So I let it sit.
The main contributor of bevy eGUI is in Ukraine, so you can guess he has a lot of other stuff
to do.
So anyway, I can just target my branch and I can continue on my journey, right?
What is it wrong again?
Let's rewind a bit.
We skipped a little bit that first fix we did about that add sign.
The fix was mostly if it's control, it's not text, but if we are on Windows, it might
be text, so we're running the condition.
And then web, it will not work because it's a macro there.
And it's on compilation time.
And web, it will not equate to Windows.
It's actually wasn't 32 unknown and rest for the text savvy.
And so it's not working.
So now that I've studied the subject more, I could have done the same check I was doing
before with the user agent to detect the correct platform.
And that would have fixed all my problems.
But then I did that in another pull request to separate things and do things the correct
way.
And I was a bit confused, so I first tried to remove that and then I was like, oh, okay,
what about alt code?
If I remove that, I can input alt code because I'm French.
Did I tell you that?
And yeah, I'm French, so I like to input A, O, R, weird characters.
So I removed that and then I was like, oh, well, there is another if right there, maybe
it just would fix my problem.
I don't know what I was thinking.
I was like, it's an emoji with the exploding head.
But yeah, I was like that and pretty telling.
But anyway, so I decided I would have to step a little bit back.
Mistakes happen.
So I blanked that out before in a previous slide if you remember.
Baby behind the scene is using Winnit, which is a backend library for handling windowing.
It's basically a low level stuff to send raw inputs.
So I noticed they had a lot of fixes related or not to my issues and I was like, ah, will
I have to do all my fixes again?
I wasn't too confident in it.
So yeah, mistakes happen because I think I would have been able to fix that by using
the user agent and call it a day.
But anyway, I like rabbit holes.
So I went to update Winnit update.
Yeah, why not?
So I knew it wouldn't be too easy to do because I had to track multiple main branches, multiple
unstable dependencies.
I had to track baby main branch and Winnit main branch, which had multiple commits every
day.
So I had to have a stronger plan than doing it in provision.
Yeah, well, anyway.
So I had to first update, make everything compile and work.
And then after everything compiled works, I could update to the new Winnit goodies.
Yeah, Winnit API and good stuff.
So first, when doing a dependency update, check the documentation.
But I was updating two main.
So documentation is not really great.
So that meant foraging through the source code, pull requests, chance logs, working
with the server, and occasionally chatting with relevant experts.
Winnit uses Element, which is a response from them.
So yeah, thanks, Element.
First, when I was ready, I rolled up my sleeve and dove into the code.
And the first thing I did was updating a lot of NM names.
And I'm thankful that most IDE support for search and replace.
Yeah, VSCode, sorry.
Then another task I did was update a lot of dependencies.
As you can see, there was a bunch.
And I like to focus on a particular one, row window handle.
It's a create to provide a common interface to interface with the window.
Most of the dependencies had updated to a new version.
As you can see, version 0.6, actually.
In Bevy, we use continuous integration testing and cargo deny, which helps us prevent from
duplicate dependencies.
So I had to have my whole stack targeting the same row window handle dependency.
And WGPU, which is another low-level create for graphics, wasn't updated to that.
And I felt adding yet another main branch would be too much of a time sink.
So I had to use version 0.5 for row window handle.
And it's quite interesting how it's supported by the whole row window handle ecosystem.
You can just add a feature to most ecosystem crates to say, I want to support this particular
version and everything will be consistent.
I had to do a few pull requests to the dependencies.
But everyone was very responsive.
We eventually had something consistent.
So now we can profit, right?
And progress on my task.
Not yet, because the WinIt update is pretty complex.
It can impact a lot of architecture platforms and stuff.
And I don't have every platform to test.
And I have also limited time.
So I reached out to the baby discord to help.
Like, hey, my pull request is nearing completion.
Can you help me review it and test it, please?
So yeah, we caught a few bugs.
So I'm very thankful for everyone who chained in.
And eventually the WinIt update was merged.
Yes.
So now we can profit, right?
When I'm doing anything, I like to focus on the objective now.
So that meant taking a few shortcuts.
I noted them all as faithfully as I could.
If you check out the whole pull request and the WinIt
follow up, there is a lot of things.
But I didn't write it in one go.
As I discovered then, I would write them for me, for readers,
and for future readers, for afterwards.
Yeah, so now I think I will step back a little bit from all
this and go back to my use case.
Let's remind a bit.
We implemented, yeah, we did a lot of things.
We implemented copy-paste via JavaScript events.
We detected the platform using user agent.
And we even updated WinIt.
So whoa, that's a lot of things.
So does it work yet?
Not yet.
But I'm very confident that we have everything
in our disposition to make it work.
So next time we talk, I will tell you
how everything works perfectly.
Thank you for your time.
Everybody can help.
And if you want to help Bevy come into our Discord chat
or just come talk to me afterward,
I have free Bevy stickers if you want.
So yeah, just come and talk.
Thank you.