{"id":17978174,"url":"https://github.com/overv/webcraft","last_synced_at":"2025-04-05T18:07:13.790Z","repository":{"id":2098866,"uuid":"3039784","full_name":"Overv/WebCraft","owner":"Overv","description":"Minecraft clone written in Javascript.","archived":false,"fork":false,"pushed_at":"2020-01-27T20:51:18.000Z","size":190,"stargazers_count":398,"open_issues_count":34,"forks_count":187,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-03-29T17:09:44.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Overv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-23T11:15:13.000Z","updated_at":"2025-03-17T23:21:04.000Z","dependencies_parsed_at":"2022-08-29T00:20:22.226Z","dependency_job_id":null,"html_url":"https://github.com/Overv/WebCraft","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overv%2FWebCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overv%2FWebCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overv%2FWebCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overv%2FWebCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Overv","download_url":"https://codeload.github.com/Overv/WebCraft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378142,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T17:32:01.652Z","updated_at":"2025-04-05T18:07:13.755Z","avatar_url":"https://github.com/Overv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"WebCraft (HTML5 Minecraft)\n---------------------\n[![GitHub issues](https://img.shields.io/github/issues/Overv/WebCraft.svg)](https://github.com/Overv/WebCraft/issues)\n[![GitHub forks](https://img.shields.io/github/forks/Overv/WebCraft.svg)](https://github.com/Overv/WebCraft/network)\n[![GitHub stars](https://img.shields.io/github/stars/Overv/WebCraft.svg)](https://github.com/Overv/WebCraft/stargazers)\n[![GitHub license](https://img.shields.io/github/license/Overv/WebCraft.svg)](https://github.com/Overv/WebCraft/blob/master/LICENSE)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ce6335d88c8072a3f1d3/maintainability)](https://codeclimate.com/github/WarenGonzaga/WebCraft/maintainability)\n\n**This project is no longer actively maintained!**\n\nThis project is intended to become a Minecraft Classic clone using HTML 5 technologies, most notably WebGL and WebSockets. No third-party libraries are used, with the exception of glmatrix and socket.io. People who have written similar demos used libraries such as *three.js*, but it is\nboth foolish and inefficient to use a 3D engine for rendering large amount of blocks.\n\nScreenshots\n---------------------\n\n\u003ca href=\"http://i.imgur.com/tDzki.png\"\u003e![Singleplayer structure](http://i.imgur.com/2qBGy.png)\u003c/a\u003e\n\nStructure\n---------------------\n\n+ *js/* - Includes the different modules that make up the functionality of WebCraft.\n+ *media/* - Contains the graphics resources.\n+ *style/* - Contains stylesheets for the HTML front-ends.\n+ *singleplayer.html* - The front-end for the singleplayer client.\n+ *multiplayer.html* - The front-end for the multiplayer client.\n+ *server.js* - The Node.js server code.\n\nModules\n---------------------\n\nThe two front-ends invoke the available modules to deliver the components necessary for the gameplay and graphics of either the singleplayer or multiplayer experience. The available modules are listed below.\n\n**Blocks.js**\n\nThis is the most *moddable* module, as it contains the structure with the available block materials and their respective properties. It also contains functions invoked by the render class for proper shading and lighting of blocks.\n\n**World.js**\n\nThis is the base class, which all other modules depend on. Although it is a very important module, it is also the most passive module. It contains the block structure of the world and exposes functions for manipulating it.\n\n**Physics.js**\n\nThis module has strong roots in the world class and simulates the flow of fluid blocks and the gravity of falling blocks at regular intervals. It has no specific parameters and is simply invoked in the game loop to update the world.\n\n**Render.js**\n\nThis is the module that takes care of visualizing the block structure in the world class. When a world is assigned to it, it sets up a structure of chunks that are updated when a block changes. These chunks are mostly just fancy Vertex Buffer Objects. As this module takes care of the rendering, it also houses the code that deals with *picking* (getting a block from an x, y position on the screen).\n\n**Player.js**\n\nFinally there is also the module that handles everything related to the player of the game. Surprising, perhaps, is that it also deals with the physics and collision of the player. Less surprising is that it manages the material selector and input and responds to it in an update function, just like the physics module.\n\n**Network.js**\n\nThis module makes it easy to synchronize a world between a server and connected clients. It comes with both a *Client* and *Server* class to facilitate all of your networking needs.\n\nTypical game set-up\n---------------------\n\nFirst a new world is created and the block structure is initialised.\n\n\tvar world = new World( 16, 16, 16 );\n\tworld.createFlatWorld( 6 );\n\nThe *6* in *createFlatWorld* here is the line between the ground and the first air layer.\n\nNow that we have a world, we can set up a renderer, which will subsequently divide the world into chunks for rendering.\n\n\tvar render = new Renderer( \"renderSurface\" );\n\trender.setWorld( world, 8 );\n\trender.setPerspective( 60, 0.01, 200 );\n\nThe *8* here determines the XYZ size of one chunk. In this case the entire world consists out of 8 chunks.\n\nTo finish the code that deals with world management, we create the physics simulator.\n\n\tvar physics = new Physics();\n\tphysics.setWorld( world );\n\nAnd finally, we add a local player to the game:\n\n\tvar player = new Player();\n\tplayer.setWorld( world );\n\tplayer.setInputCanvas( \"renderSurface\" );\n\tplayer.setMaterialSelector( \"materialSelector\" );\n\nThat concludes the set-up code. The render loop can be constructed with a timer on a fixed framerate:\n\n\tsetInterval( function()\n\t{\n\t\tvar time = new Date().getTime() / 1000.0;\n\t\t\n\t\t// Simulate physics\n\t\tphysics.simulate();\n\t\t\n\t\t// Update local player\n\t\tplayer.update();\n\t\t\n\t\t// Build a chunk\n\t\trender.buildChunks( 5 );\n\t\t\n\t\t// Draw world\n\t\trender.setCamera( player.getEyePos().toArray(), player.angles );\n\t\trender.draw();\n\t\t\n\t\twhile ( new Date().getTime() / 1000 - time \u003c 0.016 );\n\t}, 1 );\n\nTo see how the material selector and canvas can be set-up, have a look at *singleplayer.html* and *style/main.css*. Note that the player and physics modules are entirely optional, so you could just as well use this code as a base for making a Minecraft map viewer on your website.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverv%2Fwebcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foverv%2Fwebcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foverv%2Fwebcraft/lists"}