heelo, i’m working on a rts game like rise of nations, actually most similar to hoi4
the fact which i got to know during develop was that it takes so long time loading. since there are 5k+ provs and i also need to calculate its neighbor provinces and borders
i first thought id just make a lobby server and then teleport players to game server just like others.
however due to this loading problem, it seems i need to make it 1 player server so load it only once when player plays experience
im wondering:
how can i communicate between the servers(maybe messagingservice, memorystore or somthing)
will it be best choice(is it good)
is it possible?
i find it good to reduce loading times anyway
thank you for reading this quiet long!
I don’t see why you would do it on 1 player servers but imma help you anyways, for multi-server LIVE connection, this is what I recommend:
– Server that just started:
Get Data from DataStoreService to catch up to what has happened in the game so far
SubscribeAsync to MessagingService so that if another server does something, all the other servers connected to the same game receive the action
– When the server does something and wants to let every other server connected to the same game know:
Update DataStoreService so that servers that start after this point forward know what has happened in the game
Send a message using MessagingService to all other servers that are currently active so that they know that this server has done an action
Now, if you don’t know how DataStoreService works or how MessagingService works, I recommend you send over to ChatGPT this entire message and let it do the job for you, AI usually gets hated on but it can be useful if you are trying to get a base for a big project done or if you want to learn, however, here a few things to remember:
When doing API Calls (MessagingService & DataStoreService Calls) always wrap it around pcalls, and if the pcall fails, try again, until it doesn’t fail.
When using MessagingService:SubscribeAsync(Topic,function(Packet)), the Packet will be a table in this format: {Sent = UnixTime, Data = DataThatGotSent}, you want to make sure that when you receive a action over MessagingService, make sure it doesn’t conflict with any actions done on the local server, if 2 actions done on the current server and a different server happen, check which one was done first (by checking the different server’s packet.Sent) and execute the one that was done first instead.
I have already made the world map. Im not making it only with my hands
Yes It seems like MemoryStore is pretty much the only way to implement a list of the servers.
I found that the loading time too long. If I make it like other games(which need teleporting between servers), they will load all day long every time they try to play so players might have die during loading. So I think the map would be only world map, thus it’d better make it load only once when joining the experience.
Thank you so much for information anywas!
Use TeleportAsync(PlaceId,game.Players:GetPlayers()), you are probably doing it wrong
It is currently the most updated method and should be the one you use, you are either using another function or using TeleportAsync the wrong way (like calling it for every player instead of just calling it once)
I have played RTS games before and they don’t have teleporting issues, just do the exact thing I said and you should be fine, you are probably iterating through every player and calling Teleport for each of them, don’t do that, TeleportAsync all of them at once
I already used that. It’s not teleporting issue I guess it’s just because there are too many things to load.
So I think it’d better load only once when player joins experience at first, and use MessagingService and others for multiplayer as I said.