RealShadowCaster [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=82211 Populous, using pico-8 to figure it out <p>One of the games I used to play the most was populous.<br /> While some of my friends could play it with beautiful graphics on their amiga or atari ST :</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/82211/populusamiga.png" alt="" /> <p>I was playing on a slow TO-16 PC compatible with CGA graphics and a monochrome green screen. You can't even find an online picture of a setting that bad for this game, the closest I could find online was color CGA that is actually almost as bad looking as the green version.</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/82211/popcga.png" alt="" /> <p>Despite the visuals, I was hooked and somehow managed to finish the game (level 400 something), using every possible trick available. (save scumming so the &quot;random&quot; swamps would always spawn under the enemy's knights feet, abusing the bad AI when possible (enemy flood that insta-kill every single enemy unit was the most memorable), using a bug that allowed to raise the terrain to level 1 on levels where it was disabled...).<br /> Despite all that, after level 400, the building speed of the computer was just insane : he would add a block every frame (around 4 times per second on my crappy PC), making enemy progressing absolutely overwhelming.<br /> Given the difficulty of fast and precise clicking (even after removing the dust on the rollers of the mouse), I stood no chance playing the same strategy, so I tried things and found a magic combo : 5 times raising terrain, 5 times lowering, 3 times raising and one time lowering.<br /> With practice, in 14 frames, I could flatted a 6 by 6 square of land lo level 2, where the computer would use 49 frames to flatten the same surface to level 1, one square corner at a time(for way less mana though).<br /> I could never understand at the time why the game would have such an obscure build shortcut.<br /> There also was something both magical and slightly disturbing about the game :<br /> The graphics felt somehow slightly wrong, even on the beautiful amiga/atari versions, yet impossibly easy to read.<br /> In the 2nd screenshot, the castle is a very classic looking isometric view, reminiscent of all the classic of the genre, like marble madness or head over heels for example. But contrary to those games, the slopes are much less &quot;pixel clean&quot;, but you have no problem reading the height of the elements, and somehow you can always see everything, regardless of the terrain.<br /> Because I couldn't figure out why that was the case, I tried to re-make the terrain logic in pico-8.<br /> <table><tr><td> <a href="/bbs/?pid=157085#p"> <img src="/bbs/thumbs/pico8_yoyewawamo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=157085#p"> yoyewawamo</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=157085#p"> [Click to Play]</a> </td></tr></table> <br /> 1st few tries had the classic isometric look, but the back sides of pyramids was hidden, so I reduced the pixel height between levels and it became more readable, but some big mountain peeks or holes would occupy the same place onscreen as other elements, resulting in a big mess. Still, I was able to display actual terrain copied from screenshots, and that's how I figured out the trick : the game does not allow two touching intersection points (orthogonal or diagonal) to have a difference of height of more than one. If you try, the modification is processed, but then the game also moves the adjacent points that are too far towards the moved point. This can have a cascading effect, and that's where the magic 5 up 5 down 3 up 1 down comes from. It's absolutely not a hidden cheat, but just a consequence of the constrains chosen for the graphics to stay legible at all times and not require any hidden element logic.</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/82211/5U5D3U1D.gif" alt="" /> <p>Finally, to view that all terrain stays within its pixel rhombus regardless of terrain, here are the two extremes :</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/82211/extremes.gif" alt="" /> https://www.lexaloffle.com/bbs/?tid=145221 https://www.lexaloffle.com/bbs/?tid=145221 Fri, 08 Nov 2024 23:27:02 UTC Xblast demake <p>Hello everyone, I'm thinking about de-making Xblast, a linux clone of bomberman that allows up to 6 players at the same time.<br /> Here's a early WIP screenshot :</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/82211/xblast.png" alt="" /> <p>What I'm worried about now is the 6 players local game play.<br /> On paper, Pico-8 has native support of up to 8 controllers.<br /> I wrote a simple cart that just highlights in red the active buttons of the 8 controllers.<br /> Could anyone confirm that this actually works for up to six controllers before I go further into the dev ?<br /> I'm a bit worried as I've never encountered a pico8 game that plays with more than two controllers at the same time so far.<br /> If you get it it to highlight buttons of players 3 to 7, could you please tell me how you set it up ?</p> <p> <table><tr><td> <a href="/bbs/?pid=155591#p"> <img src="/bbs/thumbs/pico8_zuhapiheku-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=155591#p"> zuhapiheku</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=155591#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=144702 https://www.lexaloffle.com/bbs/?tid=144702 Fri, 11 Oct 2024 09:40:33 UTC Question about metatables and assignation <p>One of the simple examples in the LUA documentation for metamethods is to implement set logic on tables.<br /> s1+s2 returns a new set that is the union of the two by defining __add, s1*s2 returns the intersection thanks to __mul, so far so good.<br /> There is also the very useful __index and __newindex to handle reads and writes to unassigned indexes of the table, but the very important assignation metamethod at table level seem to silently not exist, as if it were of no use.</p> <p>when I do<br /> set1=set2<br /> followed by<br /> set2=set2+{new_elem}</p> <p>I most certainly didn't mean for set1 to be changed.</p> <p>There's of course plenty ow ways to force the behavior I wanted :<br /> set1=set2+{}<br /> would work.<br /> We could define a set_copy function<br /> set1=set_copy(s2)</p> <p>But there seem to be no way to override the assignation behavior, like we would redefine the = operator of a class in C++ for example.</p> <p>Could someone please shed some light on the subject ? What is the reason behind this omission ?<br /> Is there a way to override table assignation that I missed, or maybe a conventional good us of copying objects by value, for objects where it makes more sense ?</p> https://www.lexaloffle.com/bbs/?tid=144354 https://www.lexaloffle.com/bbs/?tid=144354 Sun, 22 Sep 2024 22:26:28 UTC clipboard_setter <p> <table><tr><td> <a href="/bbs/?pid=154064#p"> <img src="/bbs/thumbs/pico8_clipboard_setter-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=154064#p"> clipboard_setter</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=154064#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=144179 https://www.lexaloffle.com/bbs/?tid=144179 Wed, 11 Sep 2024 21:11:16 UTC clip_test <p>WIP experiments with clipboard writing across online carts calling each other.</p> <p>Cart1 building a clipboard and calling cart2</p> <p>Cart2 clipboard info display<br /> <table><tr><td> <a href="/bbs/?pid=154062#p"> <img src="/bbs/thumbs/pico8_clip_test-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=154062#p"> clip_test</a><br><br> by <a href="/bbs/?uid=82211"> RealShadowCaster</a> <br><br><br> <a href="/bbs/?pid=154062#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=144178 https://www.lexaloffle.com/bbs/?tid=144178 Wed, 11 Sep 2024 20:23:13 UTC Problems pining some BBS users <p>First, a big thank you for fixing the code viewing functionality of BBS pico-8 carts.</p> <p>Now for the ping related problems :</p> <p>when a user has a space or a minus sign in his user name, the ping is either lost, or worse sent to another user :<br /> For example, user Peter Mosevich won't get pinged because of the space, but unrelated user Peter will.</p> <p>Support for something like <a href="https://www.lexaloffle.com/bbs/?uid=87001"> @Peter Mosevich</a> with documentation in the Formatting Help would be welcome.</p> https://www.lexaloffle.com/bbs/?tid=144112 https://www.lexaloffle.com/bbs/?tid=144112 Mon, 09 Sep 2024 11:27:11 UTC 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 loading="lazy" 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