Open lachlanwgordon opened 3 years ago
This is definitely on the long list of things that I would love to have, but I don't have any server running anywhere that can do it at the moment, and I'm not sure I ever will (I'm extremely cheap).
I think the form of multi-player would be interesting to talk about though. For something like you're describing, which I read as essentially "everyone sees the same gameboard, and is equally in charge", you could probably get away with just having a SignalR hub running somewhere that relays mouse messages around so that a click on one client is a click on them all. The game itself is deterministic (or should be!) in terms of movement, so the engine doesn't need to know its being multi-playered at all.
What would be more fun would be tracks owned by people, having each person have a section of a larger game board, and allowing trains to ride around across peoples areas etc. but thats a whole different kettle of fish.
The Signal R hub is definitely a better solution, but I'm going to do it my way anyway. It may turn out to be useless but it'll be fun.
I'm just planning on putting this on a free tier Azure App service
Yeah, I'm thinking a collaborative approach, a lot like multiple people editing a Google Doc. Too many people in one google doc can be frustrating an chaoticly beautiful, I have to assume it's better with trains.
The Signal R hub is definitely a better solution, but I'm going to do it my way anyway.
I see you have been fully converted to the Trains ethos 🙂
What would be more fun would be tracks owned by people, having each person have a section of a larger game board, and allowing trains to ride around across peoples areas etc. but thats a whole different kettle of fish.
I've had thoughts on this, but very much out of scope of this convo 😉
I feel that it is possible to have a Server Side Blazor version (with WASM Clients) run on the free Azure App Service Tier and still handle dozens of simultaneous users. In fact it would be a good demonstration of how efficient Blazor Server runs.
The Server Side Blazor app would provide Administration functions and allow users to log in using AzureB2C.
I would be happy to work on this if interested.
If anyone's interested to see how this is going, I'm working on it in #193.
@lachlanwgordon I subscribed to that issue. If you need any help or input let me know there. Thanks.
Thanks @ADefWebserver, will let you know if I get stuck.
Playing with trains all on your own during a pandemic is lonely. Let's make it multiplayer so we can all work on the same train set at the same time.
I'm experimenting with running BlazorWasm apps inside iframes on Blazor Server sites. This seems a little confusing but could open up some cool scenarios.
For Trains.Net this would mean having a Balzor server site with very little code in it. I will manages a shared set of Entities and terrain that each client renders.
The benefits of an approach like this over pure server or pure wasm blazor are:
This could all be done by having the WASM app call a server but i think that would be a lot more code, and I'm using this as an experiment because I'm interested in adding high performance Skia content to existing server side blazor applications.
Code Changes
To get this running I'll need to add a method to the WASM Site that can be called from JavaScript to pass in the new/modified entities. Most of the saving/loading and serializing is already working, but I'll need to fix issue #180 to get this work.
There will need to be a new project added to the solution to host the Blazor Server App.
POC
As an experiment I've got this map running in a Blazor server website. When ever any user modifies it, all users see the updates instantly. The only difference is that this is a Javascript Map(not WASM, but still running on the client) that gets passed lat/lon coordinates. For trains it will be the existing Trains running in skia that gets entities and terrain passed to it.
Here it is running on my Mac and on my phone over 4g.
You can try it at https://mapcollaborate.azurewebsites.net/ and view the source at https://github.com/lachlanwgordon/MapCollaborate.
Hosting/Merging?
Are you open to this feature?
Would you want to host it on your own server, or can i have permission to run it on my own Azure App Service?