Most recent activity
-
@allObjects
i printed out the free memory throughout the app and it shows clearly where the issues lie. I have a path forward now to optimize the code. Thx for the help.At startup i use about 40% of the available memory.
Then the render function starts and gets through around 100 of the 240 horizontal screen rays before running out of memory.So i only have to make my program around 2.5 times more efficient :p
-
fyi Minification -> Pretokenise code break this code sample:
function getValue() { return "test"; } const val = getValue(); console.log(val);
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v04.218 (c) 2019 G.Williams >Uncaught SyntaxError: BREAK statement outside of SWITCH, FOR or WHILE loop at line 1 col 1 return"test"; ^ in function "getValue" called from line 3 col 15 const val=getValue(); ^ undefined >
This might be something that should still be fixed in the beta
-
Yes that worked
I reworked the project structure a bit so i can have a desktop (canvas) and a bangle version to build automatically. Had to write my own packaging algorithm since the webpack wrapper code didn't play well with the espruino interpreter.
I also added minification using unglifyJS which replaces all the function names and variables by single letters. With an exclusion list for the Bangle. and g. functions
Even with all that it seems the Bangle goes out of memory when i start the game.
How can i inspect what is eating memory in my app?
I tried with the chrome dev tools on the desktop version to look at the heap size, but i think too much stuff is loading to support to the canvas rendering, that i won't translate well to the heap inside the Bangle.
If you want to try and run it, i've included the built file in the repository:
minified: https://github.com/bertyhell/nodewatch-mazerunner/blob/master/dist/bangle.min.js
non-minified: https://github.com/bertyhell/nodewatch-mazerunner/blob/master/dist/bangle.js -
When i try connecting to my bangle watch i get this error:
Unable to retrieve board information.
Connection Error?
Connected to Web Bluetooth, Bangle.js 0f49 (No response from board)I tried resetting the device by holding buttons 1 and 2 according to this guide: https://nodewatch.dev/troubleshooting
I'm trying to get a new game to run on this watch. It's a maze runner based on the wolfenstein3d raytracing algorthm.
You can try it on desktop here: https://bertyhell.github.io/nodewatch-mazerunner/The github repo: https://github.com/bertyhell/nodewatch-mazerunner
ok, quick update
skipping the postprocessing step needed for drawing the vertical walls, i can get the memory under control.
Then the game runs at about 1 frame every 8 seconds.
If i reduce the number of rays that are cast to 240/8, then it runs at 1 frame per second.
I guess i can optimize it more by keeping track of the time it takes to do the render function and see where the bottlenecks are.
If you want to try it: https://github.com/bertyhell/nodewatch-mazerunner/blob/master/dist/bangle.min.js