Stonehearth Multiplayer

It’s entirely possible; if the game is designed for it from the start, and if the game is tested under these conditions during development.

When a game (Stonehearth) is not designed for it from the start and isn’t tested under those conditions during development; you end up with the “do significant (expensive) changes or forget multiplayer” choice where most developers choose to forget multi-player because “profit < expense” or end end up going the “after thought” route where it sort of works until you try to use it.

I see no indication that Stonehearth is even slightly prepared for multi-player.

For a simple example, grab a world with maybe 20 military in the same party; and give them a “move to location” command. You’ll find that some of them start moving straight away, but others (further from the location) take up to a second before they react (because the game can’t even handle the CPU load of a single player). Now imagine that same situation on multi-player; where there’s an additional > 100 ms before the server knows you gave the “move to location” command, it takes twice as long for hearthlings to react (because there’s twice as much CPU load), and then it takes another > 100 ms before server can tell the client a hearthling started moving. Now you’re looking at 200 ms to > 2.2 seconds of lag before the game responds to your command.

If the game was designed for multi-player; then the client would pretend the hearthings stop moving in the wrong direction (and/or maybe start moving in a “guessed hopefully right” direction) as soon as you issue the “move to location” command (before it sends command to server), and then when it gets updated pathing info from server the client will try to hide the difference between what it displayed/predicted and the new pathing info (e.g. making hearthings walk faster to catch up to where they should be, etc). It’d create the illusion of “lag free” (even now on single player) which currently doesn’t exist.

Stonehearth is designed to be Multiplayer from the start and I’m quite sure they can test how good or bad client/server communication is without many changes in code.

Of course, there had to be a great amount of optimization before Multiplayer Alpha 1 :wink:

StoneHearth was designed from the start to not only be mod-friendly, but to have multiplayer

In fact, if you run the game, you get Two processors running in the task manager, that’s actually a server(you) and client(also you), in some ways, you are actually running a mutiplayer server just one that only you are in

You can find the files to run a server ina the game files, it works, but also doesn’t, as far as i remember, it launches but doesn’t take players coming in(not that you can join in the first place)

It’ll be a hard task to do, sure, but as far as my predictions? It’ll be a smooth transition, with some hiccups here and there

If you think splitting it into “client process” and “server process” is the same as “designed for multi-player” then… just no. That’s only the tip of the iceberg and barely enough to handle “2 player on same LAN” (where it’s much easier because networking latency is < 1 ms).

Then you’re far more optimistic than I am. My prediction is that they’ll do a little test/trial; realise it won’t work and that they have to completely redesign the game engine to fix initial design failures, then decide that it’s going to cost too much, then not bother with multi-player because that’s more fun than covering the cost of an additional 4+ years in development and bankruptcy. :wink:

Co worker and I play while at work. Yep It’s fun. lol

We’d like a co op style play. We pick one map, we each get our game and we play together against the evil goblins etc.

Don’t worry about lag. Look at the Riot Games. Developer of League of Legends, VALORANT, Teamfight Tactics, Legends of Runeterra, and Wild Rift. Creators of Arcane. Home of LOL and VALORANT Esports. | Riot Games

On the side, Tony pioneered latency-hiding techniques for peer-to-peer online games. His technology, licensed under the name “GGPO,” is used in many of today’s fighting games.

:wink:

1 Like

No… What i meant was that the game was designed for multiplayer from the start, the developers mentioned it in several occasions and the server and client thing is just an example that you can see right now, as an indicator or proof,

Again, the Devs themselvs have said that it was designed to be multiplayer from the start, what i think they ment by “[insert multiplayer thing here]” is that when they have multiplayer, they may need some little changes or additions in a component so that the component can function as intended, and not that they’ll have to re-write the whole thing to be multiplayer compadible

Think of it as having the whole game designed so that a server can read and respond without major changes to the major components

I’m not a part of the team, so i may be wrong is some technical things, and yes, i’m optimistic as most of the players here are, and there is no problem with your concerns, but i don’t want to have you know it as a thing you possibly misinterpreted

1 Like

You’re not telling me anything I don’t already know. You can read about this and what it does here:

It’s designed for (and useful for) a very different thing (e.g. player vs. player fighting games), and completely useless for something like Stonehearth where it’s extremely impractical to “roll back” the server state.

For a game like Stonehearth you need something called “client side prediction”. You can read about this in many places, but this seemed like a good enough (but simplified/basic) introduction:

