ondras / rot.js

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
https://ondras.github.io/rot.js/hp/
BSD 3-Clause "New" or "Revised" License
2.32k stars 254 forks source link

Map generation preloader #199

Closed TobyReeno closed 2 years ago

TobyReeno commented 2 years ago

Hi, I'm using rot.js for generating the Cellular map. Simple way as on your example page. However when I try to create a bigger map, say 1000x1000 then the generation process takes a lot of time and causes the game to freeze for that time.

I was wondering if there is any built-in way to slow down the generation process in order to display the percentage preloader to the user? Right now when the generation process takes the full CPU, there is no space for rendering the output for the user.

TobyReeno commented 2 years ago

Alright, I solved it with WebWorkers and the map generation callback function :).