To give all of you a better understanding of what we are doing and how long even small things can take, I wrote this little diary. A day here is the time I have besides the Coronavirus, school-homework, a daily dose of gaming and other things that come in my way.
It started out with a draft from our in-house designer Rux.
I had never worked with Figma so after a short while I realized I could just export the icons and not the background, so I had to rebuild all of it in Unity. Therefore, I had to get all the hex-colour values out of Figma and build fitting UI elements. I personally don’t like complex code to make all the chat messages fitting and resizable, so I used the Unity built-in tools to do that.
After seeing the chat in-game but without any functionality and placed in the world (not the desired HUD) I dived into the existent chat-system in Nitrox. After a short while (and some discussion with Measurity) I decided to change where the unity project and files are located. The current system was like having Nitrox in one room with all the client, server and launcher stuff in dedicated lockers and the NitroxUnity project in another room. This makes it more time consuming to upload changes because it has to be done two times and in special order.
It was time for a little spring cleaning and I moved it to the main room (repo).
After that, I tried to move the chat from placed in the world (for checking if it’s working at all) to the camera. For that, UI elements need a “renderer” called canvas. But for some (still) unknown reason the chat wasn’t interactable with the one from NitroxUnity.
Over this day I looked into Subnautica code and how they handle UI. After many tries, I found a solution. The magic trick was to rely on some Subnuatica code and use the already existing canvas from Subnuaticas GUI.
The chat was now interactable but still needed functions behind the buttons. After the first few things like transparency and fade out after a short time a new challenger approached.
Unity has built-in code interfaces for selecting, deselecting and dragging but, for whatever reason, the mouse coordinates calculated by Unity were way off.
After quadrillion hours (around 3:45 am) I could fix this with self-written calculations between screen and game window size.
Time for pre bug finding. I thoroughly tested the chat and found a few bugs or problems like dragging the chat outside the game window, or some issues with selecting the text box and sending messages.
After that, I was reminded by looking at the design on Figma, that Rux has planned a chat-key-hint. With the collected Subnautica UI experience and the simplicity of the task (just image no interaction), I implemented it in 15-20 minutes. While working on it I realized (with the help of Rux) I could export everything from Figma (even backgrounds) resulting in a short gnashing of teeth.
After proofreading the changes I shipped the code to GitHub and got (unusually fast) feedback from Measurity to implement something different and watch out for a recently fixed bug which could be there again after my changes. I applied the requested changes and shipped the final version to review.
After a refreshing sleep I woke up and had to realize that the drag is still off, at least for Measurity.
The chat is nearly at the end of the “coding-pipeline” now and it’s time for the finale polishing. I made many optimizations on the mechanic to import the chat on the HUD, the dragging, how we import fonts/images in the game as well as layout groups and content size fitters (which keep every chat entry sorted). Also, I didn’t realize that I missed uploading a few files important for others to be able to change something in the NitroxUnity project and the chat itself. With these changes uploaded to GitHub, I had to wait for Measurity to review the changes.
Now I got a few suggestions from Sunrunner, so I had to dig into the code again to please everyone.
While Measurity and I had a conversation about the way I handled dragging the chat out of frame Sunrunner shipped the chat for the new release (which can happen and is totally normal in an open-source project like this). So, everyone now has the version with the chat resetting the position if dragged out of the window. This is causing a bug, wherewith some resolutions and settings the chat can get totally lost. Have fun with that. 😉
I implemented the last suggestions from Measurity and directly created a pull request, hoping everything is polished now.
To sum it up, I would say that this was moderately difficult. I had a clear structure of what to do/implement and where I can find it. The problems across the 11 days (21 IRL days) were, despite taking up so much time, relatively easy to overcome for a “standard Nitrox task” although it took these 11 days. [Side note: in my first version of the text (where I thought the chat is finished) I had just 6 days…]
Hope you enjoyed this small peek into my work with Nitrox.
Best regards, Jannify
One reply on “Dev Blog #3: A short story of the new chat”
I love your work! I bought Subnautica just to play your mod!