Open CoasterFreakDE opened 6 months ago
Would not recommend to take parts from it, but rather use it for inspiration. That code is from 2015 and is kinda dated by now. Part of it is because I used to do a lot of calculations on the client to save on resources at the server, but nowadays I would rather do that on the server as it caused several issues in the past. Would be best to do most logic (like overrides) on the server and have a dumb client. Would also recommend to use KotlinX serializable over of moshi and to use sealed classes for the packets.
Could also recommend trying to put a much code into a common Kotlin module, so you can share it between a website version of the AudioServer (perhaps done using Kotlin Compose Desktop), perhaps a desktop version and of course the server itself.
Thanks for the advice. <3
Yeah, I would definitely use KotlinX serializable and most of the logic on the server side. Moreover, for the first iteration we focus on just the audio part, but the system should also be easily extendable to allow more integrations later on.
As for the common module, we first need to discuss which language and framework to use for the website. If it is not JVM-Based, a common module wouldn't make sense.
I think it would be best to use Server-Sent Events for the main part of the audio server. As we use way more requests from the server to the client, it is way more performant to use SSE for server to client messages and for client to server simple rest requests.
https://ktor.io/docs/3.0.0-beta-1/sse-client.html#example https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
We decided to add a standalone audio-server instance for calculations, audio manipulations and more. The Minecraft server(s) send their positioning and audio data via RabbitMQ to our standalone Audio Server, which processes the information and then sends the audio directly to the website.
We can take parts of @joeywp 's integration from CraftVenture: https://github.com/Craftventure/open-plugin-parts/tree/main/net/craftventure/audioserver
For better immersion, the park audio should be played from defined speakers and not globally as on CV.
The Audio Server has to be able to perform various actions: