{"action":"created","issue":{"url":"https://api.github.com/repos/joppiesaus/webblocks/issues/2","repository_url":"https://api.github.com/repos/joppiesaus/webblocks","labels_url":"https://api.github.com/repos/joppiesaus/webblocks/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/joppiesaus/webblocks/issues/2/comments","events_url":"https://api.github.com/repos/joppiesaus/webblocks/issues/2/events","html_url":"https://github.com/joppiesaus/webblocks/issues/2","id":159768121,"number":2,"title":"Chunk generation is not asynchronous","user":{"login":"joppiesaus","id":5196627,"avatar_url":"https://avatars.githubusercontent.com/u/5196627?v=3","gravatar_id":"","url":"https://api.github.com/users/joppiesaus","html_url":"https://github.com/joppiesaus","followers_url":"https://api.github.com/users/joppiesaus/followers","following_url":"https://api.github.com/users/joppiesaus/following{/other_user}","gists_url":"https://api.github.com/users/joppiesaus/gists{/gist_id}","starred_url":"https://api.github.com/users/joppiesaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joppiesaus/subscriptions","organizations_url":"https://api.github.com/users/joppiesaus/orgs","repos_url":"https://api.github.com/users/joppiesaus/repos","events_url":"https://api.github.com/users/joppiesaus/events{/privacy}","received_events_url":"https://api.github.com/users/joppiesaus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joppiesaus/webblocks/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/joppiesaus/webblocks/labels/help%20wanted","name":"help wanted","color":"128A0C"},{"url":"https://api.github.com/repos/joppiesaus/webblocks/labels/ULTRAHIGHPRIORITY!!!1!","name":"ULTRAHIGHPRIORITY!!!1!","color":"ff00ff"}],"state":"open","locked":false,"assignee":{"login":"joppiesaus","id":5196627,"avatar_url":"https://avatars.githubusercontent.com/u/5196627?v=3","gravatar_id":"","url":"https://api.github.com/users/joppiesaus","html_url":"https://github.com/joppiesaus","followers_url":"https://api.github.com/users/joppiesaus/followers","following_url":"https://api.github.com/users/joppiesaus/following{/other_user}","gists_url":"https://api.github.com/users/joppiesaus/gists{/gist_id}","starred_url":"https://api.github.com/users/joppiesaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joppiesaus/subscriptions","organizations_url":"https://api.github.com/users/joppiesaus/orgs","repos_url":"https://api.github.com/users/joppiesaus/repos","events_url":"https://api.github.com/users/joppiesaus/events{/privacy}","received_events_url":"https://api.github.com/users/joppiesaus/received_events","type":"User","site_admin":false},"assignees":[{"login":"joppiesaus","id":5196627,"avatar_url":"https://avatars.githubusercontent.com/u/5196627?v=3","gravatar_id":"","url":"https://api.github.com/users/joppiesaus","html_url":"https://github.com/joppiesaus","followers_url":"https://api.github.com/users/joppiesaus/followers","following_url":"https://api.github.com/users/joppiesaus/following{/other_user}","gists_url":"https://api.github.com/users/joppiesaus/gists{/gist_id}","starred_url":"https://api.github.com/users/joppiesaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joppiesaus/subscriptions","organizations_url":"https://api.github.com/users/joppiesaus/orgs","repos_url":"https://api.github.com/users/joppiesaus/repos","events_url":"https://api.github.com/users/joppiesaus/events{/privacy}","received_events_url":"https://api.github.com/users/joppiesaus/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-06-11T10:55:45Z","updated_at":"2016-07-14T03:21:04Z","closed_at":null,"body":"When a block is placed - or a chunk mesh is generated and displayed - it blocks everything else. This causes pauses in the framerate, especially on computers with less computing power. This gets worse when many blocks are changed, even in the same chunk because it doesn't get timed."},"comment":{"url":"https://api.github.com/repos/joppiesaus/webblocks/issues/comments/232546899","html_url":"https://github.com/joppiesaus/webblocks/issues/2#issuecomment-232546899","issue_url":"https://api.github.com/repos/joppiesaus/webblocks/issues/2","id":232546899,"user":{"login":"rdfriedl","id":8001706,"avatar_url":"https://avatars.githubusercontent.com/u/8001706?v=3","gravatar_id":"","url":"https://api.github.com/users/rdfriedl","html_url":"https://github.com/rdfriedl","followers_url":"https://api.github.com/users/rdfriedl/followers","following_url":"https://api.github.com/users/rdfriedl/following{/other_user}","gists_url":"https://api.github.com/users/rdfriedl/gists{/gist_id}","starred_url":"https://api.github.com/users/rdfriedl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdfriedl/subscriptions","organizations_url":"https://api.github.com/users/rdfriedl/orgs","repos_url":"https://api.github.com/users/rdfriedl/repos","events_url":"https://api.github.com/users/rdfriedl/events{/privacy}","received_events_url":"https://api.github.com/users/rdfriedl/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T03:21:04Z","updated_at":"2016-07-14T03:21:04Z","body":"i came across this project while i was poking around on github.\r\nand also iv been working on a voxel game myself so i thought i would share what iv learned.\r\n\r\nwith regards to a webworker\r\nyou could use one, but you would want to keep it opened, because spawning a new worker and closing it after it finished building the chunk would be really expensive.\r\n\r\nalso from what iv found, its not really necessary for the chunk building to be async, as long as its fast enough.\r\n\r\nalso another thing i found was, when building chunks / updating blocks or just generally running the game, the thing that took the biggest chunk out of the FPS was the garbage collector.\r\n\r\nim sure you are aware of this, but the garbage collector is the system that cleans up all the unused objects.\r\nso just make sure that you are using as few of objects as possible so the garbage collector dose not have to much work to do.\r\n\r\nfor example\r\n``` javascript\r\nfunction update(){\r\n    //blocks array has something like 10,000 blocks in it\r\n    for(var i = 0; i < blocks.length; i++){\r\n        var vec = new THREE.Vector3().copy(blocks[i].position).multiply(someOtherVec3);\r\n        var another_vec = vec.clone().add(new THREE.Vector3()).sub(new THREE.Vecotr3());\r\n    }\r\n}\r\n```\r\nif that was to run 60x a second in the game, it would be creating `4 * 10000 * 60` new `THREE.Vector3` every second which is a lot for the garbage collector to clean up.\r\n\r\nthat is not to say its a bad thing to create new object in the update function, its just a good idea to keep track of them\r\n\r\nfor example you could write the above code like this\r\n``` javascript\r\nvar vec = new THREE.Vector3();\r\nvar another_vec = new THREE.Vector3();\r\nvar tmp_vec = new THREE.Vector3();\r\nfunction update(){\r\n    //blocks array has something like 10,000 blocks in it\r\n    for(var i = 0; i < blocks.length; i++){\r\n        vec.copy( blocks[i].position ).multiply( someOtherVec3 );\r\n        another_vec.copy( vec ).add( tmp_vec.set(0,0,0) ).sub( tmp_vec.set(10,10,10) );\r\n    }\r\n}\r\n```\r\nin this case its not creating any new objects, its just using ones that are already defined\r\n\r\nanyways, thats some of my experiences when working with voxel stuff in threejs, hope it helps :smile: "}}
{"actor":{"display_login":"rdfriedl"}}