Using webworkers (#18, #19)

Web Workers is a simple means for web content to run scripts in background threads. From "Using Web Workers" on Mozilla's documentation.


Because I was previously working on the grid system, now I've implemented path finding for NPCs. This is nothing more than basic A* with a couple of tweaks - most important being the ability of cutting corners or not.


I used easystar JavaScript library which is "an asynchronous A* pathfinding API written in Javascript". I put that into a webworker and every time I need to compute a value I just pass the webworker start location, end location and the grid's array.


JavaScript is single threaded but Web workers work on different thread so they will not block the UI.


Debugging web workers jobs to see if they compute and send back the right path.

Here is the full video logs:




© 2017-2020 Gali Interactive

Terms and conditions | Privacy Policy | Code of Conduct | Contact