http://www.gabrielgambetta.com/fpm2.html

The thing is; there is no evidence that Stonehearth does prediction at all (and no evidence that there’s any attempt at lag hiding of any kind); and this is very obvious even just playing single player.

To do client-side prediction; the networking protocol and all communication between client and server need to be designed for it, so to retro-fit it onto an existing game that doesn’t do it (like Stonehearth) you need to redesign virtually everything. That’s very expensive (in terms of development time/costs).

Now think about “green lit” alpha games on Steam (where most people that will ever buy a game buy it before it’s finished/released). Expensive things (like retro-fitting client-side prediction after it’s far too late) aren’t economically viable - the cost of significant changes aren’t going to be recovered by more sales, because most of the people who will ever buy the game have already bought it anyway. It’s just a huge expensive for very little extra profit.

Sure, the developers have been saying it’s going to happen since the beginning; just like Towns developers mentioned a bunch of things (that never happened) and Gnomoria developers mentioned a bunch of things (that never happened) and Timber and Stone developers mentioned a bunch of things (that never happened) and…

I simply don’t care what the developers say. Words are cheap. There is no evidence to suggest that it is ever going to happen.

We’ll just have to see, then. The only way to tell with absolute certainty is time, and I have no problem with working through the rest of my game backlog in the meantime.

5 Likes

Haters gonna hate. TR you guys do what you do. If SH doesn’t go to multiplayer (which I 100% doubt) the game is still fun to play!

I wouldn’t be surprised if a modder ends up figuring out something if the above scenario were to happen :slight_smile:

4 Likes

Yes; it’s fun game (and already worth buying), but if I’m right and Stonehearth never supports multiplayer no modder is going to be able to do what Radiant can’t (using a scripting language that can’t even do basic threading properly that only has limited “hooks” into the C++ engine).

Far more realistic is the game continues on for another 12 months, then “head office” (Riot Games) holds a meeting to discuss future profits, then suddenly it jumps from “still alpha” all the way to “final release” in 2 weeks, and one month after that everyone realises it’s dead and all the modders find something else to do and we all forget the game ever existed. :fearful:

Or we get word of Stonehearth 2: Mutliplayer Edition.

Team Radiant has pushed back dates before, but with the exception of infinite worlds [which I believe they later decided was too much] they seem to be slowly checking off all the features promised and stretch goals reached in the Kickstarter. I think they’ve been too open to the community to do otherwise and get away with it.

They’ll have to test networking when they get to it - which is certainly going to take a while and break a lot of stuff in the best case scenario - but they’ve already got code for other “players”, currently used for goblin camps, so they can get to stress-testing that whenever.

And of course any optimization that lets one player run well with more Hearthlings, enemies, or other units is going to help multiplayer servers run with more units.

3 Likes

So the Don’t Starve approach?

I doubt it’ll happen since their game has been set up for multiplayer already with server and client applications and I’m pretty sure in the connection state of the game at the moment when connecting to a server port they just have it set on hard local host.

For all we know they do some in-house testing each patch seeing if the two executables are run on different machines and still plays just fine.

Obviously for multiplayer 1.0 there will need to be a huge design overhaul on the main menu to make room for setting up multiplayer games. Just like stone hearth is a work in progress the multiplayer will be a progressive thing.

They’ll make 1.0 multiplayer and it’ll be buggy and that’s okay. People report bug and then they’ll slowly chisel away the grime that comes with introducing a huge component of the game suddenly. Eventually after much work we’ll be left with a familiar game but now you can play with friends.

They’ve been planning for multiplayer from the start they will likely not have to re-do the entire game to make it work. The reason why many big corporations have this problem isn’t because poor planning but more likely some executive who doesn’t have a grasp on how huge a task it is to add multiplayer says “Why not add multiplayer?”.

How to build a submarine:

  1. Start building a car, but put a periscope through the roof (because a submarine needs a periscope, right?)
  2. Forget about submarines for 5 years and just focus on building a car
  3. Watch as people say things like “Of course it’ll work as a submarine, it had a periscope from the beginning!”
  4. Do a little test in your swimming pool to see if the car is waterproof
  5. Forget about submarines for another year and just focus on building a car
  6. After the car is finished, test out the “submarine” and find out that when the car goes more than 20 meters underwater, the water pressure crushes it and it falls to the bottom of the ocean

I’d say a boat would be a better analogy to what the game is now.

1 Like

A lot of talking the talk, but not walking the walk, so let me add my two cents here.

