Stompy [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=17402 Possible to export Voxatron games to html? <p>Is it possible to export Voxatron games to html/js like pico-8 can? I would like to host games on itch or my own website if possible. I saw that you can embed the player from the bbs, but that's less ideal than self hosting.</p> https://www.lexaloffle.com/bbs/?tid=38904 https://www.lexaloffle.com/bbs/?tid=38904 Sun, 19 Jul 2020 16:02:27 UTC Token saving tip <p>Hey everyone. I recently released <a href="https://www.lexaloffle.com/bbs/?tid=38825">Goober's in the Mix</a>. It was my first bigger pico game that actually required me to optimize for tokens. I wrote a lot of pseudo object oriented code with classes and inheritance. I found myself with a lot of code that looked like this:</p> <div> <div class=scrollable_with_touch style="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 thing = class{ update = function(self) -- cache a bunch of properties local x, y, dx, dy, health, frozen, invuln = self.x, self.y, self.dx, self.dy, self.health, self.frozen ... game logic in here -- resync all those properties on the instance self.x, self.y, self.dx, self.dy, self.health, self.frozen, self.invuln = x, y, dx, dy, health, frozen 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>All that caching and syncing saves tokens instead of referencing self in the logic, but we can save <em>more</em>.</p> <p>Lua has a feature called <a href="https://devdocs.io/#q=lua52%20environment">environments</a> that lets you alter how global variables are looked up. So I altered my initial class declaration to look something like:</p> <div> <div class=scrollable_with_touch style="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>_G = _ENV -- just a new name to distinguish this as the original global scope _G.__index = _G -- if _G is used as a metatable, it will look itself for unfound properties local class do local mt = setmetatable({ update = noop, -- defaults draw = noop, -- defaults init = noop, -- defaults __call = function(self, o) -- takes an table of nondefault values o = o or {} -- empty table if none given setmetatable(o, self) -- each instance sets itself as the new prototype self.__index = self -- looks in itself for unfound properties self.__call = getmetatable(self).__call -- sugar to allow calling class like a function o:init(self) -- call an init/constructor function if given return o -- return the new instance end }, _G) -- the class mt is the global scope !IMPORTANT -- if you don't keep this reference to global scope you're going to run into trouble later [1] mt.__index = mt -- this class mt indexes itself if child doesn't have a property class = setmetatable({}, mt) -- set the classes metatable 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>Most of this is pretty standard for classes in Lua. But the magic comes in with that global reference. This allows us to use environments without breakings everything.</p> <div> <div class=scrollable_with_touch style="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>dog = class{ x = 10, update = function(self) local _ENV = self -- set self as the new environment if (x &lt; 127) x += 1 -- we can now reference self.x as just x. 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>Things to note:<br /> _ENV is where globals are looked up. Like how globals are found on the Window object in client-side javascript. Normally when you reference a global `z` it's the same as referencing `_G.z` or `_ENV.z` in Lua. So when you change the local value of `_ENV` within that scope, it will reference what ever you set as the value instead.</p> <p>This means that things previously available in the global scope may not be there. Like the pico api functions. `print`, `rectfill`, `time` etc wouldn't be available. This is why we added that reference to `_G` in our lookup chain.</p> <p>This also means you can have weird variable shadowing issues when you think you're altering a global but really creating a new property on your class instance or vice versa. You can use that `_G` reference or `self` reference directly if you know you're shadowing an existing variable in a parent scope.</p> <p>When I first refactored to add this technique i saved something like 1.5k+ tokens removing all those caching variable and the syncing back to the instance values.</p> <p>Hope this saves you all a bunch of tokens and continues to move the meta forward! Happy to answer any questions or make revisions as needed.</p> https://www.lexaloffle.com/bbs/?tid=38894 https://www.lexaloffle.com/bbs/?tid=38894 Sat, 18 Jul 2020 11:12:54 UTC goobers_in_the_mix <p> <table><tr><td> <a href="/bbs/?pid=79334#p"> <img src="/bbs/thumbs/pico8_goobers_in_the_mix-10.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=79334#p"> goobers_in_the_mix</a><br><br> by <a href="/bbs/?uid=17402"> Stompy</a> <br><br><br> <a href="/bbs/?pid=79334#p"> [Click to Play]</a> </td></tr></table> <br /> edit: fixed the sluggish jumps<br /> edit: tightened up camera, added some tips about switching items, shrunk spike hitboxes, added some helpful tiles in the firepit<br /> edit: widened the rat/bat safety window, added a chest near the star door which gives you an extra heart and serves as a 1 time savepoint<br /> edit: healing salve only replenishes a heart, cap is still 4 hearts<br /> edit: fix collisions at trigger points<br /> edit: add skull to door guarded by boss &amp; add visual feedback when boss is hit<br /> edit: changed the healing salve to a full checkpoint, rat doesn't spawn under the double spikes until after you get the first potion, added a in-game tip about using potions, added another checkpoint in the firepit, took the corner off the annoying ledge over the firepit spike jump, changed boss dialog to make it more clear about what he does or doesn't have in his possession. </p> <p>First larger game (sitting at 8180 tokens atm). Goober's in the Mix is a metroidvania in a dungeon setting. You play Goober the goblin and need to investigate a disturbance in the dungeon. Constructive criticism welcome as well as token saving tips.</p> <p>Music by Cody Loyd.</p> <img style="margin-bottom:16px" border=0 src="/media/17402/2_goobers_in_the_mix_5.gif" alt="" /> <p>Post your win screens.</p> https://www.lexaloffle.com/bbs/?tid=38825 https://www.lexaloffle.com/bbs/?tid=38825 Tue, 14 Jul 2020 21:24:12 UTC Office Escape <p> <table><tr><td> <a href="/bbs/?pid=71044#p"> <img src="/bbs/thumbs/pico8_office_escape-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=71044#p"> office_escape</a><br><br> by <a href="/bbs/?uid=17402"> Stompy</a> <br><br><br> <a href="/bbs/?pid=71044#p"> [Click to Play]</a> </td></tr></table> </p> <p>Made for 2-Button Jam 2019</p> <p>Source is on <a href="https://github.com/ryanford-frontend/office-escape">github</a>.</p> <p>It's released MIT licensed. </p> <p>Music was done by Cody Loyd.</p> <p>Update 1.1: Now shows score for all gameovers</p> https://www.lexaloffle.com/bbs/?tid=36261 https://www.lexaloffle.com/bbs/?tid=36261 Sun, 15 Dec 2019 19:25:45 UTC API Text Errors Megathread <p>Just going to start a thread here for bugs in the text as they're found so we can keep them all in one place.</p> https://www.lexaloffle.com/bbs/?tid=34633 https://www.lexaloffle.com/bbs/?tid=34633 Fri, 05 Jul 2019 12:13:20 UTC Lua Scripting... <p>Hey guys, don't know how many people follow Zep on Twitter, but, thought I'd share some news:</p> <p><a href="https://twitter.com/lexaloffle/status/997051700891418624">&quot;100% Lua scripted&quot;</a> - from 2:50 am - 17 May 2018</p> https://www.lexaloffle.com/bbs/?tid=31348 https://www.lexaloffle.com/bbs/?tid=31348 Wed, 30 May 2018 12:08:16 UTC EDM Blastoff <p> <table><tr><td> <a href="/bbs/?pid=44740#p"> <img src="/bbs/thumbs/pico44739.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=44740#p"> EDM Blastoff</a><br><br> by <a href="/bbs/?uid=17402"> Stompy</a> <br><br><br> <a href="/bbs/?pid=44740#p"> [Click to Play]</a> </td></tr></table> </p> <p>Rhythm Game made in about 50 hours for <a href="https://itch.io/jam/musicgamejam">Music Game Jam</a>. Team of <a href="https://www.lexaloffle.com/bbs/?uid=25710">codyloyd</a> and myself. First jam for both of us.</p> <p>Hit the buttons to the beat while avoiding the asteroids.</p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/17402/PICO-8_5.gif" width=256 height=256 alt="" /> https://www.lexaloffle.com/bbs/?tid=30008 https://www.lexaloffle.com/bbs/?tid=30008 Thu, 28 Sep 2017 22:32:43 UTC Zombie Zombie Shooter <p>Hey guys! This is my first game I felt was good enough to post here. It's not perfect but it's pretty fun. It's a demake of a LOVE game I made.</p> <p>It's MIT licensed so if you like something in it, feel free to riff or rip. </p> <p>Let me know what you think or where I can improve.</p> <p> <table><tr><td> <a href="/bbs/?pid=44051#p"> <img src="/bbs/thumbs/pico44050.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=44051#p"> Zombie Zombie Shooter 1.0</a><br><br> by <a href="/bbs/?uid=17402"> Stompy</a> <br><br><br> <a href="/bbs/?pid=44051#p"> [Click to Play]</a> </td></tr></table> </p> <hr /> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/17402/PICO-8_2.gif" width=256 height=256 alt="" /> <p>Good luck!</p> https://www.lexaloffle.com/bbs/?tid=29913 https://www.lexaloffle.com/bbs/?tid=29913 Sun, 10 Sep 2017 13:13:49 UTC Looking for a guide to Splore <p>I've been seeing a lot of version spam in Splore while browsing, and I'd like to avoid doing that myself if I can avoid it. But I'm not entirely sure how Splore works. Is there some sort of wiki info about it? Or a guide some where? Are there best practices for stuff like versioning/cart data/naming?</p> https://www.lexaloffle.com/bbs/?tid=28279 https://www.lexaloffle.com/bbs/?tid=28279 Wed, 21 Dec 2016 23:48:00 UTC