Couple months back I somehow started doing some #gamedev work. Welp, the game I’ve been helping with now has a trailer!
Check out Skeleseller (and maybe wishlist it? *wink* *wink*), coming soon™.
Couple months back I somehow started doing some #gamedev work. Welp, the game I’ve been helping with now has a trailer!
Check out Skeleseller (and maybe wishlist it? *wink* *wink*), coming soon™.
Spent the weekend building a silly game in Godot with Swift (thanks to @Migueldeicaza’s SwiftGodot).
It integrates with Twitch chat so chatters can have a space battle (may be fun for breaks and such).
Anyways, it was fun and I’m hoping to build more stuff with SwiftGodot 'cause I love it. Also, code and game are available on my GitHub: https://github.com/kevinrpb/ChatBattles
I have many more features in the backlog, but the app is now in an MLP state that I am happy to share.
I need to do a bit of polishing and fix a few bugs, but hopefully I will be able to send it to TestFlight in the next couple weeks.
I also want to keep updating this thread with the progress I make.
(12/x)
I also want to allow some form of customization, at the minimum setting a color scheme override and setting an accent color.
I have also implemented opt-in into using https://recent-messages.robotty.de/, which allows loading the recent history of a chat (if available) on joining it.
(11/x)
Other than that, the app will support things that you'd probably expect from it. Some obvious ones are searching for channels (duh) or viewing the details of a specific channel (so you can see the name of that juicy emote).
(These UIs are WIP at the moment).
(10/x)
Then, I wrap the chat message in a TimelineView to drive the animation. The timeline context is passed to the text renderer, which then reads the attribute to get the necessary frames, and uses the timeline context to pick which frame needs to be rendered
The relevant WWDC session (https://developer.apple.com/videos/play/wwdc2024/10151/) and the snippets shared by @dlx were really helpful in getting comfortable with the renderer, which is an extremely powerful tool in SwiftUI.
(9/x)
Now for the animated emotes... They are also defined in the view hierarchy as a Text(Image(uiImage:)). However! The magic to make them animate is to make use of the new TextRenderer protocol.
When I have to add an animated emote to the hierarchy, I add it as an Image with the first frame. I also add a custom TextAttribute to it that contains all the needed images to render the animation.
(8/x)
I am really happy with the implementation to render these emotes in text. Both badges and static emotes are just a Text(Image(uiImage:)) element. They are then concatenated to form the whole message.
In order to be able to follow this approach, I download the images and use the UIImage to initialize the SwiftUI image. One important bit here is matching the text size. I am using the current DynamicType setting to resize the images so they are always scaled to the text.
(7/x)
The feature I'm most proud of is animated emotes. It's nothing crazy in and out of itself. But if you have tried to get GIFs to render in SwiftUI you may know that it also not trivial.
The crazy part? Those GIFs you see are not SwiftUI Images*. They are Text. Actually, every message in chat is just a Text view!
*They kinda are Images, but keep reading to understand what I mean.
(6/x)
The app will let you join any number of chats simultaneously, and let you switch between them from the title menu, which is a new-ish feature in iOS that I love.
(4/x)
Now, there are some third-party apps available for iOS. But none of the good ones are native! The best ones I know of are Chatsen and Frosty, both built with Flutter.
These are really good apps, and I even really like Frosty's design (Chatsen seems out of place in iOS, IMO). But I wondered if there could be a native app built in Swift. And so I started to work on it.
https://github.com/tommyxchow/frosty
https://github.com/chatsen/chatsen
(3/x)
The reason behind building this app is that the official Twitch app is... uncomfortable, at best. Sure, you have access to the chat, but it will never take more than half of the space? (even if you disable video playback). Sometimes I want to chat from the couch while I'm watching on my TV!
Also, it doesn't support all emotes. You get access to the Twitch emotes, but what about FrakerFazeZ? BetterTwitchTV? If there's anything Twitch chatter loves sure is emotes!
(2/x)
Like, the declaration of that UI is only ~100 loc (if you've used other Python GUI frameworks you understand how great that is).
I love using SwiftUI and finding something similar for Python was a great surprise.
Hey, look, I made a thing! https://github.com/kevinrpb/yt-dlp-guitk
If you download things from YouTube with `yt-dlp` but would prefer to not use a terminal, this may be for you. 😀
`yt-dlp-guitk` (actual name pending) is a simple wrapping GUI over `yt-dlp` that focuses on being simple.
It also uses `GUITk` (the other part in the name). This is a really nice Python library by @RhetTbull that allows building `tkinter` applications in a declarative manner. And it's super easy to use!