Splixel [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=1299 Picocross <p> <table><tr><td> <a href="/bbs/?pid=33650#p"> <img src="/bbs/thumbs/pico33649.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=33650#p"> Picocross 1.0</a><br><br> by <a href="/bbs/?uid=1299"> Splixel</a> <br><br><br> <a href="/bbs/?pid=33650#p"> [Click to Play]</a> </td></tr></table> <br /> This is a pretty straightforward picross clone, hope you guys enjoy it!</p> https://www.lexaloffle.com/bbs/?tid=28242 https://www.lexaloffle.com/bbs/?tid=28242 Sun, 18 Dec 2016 17:18:30 UTC WaGa <p> <table><tr><td> <a href="/bbs/?pid=33648#p"> <img src="/bbs/thumbs/pico33647.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=33648#p"> WaGa 1.0</a><br><br> by <a href="/bbs/?uid=1299"> Splixel</a> <br><br><br> <a href="/bbs/?pid=33648#p"> [Click to Play]</a> </td></tr></table> </p> <p>for the manual, check the itch.io page here <a href="https://splixel.itch.io/waga">splixel.itch.io/waga</a></p> https://www.lexaloffle.com/bbs/?tid=28241 https://www.lexaloffle.com/bbs/?tid=28241 Sun, 18 Dec 2016 17:16:05 UTC Overcoming tokens <p>It was suggested I post this here, so I'm just going to copy/paste. This is a write-up on how I jumped some hurdles to make my rpg <a href="https://splixel.itch.io/waga">WaGa</a> (having issues uploading the cart to here on my phone, I'll put it on soon)</p> <p>PICO-8 and limitations</p> <h2>So, indie games are usually made to emulate older games, and follow similar restrictions. That's cool, but older games, at the time, were all trying to break past those restrictions, this gets a bit lost. PICO-8 is a platform given to us that attempts to force us to follow some restrictions, so now we get to make games exactly like older games: pushing those limits.</h2> <p>So recently I made an RPG for PICO-8, WaGa. I hit the token wall pretty quick. I had a lot of data, 50 some items, 8 enemies, enemy groups, stair exits, 4 characters with stats, and a bag that could hold items, and so on. PICO-8 follows a subset of lua, so I had to get fairly creative.</p> <p>The biggest thing I found I could exploit, by far, is strings. One string is just a variable, and follows the same one token count as any other variable, this really opens things up. The only string function PICO-8 gives you is sub(), which is, as I found, all I needed to get done what I had to get done.</p> <p>I did need a few other functions though. I needed explode, and I needed a string-&gt;number function. I think to myself, if I have these, I can have my entire set of items only take up one token! Had I really wanted to, I could have all of this a step farther, and had one huge database string itself, which i explode into datasets, which i explode into arrays.</p> <p>Heres an example, my item dataset<br /> --item[n] = &quot;id|itemtype|strength|uses|weapon|special&quot;<br /> ids = &quot;1|0|0|0|0|0|_2|2|10|50|1|0|_3|2|15|40|1|0|_4|2|25|25|1|0|_5|3|10|50|1|0|_6|3|15|40|1|0|_7|3|25|25|1|0|_8|4|10|50|1|0|_9|4|15|40|1|0|_10|4|25|25|1|0|_11|5|10|50|1|0|_12|5|15|40|1|0|_13|5|25|25|1|0|_14|6|6|50|1|0|_15|6|15|40|1|0|_16|6|25|25|1|0|_17|7|10|50|1|0|_18|7|15|40|1|0|_19|7|25|25|1|0|_20|10|25|0|0|0|_21|10|50|0|0|0|_22|10|99|0|0|0|_23|11|25|0|0|0|_24|11|50|0|0|0|_25|11|99|0|0|0|_26|12|25|0|0|0|_27|12|50|0|0|0|_28|12|99|0|0|0|_29|13|25|0|0|0|_30|13|50|0|0|0|_31|13|99|0|0|0|_32|1|50|5|1|0|_33|1|250|4|1|0|_34|1|999|3|1|0|_35|8|0|1|0|1|_36|8|0|1|0|2|_37|8|0|1|0|3|_38|8|0|1|0|4|_39|8|0|1|0|5|_40|9|0|0|0|0|_41|9|2|20|1|0|_42|9|5|20|1|0|_43|9|10|20|1|0|_44|9|25|5|1|0|_45|9|100|1|1|0|_46|9|10|5|1|1|_47|9|0|5|1|2|_48|9|0|5|1|3|_49|9|0|1|0|4|<em>50|8|0|0|0|6|</em>&quot;</p> <p>I first explode the dataset by _, into an array, go through there and explode each one of those arrays into my item variable. I also did this for monsters, npcs, coordinates, text blocks, pretty much everything. I'd estimate it saved me somewhere from 500-1000 tokens altogether, but I'm really not sure since I went adding more and more after implementing this.</p> <p>I didn't have internet at the time when I was working on this, so it was pretty fun trying to figure out how to make some of these functions. Lets get to them then</p> <p>function substring_to_number(st)<br /> digits = {&quot;0&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;}<br /> for i=0,9 do<br /> if st == digits[i+1] then<br /> return i<br /> end<br /> end<br /> return 0<br /> end</p> <p>this is a simple one, if theres only 1 digit, its really easy to go from string to number!</p> <p>function string_to_number(s)<br /> if #s &gt; 1 then<br /> rval = substring_to_number(sub(s, #s, #s))<br /> for i=1, (#s - 1) do<br /> rval += substring_to_number(sub(s, i, i)) * 10 ^ (#s-(i))<br /> end<br /> return rval<br /> else<br /> return substring_to_number(sub(s, 1, 1))<br /> end<br /> end</p> <p>This is how I tackled multiple digits. I'm not sure if its the best way, but my game works perfectly fine, so it seems to work!</p> <p>At this point, I can convert strings into numbers, all I need to be able to do is explode strings, which turned out to be much easier to write.</p> <p>function explode_internal(s, delimiter)<br /> retval = {}<br /> lastpos = 1<br /> for i=1,#s do<br /> if sub(s,i,i) == delimiter then<br /> add(retval, sub(s, lastpos, i-1))<br /> i += 1<br /> lastpos = i<br /> end<br /> end<br /> return retval<br /> end</p> <p>and thats pretty much all you need, you can store near limitless amounts of data in a single variable with these few functions. I wrote some more to manage loading datasets.</p> <p>function load_dataset(dataset)<br /> local retval = {}<br /> local a = explode<em>internal(dataset, &quot;</em>&quot;)<br /> for i=1,#a do<br /> local b = explode_internal(a[i], &quot;|&quot;)<br /> retval[i] = {}<br /> for k,v in pairs(b) do<br /> retval[i][k] = v<br /> end<br /> end<br /> return retval<br /> end</p> <p>so all I need to do now to load that mindless jumble of numbers and symbols is<br /> item = load_dataset(ids)<br /> and so-on for other datasets. This is all really great stuff, and without writing it, WaGa would've been a game without NPCs to talk to, and I would've had to possibly remove features just to be able to put in the calls to music(), or not have music at all! It wouldn't have abilities that did things other than damage, a title screen, and I was even considering having a fixed party.</p> <h2>You can also use this to store map data, and write a function to write that map data via mset(), you can store artwork, and draw to the screen with pset(), draw to the spritesheet with sset() and fset(), song and sfx data is stored at 0x3100 and 0x3200, so I'd assume you could poke() some new music in there as well! The issue you're going to run into is the character limit, and the compressed code limit, and at that point, all you can do is crunch. I'd imagine if you had enough data, it would be worth it to even write compression/decompression routines. If you're crazy, you could store things in multiple carts, and there'd be no reason you couldn't have full video.</h2> <p>Hopefully this information helps someone, since I don't have internet at home, I don't know if similar things have been published or suggested, so if this is already out there, have fun with this:</p> <p>poke(0x5f2c, 5)</p> https://www.lexaloffle.com/bbs/?tid=28160 https://www.lexaloffle.com/bbs/?tid=28160 Tue, 06 Dec 2016 13:15:40 UTC Picocross RC1 <p>This is mostly done, I'd like some testing and feedback before I'd consider it complete. All thats really left is another song I need to make, barring any major bugs.</p> <p><a href="https://splixel.itch.io/picocross-rc1?secret=Jp2KRiuGT6wxAMWWTjLVDLPDpHM"><a href="https://splixel.itch.io/picocross-rc1?secret=Jp2KRiuGT6wxAMWWTjLVDLPDpHM">https://splixel.itch.io/picocross-rc1?secret=Jp2KRiuGT6wxAMWWTjLVDLPDpHM</a></a></p> <p>It's a picross puzzle game, so the rules are exactly same as picross.</p> https://www.lexaloffle.com/bbs/?tid=28122 https://www.lexaloffle.com/bbs/?tid=28122 Mon, 28 Nov 2016 12:31:42 UTC