RealShadowCaster [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=82211 Map dimensions and sprite tradeoff <p>A little tool to search for unusual map dimensions and sprite tradeoff<br /> <table><tr><td> <a href="/bbs/?pid=148162#p"> <img src="/bbs/thumbs/pico8_map_tradeoff-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=148162#p"> map_tradeoff</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=148162#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=142180 https://www.lexaloffle.com/bbs/?tid=142180 Thu, 09 May 2024 01:38:22 UTC Has anyone written a print command with flip and rotation (90&deg;) options ? <p>Title says it all.<br /> I'm making a horizontal scrolling game with a map 32 screen wide and 1 screen tall, and with the player using extra colors different from the enemy colors. (enemies can't be over or under the player).<br /> For this, I'm using screen rotation, but now I can't use print to display text any more as it appears rotated.<br /> Has anyone already implemented a 90&deg; rotated print function ?</p> https://www.lexaloffle.com/bbs/?tid=142137 https://www.lexaloffle.com/bbs/?tid=142137 Mon, 06 May 2024 17:16:09 UTC Mamono pico bugfix <p> <table><tr><td> <a href="/bbs/?pid=147977#p"> <img src="/bbs/thumbs/pico8_mamono_pico_fix-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=147977#p"> mamono_pico_fix 0.1</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=147977#p"> [Click to Play]</a> </td></tr></table> </p> <p>A bug fix version of mamono pico by <a href="https://www.lexaloffle.com/bbs/?uid=10158"> @65c02</a><br /> <a href="https://www.lexaloffle.com/bbs/?pid=128341">https://www.lexaloffle.com/bbs/?pid=128341</a></p> <p>Fixed :</p> <ul> <li>crashing at end of levels</li> <li>impossible to win levels</li> <li>not dying when killed by a monster that would have made you level up</li> </ul> <p>Remaining known bugs :</p> <ul> <li>you can mark a monster even after killing it, and this can disable showing the red number of the monster</li> <li>some rare crashes from menu after game over, unknown cause.</li> </ul> <p>Done :</p> <ul> <li>damage is now the same as the original game</li> </ul> <p>Todo :</p> <ul> <li>blank pause menu</li> <li>Remaining ennemy count in status bar</li> <li>timer</li> <li>high scores</li> <li>Max difficulty</li> <li>custom levels</li> <li>wraparoud</li> <li>mage (fireball chording)</li> <li>scout (blind mode)</li> <li>skunk oil</li> <li>achievements</li> </ul> https://www.lexaloffle.com/bbs/?tid=142126 https://www.lexaloffle.com/bbs/?tid=142126 Mon, 06 May 2024 09:24:40 UTC Map sandbox <p> <table><tr><td> <a href="/bbs/?pid=146772#p"> <img src="/bbs/thumbs/pico8_wukerebajo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=146772#p"> wukerebajo</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=146772#p"> [Click to Play]</a> </td></tr></table> <br /> Just a sandbox to get a better understanding of what happens when you change the map width (0x5f57) and the map address (0x5F56)<br /> Upper memory 0x8000-0xFFFF is fully initialized to 53 (blue square sprite)<br /> Arrow keys to move the camera<br /> X / O to change the map width<br /> pause menu to change what X/O changes between map width and map address.</p> https://www.lexaloffle.com/bbs/?tid=141767 https://www.lexaloffle.com/bbs/?tid=141767 Tue, 16 Apr 2024 16:01:46 UTC Can't see cart's code from the BBS any more <p>Title says it all.<br /> Problem is the same on firefox and safari on Mac, and on safari on iPhone.<br /> Embed arrow still works, so you can still get the cart's id from it and view the game's code in pico-8's editor.</p> https://www.lexaloffle.com/bbs/?tid=141426 https://www.lexaloffle.com/bbs/?tid=141426 Wed, 03 Apr 2024 21:32:02 UTC Rounding errors and tables <img style="margin-bottom:16px" border=0 src="/media/82211/madness.png" alt="" /> <p>I've spent two hours fixing a nasty bug. The image above is essentially the bug I was trying to fix, except all the steps were spread in three functions, and took a good minute of playing on average before everything aligned just right (or just wrong depending on how you look at it) for it to seemingly randomly occur.<br /> Can you figure out why t[2] is not 8 in the end ?</p> <p>Hint : Lua arrays and # operator are cursed.</p> <p>Ideally, I'd like the game to crash at t[i]=8 if possible. Anyone knows if you can add some sanity checks to all array accesses ?</p> https://www.lexaloffle.com/bbs/?tid=140988 https://www.lexaloffle.com/bbs/?tid=140988 Fri, 22 Mar 2024 11:09:37 UTC Thumbnail as data ? <p>A lot of old games save space by using the same data for multiple purposes. I&rsquo;ve seen code used as graphics, code inside graphics, graphics containing map data, and was daydreaming what parts of pico8 could be interesting to use as double purpose.<br /> The game thumbnail seems very promising : 128x128 32 Colors is 10Kb worth which is pretty big for pico8.<br /> There &acute;s nohing in the api related to it, just a keyboard shortcut to save the current screen to it. It&rsquo;s hidden when using the built in editor, but you can see it when viewing a .p8 file.</p> <p>I&rsquo;m a newbie in lua, and don&rsquo;t know if it&rsquo;s a valid lua section, or maybe a type of multi line named comment designed for documentation for example.<br /> Or maybe it&rsquo;s just part of the .p8 format and never passed to the interpreter ?<br /> If there&rsquo;s a way in code to interact with it, I&rsquo;d love to know.<br /> Or maybe the source code is somehow in the scope of the program and can be opened and parsed ?</p> https://www.lexaloffle.com/bbs/?tid=139782 https://www.lexaloffle.com/bbs/?tid=139782 Wed, 10 Jan 2024 15:06:29 UTC Rightmost bit is left, right ? <p>At the moment, we have 6 native functions to peek and poke the memory :<br /> v=peek(addr, [n] ) you also have v=@addr that is equivalent to peek(addr,1) and peek(addr)<br /> v=peek2(addr, [n] ) and v=%addr<br /> v=peek4(addr, [n] ) and v=$addr<br /> poke ( addr, [value,] [...] )<br /> poke2( addr, [value,] [...] )<br /> poke4( addr, [value,] [...] )</p> <p>What could be a good extension of this ? The problem is not really the coding part, but rather coming up with conventions that fit well withing the pico8 universe...</p> <p>poke3 seems like a simple addition, but what three bytes should be copied from the value ? </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>Pico8 is a little endian universe XXXX read from value ..... ignored [ pico8 numeric value ] [fraction ] [integer ] Byte0 Byte1 Byte2 Byte3 poke ..... ..... XXXXX ..... poke2 ..... ..... XXXXX XXXXX poke3 ????? XXXXX XXXXX ????? poke4 XXXXX XXXXX XXXXX XXXXX</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Since our standard pico8 numbers are 16.16 bits, we can't go further, poke5 wouldn't make sense.<br /> What we could do is going in the other direction with powers of 2, poke_nibble(), poke_half_nibble() and poke_bit()<br /> That's a whole new can of worm : what is the first bit of a byte ?<br /> To me (It's a convention, feel free to disagree and argue) it makes sense that bits are ordered from least significant to most significant in a byte, in similar little endian spirit than the rest.<br /> Each bit in memory would have an address : bit 0 would have the same address as the byte containing it, bit 1 would have 1/8 more that the previous bit, bit 7 would have 7/8 more.<br /> This fits nicely with how the screen is memory mapped :<br /> pixel_address=0x6000+(128*y+x)/2<br /> second pixel of the 1st screen row would have address 0x6000.8</p> <p>Here's what I propose :</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>peekn(byte_size,fractional_address, [n]) poken(byte_size,fractional_address,[value,] [...] ) Example uses : bs=1/8 -- bit size in bytes, or 0.125 in decimal 0x0.2 in hexa poken(4*bs,0x6000+(128*y+x)/2,color) -- same effect as pset(x,y,color) minus pal shenanigans poken(bs,0x5e00+idx*bs,1) -- treats cartdata spaces as 2048 flags and sets flag idx to 1 peekn(1,addr) -- equivalent to peek(addr) if addr is an integer peekn(2,addr) -- equivalent to peek2(addr) if addr is an integer peekn(4,addr) -- equivalent to peek4(addr) if addr is an integer</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Only the integer part and the three most significant bits for the fractional part of an address would be taken into account.<br /> For the value, for byte_size between 1/8 and 2, only the least significant bits of the integer part would be taken into account, to stay in line with peek and peek2.<br /> From 17*bs to 4, the most significant bits would count.<br /> That would make poken(3,addr,value) write byte1, byte2 and byte3 from value to addr, addr+1 and addr+2.</p> <p>Or we could drop compatibility with poke and have a more coherent scheme. I don't like the drawbacks of either solution... What would you wish for ?</p> https://www.lexaloffle.com/bbs/?tid=55321 https://www.lexaloffle.com/bbs/?tid=55321 Thu, 14 Dec 2023 13:57:53 UTC