6 ms·
Unity3D also has WebGL support, and is surprisingly quick for having a full physics and high quality rendering engine where you can build in C#. That would allo
by ccvannorman 11y ago
Unity3D also has WebGL support, and is surprisingly quick for having a full physics and high quality rendering engine where you can build in C#. That would allow you to make a MineCraft clone that runs natively in the browser, and because it's Unity (a fully grown game dev environment) you will not have to reinvent any wheels or worry about many edge cases.
The really hard part about MineCraft isn't rendering, though; it's multiplayer.
- cbsmith 11y agoGiven its execution model, I'm not sure I'd agree that multiplayer is terribly hard in MineCraft. What is challenging about it?
- Terr_ 11y agoIn most arena-shooter-type games, you don't need 32x memory for 32x players, because the per-player state is fairly constrained and known. (Often limited to how many projectiles they can keep in the air at once.) I suspect Minecraft has a much harsher profile, since it's possible for every player to be loading a different piece of the world with minimal overlap, and world-pieces involve a lot more state that needs to be preserved/calculated/saved.
- talldan 11y agoMuch of the persistent world-state in Minecraft consists of blocks laid out on a 3D grid, which are probably fairly easy to optimise. Compare this to other 3D games where there are lots of entities with dynamic physics that can move to just about any world position, and I think Minecraft would be the easier of the two.
- lucaspiller 11y agoAlso I'm not sure how Minecraft handles it (I assume it pretty much ignores it, or does something very naive), but in FPS games you need to take into account latency and do predictions on the client side to minimise it. Think of two players running towards each other, and shooting at each other. By the time the player (or even the server) receives the data saying the other player has fired their gun, they've both moved to completely different positions. (There is a good set of articles on this by a game developer, I can't find them now)
- Terr_ 11y agoThere was a bunch of Source-engine stuff Valve published, which is usually my go-to citation when arguing with players who don't understand "netcode" for a game but criticize it for not giving them perfect instantaneous communication anyway. :p https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization https://developer.valvesoftware.com/wiki/Latency_Compensatin... https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking https://developer.valvesoftware.com/wiki/Source_Multiplayer_...
- SahAssar 11y agoAlso there is this pretty interesting talk from bungie back when they did halo games: http://www.gdcvault.com/play/1014345/I-Shot-You-First-Networking http://www.gdcvault.com/play/1014345/I-Shot-You-First-Networ...
- amagumori 11y ago@lucaspiller: http://gafferongames.com/networked-physics/introduction-to-networked-physics/ http://gafferongames.com/networked-physics/introduction-to-n...
- cbsmith 11y agoMost of that state only has to exist on the server, which in turn doesn't really have to figure out visibility and doesn't necessarily even need textures. The world pieces are a very specific set of permutations, which could easily be loaded in to a graphics card's memory at the start of the game. All you are really tracking are which pieces are where, and by the game's nature, there aren't that many pieces or positions they can be in...
- Sir_Cmpwn 11y agoI'll offer my open source codebase up for this discussion: https://github.com/SirCmpwn/TrueCraft https://github.com/SirCmpwn/TrueCraft May give you some insight into how Minecraft multiplayer (or any other detail of Minecraft) works. The server code is in the TrueCraft directory.
- zurn 11y agoThree.js is the main high level WebGL lib most people seem to be using, also for many MineCraft clones. It's not as web-hostile as Unity. Besides WebGL, it has renderers for CSS and 2D canvas too. There are other actively developed Web-friendly WebGL frameworks, like Goo Create, PlayCanvas, BabylonJS and many more.
- yoklov 11y agoAs someone with two Unity WebGL games in production, I wouldn't recommend this route. A fairly small game (~20kloc, so not a toy by any stretch, but small nonetheless) has 26mb of JavaScript code exported This kills the browser. Only good desktop or laptop machines can run it well. Runs like shit on average machines (lets not even mention mobile). This is after several months of dedicated optimization time to reduce resource usage and minimize build size. Overall, you are faaaar better off writing it in JavaScript with one of the pure js engines if you are going to go this route.
- irrlichthn 11y agoCan't upvote this comment enough. I'm also currently in the process of creating a full featured WebGL game, and nothing is faster than simply using pure JavaScript there. Most people won't accept this, but when you ask them, those never actually tried creating a complex WebGL game.
- vanderZwan 11y agoWhat about compiles-to-JavaScript languages like TypeScript?
- spoiler 11y agoThey don't add much overhead during runtime; most of the time there is zero overhead, or sometimes they can (theoretically, not sure if it's done in practice) produce more optimal code than a "literal translation".
- yoklov 11y agoThese are totally fine most of the time. Typescript in particular looks like a good choice for game development. Sometimes the language is less of a good choice. E.g. i did a small toy project in coffeescript about two years ago, and found to my horror, that if your function ended in a loop, it would return an array. Always. This isn't possible to accidentally do in the host language, so I'd say it is a bad fit (for game development, where you care about such things).