News for hackers. Stuff that matters.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by namelosw on Sunday May 31, 2020 @05:04AM (#23368244)
I'm a web developer but I tried to understand how to build an MMORPG similar to World of Warcraft sometimes ago.

It turns out to build a solid solution that is largely overwhelming to individuals, and I yet to found an open-source framework that tackles these issues in a straightforward way.

To my shallow understanding, it's less about Unity, the game client, despite there are many protocol related works. Here are something I found really hard for me:

1. The first step is basically rebuilding all the game logic in the server-side, or you'll be facing endless cheating. The combat, the inventory, especially the map - you're going to model a huge 3D world on the server-side without existing client-side GUI helpers.

2. The most difficult thing is most of the states need to spread across the whole cluster like a distributed database, and keep sync because there might be interactions between those states (eg. shoot a fireball through the edge of the map to another map then hit someone), this usually done by modeling a quadtree across the cluster.

3. Players can randomly fight each other in an open world, and those combat needs to be dynamically grouped and disbanded. Players should only receive the state update they care about, instead of receiving every information of the world(area of interest), and everyone's interest might be different.

4. Of course, there are global clock and synchronization.

5. Many operations would require transactions, or players can trade and duplicate items when they cross the border of maps or directly disconnect.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by moonchild on Sunday May 31, 2020 @05:19AM (#23368297)
> rebuilding all the game logic in the server-side

Start with the server side. This doesn't actually have to be a server application with no gui, but start with the simulation of an entire world. Then 'rebuild' the logic on the client side. This lets you be a little bit sloppy—though not too sloppy, obviously—because it's ok if the server 'cheats', since it has no ulterior motives (except for yours) and there's only one of it.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by golergka on Sunday May 31, 2020 @06:14AM (#23368493)
Real client-side verification and prediction is usually more complicated than just replicating game logic, you have to be able to restore the world to a correct condition after a wrong prediction in an elegant and unoffending way.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by ethbro on Sunday May 31, 2020 @07:54AM (#23368957)
Per the infamous Age of Empires multiplayer write-up (I think?), never use independently random code. Everything should be key-based pseudorandom.

Much easier to sync keys and play forward vs syncing at every Rand call.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by hinkley on Sunday May 31, 2020 @01:09PM (#23370869)
What keeps the client from peeking at the next few values and scheduling actions to line up with 'good rolls'?
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by shultays on Monday June 01, 2020 @06:41AM (#23377118)
It depends on game/implementation but client wouldn't really roll dices on their sides. Someone shooting a bullet that does 5-10 damage would tell server to shoot bullet and server would reply "you did 7 damage"

Especially on an mmo, there is no point telling a player that his next fireball spell will also trigger a "random chance to put a burn status on target". The client would start casting a fireball, which takes a second to cast and in that 1 second duration the server would decide what is the damage and if the spell is going to apply burn and by end of 1 second, you would get that information so you can see the damage values and burn icon on enemy

It is better to keep clients dumb if possible

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by ethbro on Sunday May 31, 2020 @08:35PM (#23374445)
Presumably nothing! But I imagine it was might have been impractical, given lockstep method is kind of predicated on "Do it because you can't afford to only compute and transmit from a central node."

In the era it was used, server chips weren't really a thing. So it was really just "the current decent CPU."

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by jl258 on Sunday May 31, 2020 @09:03AM (#23369312)
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by ethbro on Sunday May 31, 2020 @10:19AM (#23369736)
It was linked to in that one. Pretty sure this is it: https://www.gamasutra.com/view/feature/131503/1500_archers_o...

It's also a fascinating historical artifact of "when internet play meant orders of magnitude higher latency and jitter... as a base assumption."

Per memory, there's a bit where they've ferreted out all the sources of randomness, except one. And any source of randomness corrupted the downstream calculations, as they used global random generators.

There was some reason they couldn't just trace calls directly.

It turned out there was a line of code somewhere that said something like "if {rare condition} then rand.next {to figure out where to place an ornamental rock/tree}."

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by setr on Sunday May 31, 2020 @11:18AM (#23370080)
That was specifically related to their networking/syncing architecture -- deterministic lockstep simulation -- in which every client is running their own local instance of the simulation, and the only thing being passed around are interactions with the simulation.

So everyone has to have the same results and calculations at all times, because there's no authoritative simulation.

It's a common architecture for RTS's (interactions are far less numerous than individual entities) but not for general multiplayer games due to issues like everyone must be on the same timestep at all times -- so a single slow player slows everyone down. See https://gafferongames.com/post/deterministic_lockstep/

If you have an authoritative server, so the client is mostly a presentation/view of current game state, you don't need to be as careful about maintaining game state/randomness, since there's only one source of randomness (your authoritative server)

Ofc, if in an mmo you have multiple authoritative servers, you're back to the same problem, though I believe the more common solution is to have 1 server - 1 universe, and you just have more game instances (shards/servers) to connect to

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by ethbro on Sunday May 31, 2020 @04:28PM (#23372431)
There's a reason there were no complex-state MMOs at that time -- there simply wasn't the residential bandwidth to perform continual full state updates (latency aside).

E.g. grid & turn-based vs 3-D free-motion worlds

They say they specifically made the deterministic lockstep choice because it was the only option that (a) allowed the multiplayer gameplay they wanted and (b) fit within the computing and network resources of the time.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by golergka on Sunday May 31, 2020 @03:12PM (#23371827)
AoE uses classic lockstep simulation, as far as I remember. For a variety of reasons, most importantly, latency, this approach is not usable for genres other than strategy.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by moonchild on Sunday May 31, 2020 @03:10PM (#23371812)
Right, so that's the challenging part about building a client. But you still want to build the server first, and let that be the authoritative source of gameplay design, because a desync for one person is not as bad as a desync for everyone but one person. (And that only becomes more true as the number of people on your server grows.)
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by LoSboccacc on Sunday May 31, 2020 @10:35AM (#23369828)
note that in rpg you don't stimulate the physics. every tick of combat you send an effect packet that describe that turn action result and the client side plays whatever effect is needed

once a combat session is initiated you don't need that much prediction going on because where you move is uncorrelated to where a fireball hit or not, only player stats.

the real exception are are effect, as the client need to reconcile them, but the client can chat as much as it wants as long as the presentation matches the server player stats: it can for example position area effect that hit on the server in a position such as the player hit was in range.

the client only had to make sure action result are in sync, not the world physical station whole

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by smogcutter on Sunday May 31, 2020 @01:11PM (#23370883)
That works for something like WoW, but there are exceptions: in EVE Online for example, damage depends heavily on the relative movement of player ships.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by golergka on Sunday May 31, 2020 @03:15PM (#23371841)
It's true for WoW, but many more modern MMORPGs have solid characters, attacks tied to animation (remember infamous Conan thing with female characters having lower DPS because of that), raycast hit mechanics, and yes, real physics.

Usually these mechanics are not as advanced and detailed as in single-player action games, but they do exist.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by LoSboccacc on Sunday May 31, 2020 @04:26PM (#23372414)
ye, but these are action or action/rpg
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by dogma1138 on Sunday May 31, 2020 @06:59AM (#23368696)
This isn’t just for MMO’s all multiplayer games today run everything on the server side the server side basically runs a client that is the single source of truth.

To improve the experience and compensate for lag player clients run a simulation and can update their state based on their player actions directly before the action is registered or acknowledged by the server client then they only get a confirmation from the server or they get a forced update if the action they performed wasn’t in agreement with the server.

As for other things like give mentioned you don’t usually have to run a full model on the server side of your world, you however hold a representation of it in the form of maps, these are usually huge arrays of coordinates with various properties they basically transform the 3D game world into a board game board.

For MMO’s specifically while there aren’t many good open source frameworks there is something quite good and that is private server clients for popular MMO’s like Mangos https://github.com/mangoszero/server/blob/master/README.md

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by k__ on Sunday May 31, 2020 @10:07AM (#23369677)
As far as I know, MMO creators gave up and used static instances, which degrades most MMOs to multiple regular/non-massive multiplayer games stitched together.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by boardwaalk on Sunday May 31, 2020 @11:18AM (#23370081)
Sadly true. There have been games with large, seamless, 3D worlds combined with multiplayer for a long time (late 90s at latest), but almost all new games use some combination zones (e.g. shared spaces, but broken up), or instances (spaces shared only with a small group), or phasing (spaces shared only when you're in a similar game state), or the Destiny-style "we'll have people show up whenever we feel like it" tech. That last one seems hugely popular these days, to the point it's showing up from the other direction -- other people showing up in your single player game.

I think it's because of a combination of technical difficulty and game design reasons dealing with overcrowding and camping and other bad behavior.

And I also think it's a total cop out and decimates any sense of "place" in these games, which I think is so important in games like these.

If anyone has examples of modern games that don't do most of these these things, I'd love to hear it. I'm not up on all of em, particularly the ones in the primarily Asian market.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by namelosw on Sunday May 31, 2020 @01:31PM (#23371038)
Me too wondering if there are any games could have done it without phasing or any doing the equivalent.

It seems to be impossible to handle unlimited players that are crowded together, even despite all the design issues. Because the logic and synchronization could grow in superlinear complexities in those scenarios. Clustered states and dynamic instance provisioning could ease some degrees but that actually can only solve sublinear to linear complexity problems at most.

With that being said, I played the Elder Scrolls Online many years ago. There were definitely phasing mechanisms. But when it just came out, there were like one thousand users PVP in Cyrodiil. Compared to World of Warcraft which one hundred players AOE in a city could make the server crawling it's already pretty impressive to me. Not sure how they have done it.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by daeken on Sunday May 31, 2020 @12:50PM (#23370745)
EVE Online is still primarily one single shared environment, as far as I'm aware. They added instances for some content back in 2018 (from a quick Googling), but otherwise it's not sharded in any way, to my knowledge.
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by singron on Sunday May 31, 2020 @01:50PM (#23371200)
Eve has some advantages that let it avoid some problems. Space is split up into distinct solar systems with a "jump" required to transition from one to another, so a system can be controlled by a single process.

Within a system, your area of interest is always the grid you are in, which is equal for all players in that grid. "Grid" despite the name is a dynamic boundary that contains all nearby players that are likely to interact with each other. The game doesn't allow most cross-grid interactions, probably to make implementation much easier. I think they get away with this since solar systems are so large and you have to be relatively close to interact with anything.

Some of these designs became problematic.

Players can perform "grid-hacking" where they manipulate the shape and position of these grids so that they can suddenly cross a grid boundary to ambush or escape other players.

I haven't played in a while, so some of this might work differently now. The lack of server scalability within a system also causes time dilation, which besides making fights slower and boring also gives more people enough time to join and rejoin fights and cause more time dilation.

Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by hinkley on Sunday May 31, 2020 @01:11PM (#23370884)
I haven't looked in a long time, but EVE used to be sharded, which is easy to do when there are gateways between areas of the map.

The problem was when everyone decides to hang out in one shard.

[dead]
Re:Show HN: Unity MMORPG Boilerplate – Multiplayer in Unity ... by ccmcarey on Sunday May 31, 2020 @06:40AM (#23368612)
There's no need for that.