I’ll just pick one quote but it’s been repeated several times:

First of all, you somehow seem to be fixed onto this whole idea of client prediction. While this is fine and dandy, and certainly required for fast-paced applications such as FPS or action games in general, it’s not the only way to do proper netcode. A popular example would be Factorio (albeit them having published a blog post just today stating that their netcode kinda sucks, for different reasons), where you can have literally thousands of entities moving around the map with little to no lag, even with high latencies. The key here is a lockstep simulation: Each client is simulating the whole world. In order to process a command, it sends it to the server, which validates and executes it and sends the results to the clients. Previously, Factorio did this P2P but switched, or rather is switching, to a more traditional server-client model. There’s a few more examples, such as StarCraft 2, League of Legends, WarCraft 3… I guess most of the “old” RTS did it that way. I have my doubts as to DOTA2 as it’s running on Source, a FPS engine that definitely uses prediction but then again, it’s possible that this Source is working differently. There’s a good reddit post giving some more insights into HotS’ networking code, where prediction isn’t exactly required either.

Anyway, the fact that each client simulates the whole world at any given time means you just have to assure that the code is deterministic at all times, especially with random() and what not. After that, it doesn’t matter how many entities or AI are around; all that matters is that the simulation is kept synchronised and to do that, you’ve just got to exchange the commands from each client.

This also avoids the racing condition (“both players pick up an item at the same time”), because first in, first parsed; so whose packet is received first/parsed first will have the item. The clients themselves won’t see the item pickup until the server acknowledges it. They can, if they feel fancy, add some prediction to that; as long as you do a proper rollback in case things don’t work out your way.

Point being: There’s many ways to do proper multiplayer and there’s quite a few which don’t involve prediction. I would even go as far as saying that for Stonehearth, prediction would cause way too many issues to be usable. It’s not impossible and theoretically could be added already by modders, but there’s zero reason to.

Stonehearth is separated into three parts: the client lua state, the server lua state and the GUI. Each of these parts are completely disjunct and can only communicate over a (HTTP) interface. The client side lua is handling things such as effects rendering, general rendering and GUI callbacks, while the server side is doing all the simulation. The GUI is a CEF application that can communicate with server and client using some magic HTTP API.

While this is, of course, no “true” multiplayer experience, it’s already the required separation for later on. It’s not a monolith where server and client have to be painfully separated (like for example Minecraft).

The communication works over some proprietary RPC protocol which allows the GUI, server or client to call functions in the server or client domain. The whole thing works with futures/promises and every function (“command”) does not only get the parameters, but only the caller/client.

On top of that, there’s already code in place for the whole “player” thing, although it’s hardcoded in some places. As the development of races goes on, so does the code. In the first Alpha, players were literally just a string called “localplayer” or “player1” or something like that. Meanwhile we have (proper) factions and objects and there’s nothing stopping multiple players from being present in the simulation, to my knowledge.

So saying that there’s absolutely zero preparation, just because it’s not featuring the prediction that it doesn’t need and won’t get anyway, is a bit unfair.

That’s an assumption if nothing else. There’s a dozen reasons why some units start moving and others don’t, this starts with “they have to find a path” to “the AI is currently busy with another task and cannot deal with your request immediately”. For example, if you added a 30 second idle animation to your units, it would be possible to delay every single action by up to 30 seconds, because that action might not be aborted. This is much more an AI/pathfinding issue if anything else; although of course, the CPU is the “final frontier” on those issues as well. I doubt that even with more CPU cycles available, your units would start to move earlier.

This is assuming that

A) there is already prediction implemented, which doesn’t make sense giving that the only client is a local one and latency is expected to be non-existent.
B) the client actually has an idea of what the command does, i.e. the AI is running on the client side too (which, with the current definition of server/client, it is not).

Once again, client side prediction isn’t required for multiplayers. It’s merely smoothing the experience because of the issues you’ve mentioned (latency/bandwidth). If you’re fine with units jumping around like crazy, prediction isn’t required. I wouldn’t expect prediction in the few iterations of multiplayer anyway - it would be wasted resources.

Well, so far your predictions (excuse the pun) have been somewhat off-road and wonky at best, so this statement is kind of weak.

So you patch the binary itself, that’s not impossible. There’s been worse programs/games that have been patched, including multiplayer. It’s a completely different difficulty level than doing it with the source code, but saying that nobody is ever going to do it is quite an assumption.


