pck404 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=60887 XOR approximation using NN <p> <table><tr><td> <a href="/bbs/?pid=121825#p"> <img src="/bbs/thumbs/pico8_pck404_xor-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=121825#p"> pck404_xor</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=121825#p"> [Click to Play]</a> </td></tr></table> </p> <p>This is a visualisation of a 3-layer perceptron learning to approximate the XOR function.</p> <p>At some point I would like to make an educational cart like <a href="https://www.lexaloffle.com/bbs/?pid=121810">this one</a> to explain what's happening under the hood.</p> https://www.lexaloffle.com/bbs/?tid=50488 https://www.lexaloffle.com/bbs/?tid=50488 Sun, 04 Dec 2022 21:04:13 UTC Machine learning 101 : the perceptron <p> <table><tr><td> <a href="/bbs/?pid=121810#p"> <img src="/bbs/thumbs/pico8_ml101_perceptron-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=121810#p"> Machine learning 101 : the perceptron</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=121810#p"> [Click to Play]</a> </td></tr></table> </p> <h2>Why this educart?</h2> <p>The <a href="https://en.wikipedia.org/wiki/Perceptron">perceptron</a> is a tiny computing unit that is a fondamental block of artificial neural networks.</p> <p>Because machine learning is getting more important everyday, I thought I would share the little knowledge I have in the form of a chewable educart, hoping more people would get interested in the inner workings of machine learning algorithms.</p> <p>Tell me if you found this useful and if I should make more. Also, I'm not a ML specialist and English is not my primary language so any suggestions to make this cart better will be appreciated!</p> <p>&hearts;pck404</p> <h3>Additional cart : interact with the perceptron in real-time</h3> <p> <table><tr><td> <a href="/bbs/?pid=121810#p"> <img src="/bbs/thumbs/pico8_pck404_perceptron_lr-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=121810#p"> pck404_perceptron_lr</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=121810#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Sources and links</h3> <p>My main source for this cart is <a href="https://natureofcode.com/book/chapter-10-neural-networks/">Daniel Shiffman's wonderful &quot;Nature of Code&quot;</a> as well as <a href="https://www.youtube.com/watch?v=ntKn5TPHHAk">the Coding Train video series on neural networks</a>.</p> <h3>Changelog</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> V2 :</p> <ul> <li>add rewind (go back to previous text/screen)</li> <li>add interactive cart with adjustable learning rate<br /> </div></div></div></li> </ul> https://www.lexaloffle.com/bbs/?tid=50481 https://www.lexaloffle.com/bbs/?tid=50481 Sun, 04 Dec 2022 17:34:12 UTC Wave function collapse - Simple tiled model <p> <table><tr><td> <a href="/bbs/?pid=119553#p"> <img src="/bbs/thumbs/pico8_pck404_wfc_stm-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=119553#p"> pck404_wfc_stm</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=119553#p"> [Click to Play]</a> </td></tr></table> </p> <p>This is my take on the wave function collapse algorithm in one of its simple variants : the simple tiled model.</p> <p>Given a set of tiles and some adjancency rules, the algorithm tries to produce an image. It can be used for levels generation, pattern-like backgrounds and can also be used for non-visual data.</p> <h3>How does it work ?</h3> <p>This cart contains a few demo tilesets and rulesets that you can navigate between with the left and right arrows.</p> <p>Sometimes the algorithm gets stuck (shown with red tiles). This happens when there is a contradiction : the rules won't allow any tile to be placed on a position. Press X or O to restart.</p> <h3>Yeah but, <em>really</em>, how does it work ?</h3> <p>I suggest you look at the links provided below for more information about the algorithm.</p> <p>For this specific implementation, I used bitfields to encode adjacency rules : each tile has a list of 4 integers (for the four directions : up, right, down, left). Valid neighbors are determined by comparing (with a binary AND) the opposite bitfields of each tiles : 1 can connect with 1, 3 can connect with 2 and with 1,...</p> <h3>Links</h3> <ul> <li>Original implementation by Maxim Gumin (@ExUtumno) : <a href="https://github.com/mxgmn/WaveFunctionCollapse">https://github.com/mxgmn/WaveFunctionCollapse</a></li> <li>The coding train's implementation which this cart is based on : <a href="https://youtu.be/rI_y2GAlQFM">https://youtu.be/rI_y2GAlQFM</a></li> <li>A nice explanatory video by Martin Donald : <a href="https://youtu.be/2SuvO4Gi7uY">https://youtu.be/2SuvO4Gi7uY</a></li> <li>GDC Talk about wave function collapse in &quot;Caves of Qud&quot; : <a href="https://youtu.be/AdCgi9E90jw">https://youtu.be/AdCgi9E90jw</a></li> </ul> https://www.lexaloffle.com/bbs/?tid=49913 https://www.lexaloffle.com/bbs/?tid=49913 Tue, 25 Oct 2022 20:12:14 UTC Campfire (trying to simulate fire) <p> <table><tr><td> <a href="/bbs/?pid=118338#p"> <img src="/bbs/thumbs/pico8_pck404_campfire-3.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=118338#p"> Campfire (trying to simulate fire)</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=118338#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Campfire</h1> <p>This is just me trying to simulate fire in Pico8 without shaders or fancy particle systems.</p> <p>My approach is :</p> <ul> <li>At load time : <ul> <li>Generate bursts of animated particles</li> <li>Each particle increments the brightness value for the pixels it sits on</li> <li>The burst animations are baked into the spritesheet</li> </ul></li> <li>At run time : <ul> <li>Animate the baked sprites (moving them up)</li> <li>Again, add the brightness values together</li> </ul></li> </ul> <p>The brightness value (which is just a color from 0 to 7) is mapped to a fire shade with pal().</p> <p>There are other particle systems for bursts of sparkles and fireflies.</p> <p>Any thought? What would be your approach?</p> <h4>v2 update</h4> <ul> <li>use colors 0 to 7 for fire shades : no table needed to store brightness values</li> <li>bake animations into spritesheet for performance</li> <li>got rid of smoke</li> <li>add flickering</li> <li>nicer fireflies and flying ember</li> <li>add clouds</li> </ul> <h4>v3 update</h4> <ul> <li>press a button to toggle scene on/off (monitor CPU usage of fire only)</li> </ul> https://www.lexaloffle.com/bbs/?tid=49576 https://www.lexaloffle.com/bbs/?tid=49576 Sat, 01 Oct 2022 23:56:04 UTC Fulmosago <p> <table><tr><td> <a href="/bbs/?pid=117615#p"> <img src="/bbs/thumbs/pico8_pck404_fulmosago_1rc1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=117615#p"> Fulmosago</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=117615#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Fulmosago</h1> <p>A bright yellow ship is launched at full speed across the universe.</p> <p>Mission code is Fulmosago. The objective : a small and well-guarded planet.</p> <p>Based on <a href="https://www.youtube.com/watch?v=81WM_cjp9fo">Basic Shmup Tutorial</a> by Lazy Devs Academy.</p> <h2>Controls</h2> <p>In menus, press X or C to confirm.</p> <p>In game, use arrow keys to move your ship.</p> <p>The ship will shoot automatically when there are enemies. Hold C to force shoot. Hold X to prevent autoshooting.</p> <h2>Pickups</h2> <ul> <li>pink pickup restores health (or add one extra heart if health is full)</li> <li>orange pickup activates double front canons</li> <li>blue pickup activates side canons (auto-guided orbs)</li> </ul> <h2>Soundtrack</h2> <p>Listen to the soundtrack on <a href="https://soundcloud.com/pck404/sets/fulmosago">SoundCloud</a>.</p> <h2>About</h2> <p>This is my second Pico-8 game. The Lazy Devs Academy tutorial series served as a basis. From there, my main goal was to tell a simple but impactful story within a limited play time.</p> https://www.lexaloffle.com/bbs/?tid=49387 https://www.lexaloffle.com/bbs/?tid=49387 Sun, 18 Sep 2022 17:25:15 UTC 512px under <p> <table><tr><td> <a href="/bbs/?pid=102471#p"> <img src="/bbs/thumbs/pico8_pck404_512px_under-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=102471#p"> pck404_512px_under</a><br><br> by <a href="/bbs/?uid=60887"> pck404</a> <br><br><br> <a href="/bbs/?pid=102471#p"> [Click to Play]</a> </td></tr></table> </p> <h1>512px under</h1> <p>Year 4096. A burried building with lasers and traps. How many lives will it take to leave this place ?</p> <ul> <li>Jump, wall jump and dodge lasers</li> <li>18 memory cards to collect</li> <li>32 rooms to explore (with lasers in them)</li> <li>Auto-save</li> <li>1 red cube</li> <li>Lots of lasers !</li> </ul> <h2>Controls</h2> <ul> <li>Arrows : move</li> <li>V (or X) : jump</li> <li>C (or Z) : grab/drop</li> </ul> <h3>Move and jump</h3> <img style="margin-bottom:16px" border=0 src="/media/60887/512px controls move-jump small.gif" alt="" /> <h3>Grab and drop</h3> <img style="margin-bottom:16px" border=0 src="/media/60887/512px controls grab-drop small.gif" alt="" /> <h3>Wall jump</h3> <img style="margin-bottom:16px" border=0 src="/media/60887/512px controls wall_jump small.gif" alt="" /> <h2>About</h2> <p>This game is my first Pico-8 game. It is also the first game I manage to finish after a few attempts with game engines such as Unity and Godot. It took me 1 month to complete the first published version. The Pico-8 restrictions allowed me to define a manageable scope for this game. In the end, I used the entire space available in the map editor and the spritesheet editor. The code uses every token allowed.</p> <h2>Changelog</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> v1 :</p> <ul> <li>Update rooms (easier rooms on first floor)</li> <li>Added room names</li> <li>Added SFX for hidden carts</li> <li>Louder background music</li> <li>Sync lasers on BGM upbeat</li> <li>Animations in lab</li> <li>Update NPC texts</li> <li>Vertigo animation when player is close to platform edges</li> <li>Smaller player hitbox</li> <li>Button hints in backgrounds</li> <li>Move hidden carts</li> <li>Higher mid-air speed</li> </ul> <p>v1-beta :</p> <ul> <li>Update rooms (adjust difficulty on the main path)</li> <li>Fix seconds and frame counters not being properly saved and restored</li> <li>Auto-save state when close to a spawner tile instead of saving when changing room</li> <li>Show which button to press to teleport and decrease button hold duration</li> <li>Increase jump buffer duration and coyote jump duration (grace frames)</li> <li>Decrease walk acceleration to make it easier to move by 1 pixel</li> <li>Increase lamp range</li> <li>Red cube won't spawn if there's no saved data<br /> </div></div></div></li> </ul> https://www.lexaloffle.com/bbs/?tid=45674 https://www.lexaloffle.com/bbs/?tid=45674 Sun, 12 Dec 2021 15:21:43 UTC