WaltCodes [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=27237 Tuck and Rolo <p> <table><tr><td> <a href="/bbs/?pid=100493#p"> <img src="/bbs/thumbs/pico8_tuckandrolo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=100493#p"> Tuck And Rolo 1.0</a><br><br> by <a href="/bbs/?uid=27237"> WaltCodes</a> <br><br><br> <a href="/bbs/?pid=100493#p"> [Click to Play]</a> </td></tr></table> </p> <p>Tuck and Rolo is about being a cool skeleton (Tuck), collecting mushrooms, and tackling fiends, all with the help your fire-spitting, mostly-loyal bird friend (Rolo). It is an action platformer with a scoring system that rewards exploration and survival over speed. </p> <p>This game was originally an outlet for me to get familiar with pixel art and to experiment with an OOP approach to game entities in PICO-8 (<a href="https://www.lexaloffle.com/bbs/?tid=30886">https://www.lexaloffle.com/bbs/?tid=30886</a>). For years, Tuck and Rolo was more of a scratchpad than any sort of product with a direction. Eventually I decided that not having a finished game was silly. With the addition of scoring, NG+, and music, I felt it was worth releasing. It's come a long way: <a href="https://www.lexaloffle.com/bbs/?tid=30552">https://www.lexaloffle.com/bbs/?tid=30552</a></p> <p>Binary downloads are included in the game page on my website: <a href="https://walt.codes/tuck-and-rolo/">https://walt.codes/tuck-and-rolo/</a></p> <p>The music is by D.D. Curry: <a href="https://soundcloud.com/dd_curry">https://soundcloud.com/dd_curry</a> </p> https://www.lexaloffle.com/bbs/?tid=45417 https://www.lexaloffle.com/bbs/?tid=45417 Sat, 20 Nov 2021 17:55:13 UTC BROOKSATRON <p> <table><tr><td> <a href="/bbs/?pid=49938#p"> <img src="/bbs/thumbs/pico49937.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=49938#p"> BROOKSATRON</a><br><br> by <a href="/bbs/?uid=27237"> WaltCodes</a> <br><br><br> <a href="/bbs/?pid=49938#p"> [Click to Play]</a> </td></tr></table> </p> <p>BROOKSATRON was a little &quot;game jam&quot; experiment I made with my little sister. We sat down one afternoon over Thanksgiving and I showed her what sort of wonders PICO-8 had to offer. Over the next couple days, she drew most of the sprites, composed the music, and drew out the levels. It was a lovely weekend. </p> https://www.lexaloffle.com/bbs/?tid=30892 https://www.lexaloffle.com/bbs/?tid=30892 Sun, 04 Mar 2018 15:49:59 UTC compos: reusable components for object-oriented PICO-8 <p> <table><tr><td> <a href="/bbs/?pid=49908#p"> <img src="/bbs/thumbs/pico49906.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=49908#p"> compos: reusable components for object-oriented PICO-8 0.1</a><br><br> by <a href="/bbs/?uid=27237"> WaltCodes</a> <br><br><br> <a href="/bbs/?pid=49908#p"> [Click to Play]</a> </td></tr></table> </p> <p>Hey y'all! I'm so excited to share an object-oriented component system I've been working on for PICO-8. I'm still super new to the platform, so I'm looking for any and all feedback you might have -- how to save tokens, smarter ways to loop over updates, cooler rendering techniques, anything! </p> <p>I built it out as a toolset for the game I'm working on right now, so please forgive me if I've forgotten to take out anything too specialized. Let me know if you're able to use it on a project or if you have any feedback at all! </p> <p>Thanks for reading! Below is the readme from the github page, linked below. </p> <p>GITHUB: <a href="https://github.com/walt-er/compos">https://github.com/walt-er/compos</a></p> <h1>compos: reusable components for object-oriented PICO-8</h1> <p>compos: like &quot;components&quot;, but with fewer characters!</p> <p>compos are independent, reusable objects that can be added to your game's actors to give them certain behaviors. compos manage their own state, initialization, updating, and drawing. The only thing you might need to do is set some intitial values.</p> <p>There's a fair amount of overhead for defining so many components right out of the gate. But hopefully the savings come down the line: it's easy to attach behaviors to actors independently, so defining large numbers of actors with similar behaviors is simple and doesn't require messy class inheritance. This system is build with procedural generation in mind -- it's easy to spawn complex actors on the fly, mixing and matching qualities without spending tokens.</p> <p>The compos include:</p> <ul> <li>Position</li> <li>Size</li> <li>Velocity</li> <li>Gravity</li> <li>Collider</li> <li>Age</li> <li>Patrol</li> </ul> <p>This library also includes a number of helper functions, including methods for drawing sprites and primitives with outlines, integrated logging, generating vectors, copying tables, tiling sprites, and more.</p> <p>More importantly, the methods for adding and removing actors from the active list, used in conjunction with the compos update pool (where actors and compos register to run their updates), mean that once you've defined an init(), update() or draw() function to an actor, they'll act just as you expect as they are added and removed from the global list of actors.</p> <h2>Starting with actors</h2> <p>compos loops over an &quot;actors&quot; array and runs the functions those actors and their components have registered for. For your entities to use the compos lifecycle, they will need to copy over the desired components and then be added to the global list of actors.</p> <p>Here's an example of an object that draws an animating sprite in the middle of the screen:</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>local thingy = { physical = true, -- this inits the x, y, w, and y properties sprite = copy(sprite), -- this copies in the compo sprite component init = function(self) -- this runs on compo_init (or on demand if this actor is added with add_actor() translate(self, 60, 60) -- translate moves an actor to an x and y vector local spritesheet = split'0, 1, 2' -- split saves tokens by turning comma separated lists into arrays self.sprite:animate(self, spritesheet, 15, true) -- the third parameter is sprites-per-seocnd, the fourth is looping end } -- add to list of actors to be initialized and updated add(actors, thingy)</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Notice that the actor does not need to register any <code>update</code> or <code>draw</code> functions -- the <code>sprite</code> compo, when initialized, will register for all the lifecycle methods it requires.</p> <p>If you're adding actors on the fly, use <code>add_actor()</code>. This method will run the required initialization and event registration before the actor is added to the scene.</p> <h2>Lifecycle and the update pool</h2> <p>compos will handle their own updates, but you'll need to add compos functions somewhere for them to run. If nothing else, add the three basic functions to your cart:</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>function _init() compos_init() end function _update() compos_update() end function _draw() cls() -- compos doesn't clear for you! compos_draw() end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Behind the scenes, within those <code>compos_*</code> functions, there are various &quot;pools&quot; of actors and compos that have registered to run each frame. The update functions availible are <code>early_update</code>, <code>update</code>, <code>late_update</code>, and <code>fixed_update</code>, and drawing is done in <code>early_update</code> and <code>update</code>.</p> <p>When an actor is initialized, it's update functions are registered in those pools and run in the order they are added. Keep that in mind for drawing -- actors added later will be drawn on top. (Note that I want to add an optional override for this soon! For now you can use <code>early_draw</code> to make sure things are drawn in first.)</p> <p>It's important to remove actors by using <code>remove_actor()</code>, as opposed to, say, <code>del(actors, thingy)</code>, because the <code>remove_actor</code> function also unregisters all events. Failing to use it could mean a memory leak as more and more actors are registered and none are rmeoved.</p> <h2>Integrating compos into your project</h2> <p>The most direct way to integrate compos into your project is simply copy pasting all of compos.lua into your cart, then deleting unwanted components and functions. There are a lot of functions included here, and cherrypicking what you want will save a ton of tokens. You probably don't need it all!</p> <p>Integration can also be achieved using picotool, with some extra work. Just <code>require('compos.lua')</code> in your source pico8 file to include compos inside a &quot;require&quot; function. Just note that you'll need to delete the function wrapping the compo definitions for your code to reference them without errors. (NOTE: if you think I could get around this, let me know!)</p> <p>You could also just hack the compo.p8 cart, using that as a jumping off point!</p> <h2>Demo: Bouncy Blobs</h2> <p>Here's some code that uses compos to draw hundreds of actors with positions, sizes, colors, and gravity:</p> <p>SOURCE: <a href="https://github.com/walt-er/compos/blob/develop/demo.lua">https://github.com/walt-er/compos/blob/develop/demo.lua</a></p> <p><img src="http://walt.codes/compos/compos-bouncing-blobs.gif" alt="Compos in action" /></p> https://www.lexaloffle.com/bbs/?tid=30886 https://www.lexaloffle.com/bbs/?tid=30886 Sat, 03 Mar 2018 19:38:33 UTC Tuck <p> <table><tr><td> <a href="/bbs/?pid=47852#p"> <img src="/bbs/thumbs/pico47851.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=47852#p"> Tuck 0.1</a><br><br> by <a href="/bbs/?uid=27237"> WaltCodes</a> <br><br><br> <a href="/bbs/?pid=47852#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=30552 https://www.lexaloffle.com/bbs/?tid=30552 Thu, 04 Jan 2018 00:10:21 UTC 8Bit Emperor <p> <table><tr><td> <a href="/bbs/?pid=47850#p"> <img src="/bbs/thumbs/pico47849.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=47850#p"> 8Bit Emperor 1.0</a><br><br> by <a href="/bbs/?uid=27237"> WaltCodes</a> <br><br><br> <a href="/bbs/?pid=47850#p"> [Click to Play]</a> </td></tr></table> </p> <p>This &quot;demake&quot; is a love letter to the amazing BLACK EMPEROR by Tom&aacute;s Vicu&ntilde;a and BumbleBear Games. Race your motorcycle through the desert on randomly generated track that resets with the cart. Challenge your friends, memorize the course, and make it farther.</p> <p>Each load of the cart generates a random course that increases in difficulty as you progress. One thing the game is definitely missing is music -- it's so important to the feeling of the original, but I'm worthless with music and so I failed to compose any. I currently have a friend working on a track -- here's the game as is, for now. </p> https://www.lexaloffle.com/bbs/?tid=30551 https://www.lexaloffle.com/bbs/?tid=30551 Wed, 03 Jan 2018 23:05:54 UTC