To be bloody honest, I don’t see much more in these posts than “Ten Reasons why games need client prediction to have multiplayer - #3 will blow your mind!” mixed with a bit of "Twenty failed Kickstarter projects". I have my personal doubts that Stonehearth will have an awesome multiplayer, but I doubt that it will not have one at all. I’ve been doubting them wrongfully in the past, so I’m always happy to be surprised with something I didn’t think was possible.

12 Likes

I don’t really see why it’d need client side prediction. The game isn’t really real-time movement as in you’re not gonna be holding down the typical WASD keys needing consistent message sending. At most players would be able to bark orders once a second if even that(obviously you could spam some order like queueing up stuff at a workbench but that’s an outlier).

Each time you bark an order it’d require a message to be sent to the server and then that’s it, the server continues to update. Idk if they’d send individual update positions of all entities or just send their current routine. It’d probably be simpler to send the paths and the client handles moving the entities with given paths rather than adjust the positions every time.

So assuming it just updates based on paths, hearthlings stay on a path typically 1-4 seconds unless interrupted. Obviously you’d be sending the new paths everytime an old 1 gets interrupted but other than that it’s not like the server is getting bombarded with messages from the client.

And at 1x play speed you’d have even longer time between paths completing and starting a new 1.

All-in-all the game doesn’t really feel like it’d need that much on client-side prediction. The entirety of the argument for it is lacking even. This game is as close to a turn-based strategy a real-time strategy game can get I feel in terms of multiplayer complexity.(seeing as turn-based strategy games are one of the easiest to handle for multiplayer).

Lock-step doesn’t hide “Internet lag”, in fact it makes it worse - all players end up slowed to the speed of the slowest player’s connection. It also doesn’t spread the processing load around (all clients end up handling the graphics/UI load plus simulating everything for all players); which (for a game like Stonehearth where processing is an impossible to avoid bottleneck) would be sad. It’s fine for LANs (which is why it was popular 20 years ago) where the networking latency was much better, and it’s possibly still “OK” for some games (e.g. turn-based strategy). Beyond that it’s unusable. It also doesn’t solve the “first player was first” problem (in that whoever clicks their mouse first may be “assumed last” by server).

Fortunately it’s obvious that Stonehearth is not designed for lock-step (if it was the “server” LUA code would be far smaller and very different); and this is all just a distraction - you’ve said yourself that “server side is doing all the simulation”.

While the client and “GUI” (the overlay and not the entire GUI) might be “separated in theory” it’s a single process, and it doesn’t make any sense to have GUI somewhere other than where the client is anyway. I expect the only reason “GUI” (the overlay part) is internally separated is convenience (to avoid writing GUI code and make it more modifiable), which is perfectly fine but does nothing for multi-player.

Saying that it’s not prepared for “Internet lag” because there is nothing to cope with “Internet lag” is extremely fair. Saying that multi-player (if/when they ever actually try it on more than a fast LAN) will not work because it will be too laggy (because there is nothing to cope with “Internet lag”) is also extremely fair.

The behaviour I observed (when moving military parties) is undeniable proof that the client is not doing anything to hide time taken to submit the command to server and get a response. In this case it’s very likely that the delay is caused by path finding and/or AI (and not networking); but from client’s perspective it’s all part of the same chain of events between sending to server and receiving from server.

I’m assuming that:
A) Nothing is implemented to mitigate “Internet lag” (or “server internal processing lag” or any other kind of lag)
B) Nothing will ever be implemented to mitigate “Internet lag” (because it’d be far too expensive to retro-fit; because you would need to make client aware of what commands do and a lot more).

Exactly. Do you think anyone is fine with units jumping around for a “supposedly designed for multi-player” game in 2016??

Not impossible; but extremely fragile and far from trivial when you’re talking about replacing the networking in client and server, and making both handle prediction, and making client aware of everything needed just to make prediction possible; all starting with reverse engineering the existing code just to figure out how.

Note: It’d probably be much easier (for a modder) to reverse engineer the networking protocol and implement a “local faux server” that sits between a client and the real server and does the prediction. That would still be more work than most people (that are capable of doing it) are willing to do.

We mostly seem to agree on this - I too think they might (and probably will?) end up with multi-player that’s only good enough to handle LAN (where network latencies and bandwidth are almost insignificant); but that is not what most people want. What people want (at a minimum) is a connection over the Internet to a server running on the other player’s computer, that is actually usable/fun (and doesn’t suffer serious lag or jitter problems).