Private rooms/servers #145
Replies: 39 comments 13 replies
-
Currently working on |
Beta Was this translation helpful? Give feedback.
-
If people did this they would need .env that shares all info. We cant use different databases so they would need to know coders database. So its technically very dangerous to do this as they can delete everything and etc… So lets probably not do this. |
Beta Was this translation helpful? Give feedback.
-
@mollthecoder How do you plan to handle different databases, the leaderboards etc |
Beta Was this translation helpful? Give feedback.
-
We can only have 1 database aka the official one @DillonB07 |
Beta Was this translation helpful? Give feedback.
-
I know. I was seeing if mollthecoder had an idea of how it would work. |
Beta Was this translation helpful? Give feedback.
-
Well they would need the database url, and if they have it they can easily login to it and destroy swordbattle |
Beta Was this translation helpful? Give feedback.
-
I never said that? Please stop saying things on behalf of me lol |
Beta Was this translation helpful? Give feedback.
-
And I presume that private servers are self-hosted, so they wouldn't connect to the official database. |
Beta Was this translation helpful? Give feedback.
-
@codergautam well when I was editing swordbattle on my computer, I couldnt connect to a different server because it has a different database? so I had to set the servers to undefined? |
Beta Was this translation helpful? Give feedback.
-
Well then how would they get onto the leaderboard |
Beta Was this translation helpful? Give feedback.
-
@FishyMine They'd be hosting their own instance of swordbattle. They'd have a leaderboard for their instance, accounts for their instance etc. |
Beta Was this translation helpful? Give feedback.
-
@DillonB07 ah I get it now, sorry |
Beta Was this translation helpful? Give feedback.
-
Np, but I'm not sure if they would have separate accounts and leaderboards. I was imagining it as a way you can host private games just for friends, but I guess dedicated databases would be cool too. |
Beta Was this translation helpful? Give feedback.
-
@mollthecoder How is this going? I have a few ideas on how to implement this but wouldn't want to move forward if your are already there. |
Beta Was this translation helpful? Give feedback.
-
Not their own instance of swordbattle, just something they can connect to from the officially hosted swordbattle, kind of like you don't need to host your own instance of minecraft to have a minecraft server. Actually, I'm drawing a lot of inspiration from minecraft for this project. |
Beta Was this translation helpful? Give feedback.
-
Maybe this is true, but where are we pulling these stats from. Like we have done 0 testing on how much it can handle as far as I can tell. |
Beta Was this translation helpful? Give feedback.
-
I have no idea, they will never have the normal database (swordbattle's) because they could destroy the game so maybe they could have their own database they make?? I dont know |
Beta Was this translation helpful? Give feedback.
-
Running a server is very resource greedy. Because these servers are web servers, WebSocket servers, and, probably databases too if we decide to store data on the server's filesystem. And a lot of game calculations need to be done server-side instead of on user's clients to prevent cheating. Also, node.js uses JavaScript obviously, particularly the V8 engine. Here, we can't efficiently take proper advantage of CPUs multitasking capabilities. |
Beta Was this translation helpful? Give feedback.
-
I'm not very experienced on this topic either, but I would argue that running multiple instances is much more greedy than just running multiple "rooms" on a single server. If you look at the socket.io docs there is a concept called https://socket.io/docs/v3/rooms/ If we have multiple processes for every private server, well we would need a lot of resources since we are basially running multiple instances of the game, and I'm not sure if that's worth it considering that the game is declining from it's peak. Also, it's worth noting that around 70% of the accounts are from school emails. I highly doubt that these players would actually pay real money for just being able to play with their friends for a little while. Wouldn't using in-game coins be better? TL/DR: Some concerns are:
|
Beta Was this translation helpful? Give feedback.
-
That could be possible. It's worth a shot. We could also combine it with in-game coins or something, and allow regular players to have their own rooms too. And for other players, they could host their own servers for better performance and more customisation. |
Beta Was this translation helpful? Give feedback.
-
@Scotch101Tape is working on the rooms idea And sure we could have self-hosted servers I can change the setup.js file to make it work on custom servers |
Beta Was this translation helpful? Give feedback.
-
Yeahhhh I should've mentioned that earlier but I can confirm 😅 |
Beta Was this translation helpful? Give feedback.
-
I'm actually making a custom software from scratch that mimics a vanilla server but can be modified to do whatever. |
Beta Was this translation helpful? Give feedback.
-
I know it sounds a bit overkill, like reinventing the wheel, but if it keeps going the way it is right now it will be worth it. |
Beta Was this translation helpful? Give feedback.
-
Alright its been a while... I am at the point in the code where all I have to do is create a frontend to the private rooms, which is fairly trivial and requires no huge changes. (I also have to merge but that's a whole different horror story 💀). Anyway, the purpose of this comment is to suggest what I have thought of and also open it up to suggestions and critiques. My current idea for private rooms is to have an api pathway (ex: Pros:
Cons:
|
Beta Was this translation helpful? Give feedback.
-
Ok, so its been a while... I kinda am really good at not finishing things (if you couldn't already tell), but I really want to start finishing stuff so I can put it on a portfolio. Because of this, I have decided to once and for all finish this project. Also swordbattle.io still seems to be doing ok with visits so it won't be going to waste. As for development, right now what I have it 13 commits ahead and 77 (😱) commits behind the main branch. What I plan to do is take what I've learned from those 13 commits, revert them, and then pull the 77 and restart the development of private rooms. The idea is that I should be done with this PR before September 🤞. Thanks for letting me do this in the first place and for all the input you've put into this idea! |
Beta Was this translation helpful? Give feedback.
-
So it's September, which is when I wanted this PR finished. Obviously I haven't but I have made good progress! After looking through the old code I was able to make slight changes on the front end without adding/removing much code. As for the backend, I decided that it needs a whole rewrite for something this deep into the code. I have been working on a PoC for a way to structure the project, which is about a day of work away from being finished. Once that is complete, I'll let y'all know. Once again thanks for the patience. |
Beta Was this translation helpful? Give feedback.
-
any updates really want to see this in the game |
Beta Was this translation helpful? Give feedback.
-
I do plan to release something like this after the V2 update |
Beta Was this translation helpful? Give feedback.
-
Discussed in #112
Originally posted by mollthecoder May 19, 2022
Maybe a feature to allow people to buy private servers for the game? I could make it by myself if you're okay with the idea. I really like this idea and it'd be a blast for me to work on.
Beta Was this translation helpful? Give feedback.
All reactions