siwu [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=41822 Data Cart npm Package <p>I have a javascript/typescript module for packing arbitrary data into a cartridge that I use for a handful of my projects. I recently published it as an <a href="https://www.npmjs.com/package/p8-data-cart">npm package</a> as I thought it may be helpful to more people.</p> <p>Below is an example cart where I used this package to quickly prepare a cart with a payload of polygonal shape data, followed by the script that was used to build it.<br /> (The resulting p8 cart was exported as a png cart separately)</p> <p>Use ◀️/▶️/🅾️/❎ to change shape.<br /> <table><tr><td> <a href="/bbs/?pid=169178#p"> <img src="/bbs/thumbs/pico8_p8_data_cart_example-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=169178#p"> p8_data_cart_example</a><br><br> by <a href="/bbs/?uid=41822"> siwu</a> <br><br><br> <a href="/bbs/?pid=169178#p"> [Click to Play]</a> </td></tr></table> </p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>import { readFileSync, writeFileSync } from 'fs'; import { CartData, writeCart } from 'p8-data-cart'; const shapes = [ // Square shape [ -0.3, -0.3, 0.3, -0.3, 0.3, 0.3, -0.3, 0.3 ], // Star shape [ -0.33867, -0.11005, -0.07969, -0.11005, 0.00000, -0.35553, 0.07969, -0.11005, 0.33867, -0.11005, 0.12912, 0.04222, 0.20885, 0.28781, 0.00000, 0.13605, -0.20885, 0.28781, -0.12912, 0.04222 ], // Heart shape [ 0.27532, -0.04442, 0.25741, -0.01513, 0.23889, 0.01376, 0.21978, 0.04224, 0.20008, 0.07030, 0.17980, 0.09794, 0.15894, 0.12513, 0.13751, 0.15189, 0.11553, 0.17819, 0.09298, 0.20402, 0.06990, 0.22938, 0.04627, 0.25427, 0.02210, 0.27866, 0.01915, 0.28138, 0.01593, 0.28362, 0.01250, 0.28539, 0.00891, 0.28668, 0.00520, 0.28750, 0.00144, 0.28783, -0.00234, 0.28768, -0.00608, 0.28706, -0.00973, 0.28595, -0.01324, 0.28435, -0.01657, 0.28227, -0.01966, 0.27970, -0.01975, 0.27962, -0.01983, 0.27953, -0.01992, 0.27945, -0.02001, 0.27936, -0.02010, 0.27927, -0.02019, 0.27919, -0.02027, 0.27910, -0.02036, 0.27901, -0.02044, 0.27893, -0.02053, 0.27884, -0.02062, 0.27875, -0.02070, 0.27866, -0.04491, 0.25428, -0.06860, 0.22940, -0.09174, 0.20404, -0.11433, 0.17821, -0.13637, 0.15191, -0.15785, 0.12516, -0.17875, 0.09796, -0.19909, 0.07032, -0.21884, 0.04226, -0.23800, 0.01377, -0.25656, -0.01512, -0.27452, -0.04442, -0.29418, -0.09758, -0.29962, -0.14669, -0.29277, -0.19072, -0.27559, -0.22866, -0.25001, -0.25950, -0.21800, -0.28221, -0.18148, -0.29578, -0.14242, -0.29919, -0.10275, -0.29142, -0.06443, -0.27146, -0.02939, -0.23829, 0.00040, -0.19089, 0.03020, -0.23829, 0.06523, -0.27146, 0.10355, -0.29142, 0.14322, -0.29919, 0.18228, -0.29578, 0.21880, -0.28221, 0.25082, -0.25950, 0.27639, -0.22866, 0.29357, -0.19072, 0.30042, -0.14669, 0.29499, -0.09758 ] ]; function buildPayload(shapes: number[][]) { const payload: number[] = []; payload.push(shapes.length); // Shape count // Shape offset table let offset = 1 + shapes.length; // Shape count byte + offset table size for (const shapeData of shapes) { payload.push(offset); offset += 1 + shapeData.length; // 1 byte for point count + length of point data } // Shape point data for (const shapeData of shapes) { const pointCount = shapeData.length / 2; payload.push(pointCount); for (const shapePointComponent of shapeData) { // Center points around 0.5, 0.5 and scale range -1 - 1 to 0 - 255 const ratio = (255 - 0) / (1 - -1) const centeredComponent = (shapePointComponent + 1); const scaledComponent = Math.round(centeredComponent * ratio); payload.push(scaledComponent); } } return new Uint8Array(payload); } const luaScript = readFileSync('shapes.lua', 'utf-8'); const payload = buildPayload(shapes); const cartData = new CartData(); cartData.data.set(payload); cartData.lua = luaScript; const cartString = writeCart(cartData); writeFileSync('shapes.p8', cartString);</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=149820 https://www.lexaloffle.com/bbs/?tid=149820 Thu, 26 Jun 2025 22:14:57 UTC Globbo <p>This is <strong>Globbo</strong>!</p> <p>A PICO-8 adaptation of the classic Mac game <a href="https://www.macintoshrepository.org/6199-blobbo">Blobbo</a>.</p> <p>The goal of the game is to pick up all toy chests before proceeding to the next room through the stairs. Tread carefully though, or you might find yourself squished by a bowling ball or punctured by an arrow.</p> <p>The game contains a subset of the features found in the original. Many of the rooms in this version have been inspired by the original. My approach for these rooms has been to try to make condensed versions of the originals, trying to capture the &quot;theme&quot; of a room while taking liberties with its layout to accommodate the 16x16 grid.</p> <p>The aim was not to make a fully featured port of the original, but rather to pluck the best parts and reshape it in a way that works well with PICO-8.</p> <p>Please enjoy! ^_^</p> <p> <table><tr><td> <a href="/bbs/?pid=106007#p"> <img src="/bbs/thumbs/pico8_globbo-8.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=106007#p"> Globbo 1.1</a><br><br> by <a href="/bbs/?uid=41822"> siwu</a> <br><br><br> <a href="/bbs/?pid=106007#p"> [Click to Play]</a> </td></tr></table> </p> <h2>Controls</h2> <p><strong>D-pad / Arrow Keys</strong>: Move Globbo<br /> <strong>Hold Cross / X + Circle / Z</strong>: Undo<br /> <strong>Hold Cross / X + Up</strong>: Show play statistics</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;"></p> <h3>Version 1.1</h3> <ul> <li>Removed screen flash when rewinding</li> <li>Added a room select menu</li> <li>Added in-game how-to-play instructions</li> <li>Added a star award system to balance the good ending requirements after the room select menu was introduced</li> </ul> <h3>Version 1.0</h3> <ul> <li>Added spike trap obstacle</li> <li>Added four more rooms</li> <li>Ready for release 🎉</li> </ul> <h3>Beta 0.5</h3> <ul> <li>Improved ending screen</li> <li>Swapped circle and cross button functions in the ingame overlay</li> </ul> <h3>Alpha 0.4</h3> <ul> <li>Added ingame overlay displaying room name and play statistics as well as giving access to undo feature</li> <li>Changed controls for undo feature to accommodate overlay and reduce risk of unintentional activation</li> </ul> <h3>Alpha 0.3.1</h3> <ul> <li>Fixed a bug where you could exit a room early after undoing chest pickups</li> </ul> <h3>Alpha 0.3</h3> <ul> <li>Added tutorial room</li> <li>Room 2 seemed too difficult to appear that early, moved it last in the room order</li> <li>Added undo feature, press circle (z) to undo</li> <li>Added some statistics to the win screen</li> <li>Fixed a bug that allowed the player to move diagonally, passing through some walls</li> </ul> <h3>Alpha 0.2</h3> <ul> <li>Added one way tiles</li> <li>Added marshmallow obstacle</li> <li>Added grid maze room</li> <li>Added marshmallow focused room</li> <li>Improved title screen</li> <li>Fixed a bug that allowed some arrows to slide past blocking tiles on a slope<br /> </div></div></div></li> </ul> https://www.lexaloffle.com/bbs/?tid=46390 https://www.lexaloffle.com/bbs/?tid=46390 Tue, 15 Feb 2022 22:17:45 UTC