ced

ced

0-day streak
@lmcelroy and I are working on writing a fuzzer for sprig, so now you can play them from the command line 😂
got omay's 2D life game to run using AN ENTIRE ORDER OF MAGNITUDE less memory. the trick was representing the map as an array of chars (no Sprite objects!!!) and then simply using setMap to write to the screen. along the way I created a version of 2D life that performs better on the microcontroller JS impl than it did in the web browser. (leo allocates an entire grid for every getTile call, and then fills it up in an O(2n) way, so it's very slow, whereas my lookups are constant time (spatial hashmap)) the javascript driving my version is running on a non-JIT runtime optimized for memory, not speed. his is running on V8 in my web browser ... my version can easily go at 20 fps in spade, his is sub-10 in my web browser ....
trying to make @Omay's 2D life game run on the device. The problem is, it's using x2 as much memory as the pico even has. Yeah. right now, it uses getAll to find all of the tiles on the map that are "living" or "dead." however, Omay's map is 1028 tiles large. So there's 2056 tiles between the arrays and their clones. I'm going to rewrite it so that instead of using getAll, it loops over the map using for loops. I think this will use less memory because there won't be any arrays in JavaScript holding all of the tiles.
https://cloud-ab5wteau1-hack-club-bot.vercel.app/0image.png
rpi pico being a turd
https://cloud-7ynv3up1x-hack-club-bot.vercel.app/0image.png
uh
https://cloud-1zcusrvo5-hack-club-bot.vercel.app/0image.png
i am currently NOT changing the audio text representation sprig uses
https://cloud-a2v0cnc6q-hack-club-bot.vercel.app/0image_from_ios.jpg
this is progress. imagine how bad it was before :threat:
i love a good audio_buffer->format->format.format EDIT: now format doesn't even look like a word. god help me
https://cloud-8y3cecd0b-hack-club-bot.vercel.app/0image.png
something is going on with our RGB565 16bit color heh, tryna sort it out :) but alas, RGB565 only has 0.39% (65k vs 16m) of the colours of RGB888 ... 🤔 probably should've asked for this to be considered while leo et. al. were creating the existing color palette :flushded: chrishewett.com/blog/true-rgb565-colour-picker
https://cloud-l8g4ka1i0-hack-club-bot.vercel.app/0img_1883.jpg
memory leak in my sprig firmware let's fucking goooo :weary-smile:
https://cloud-evdxgdnwt-hack-club-bot.vercel.app/0image.png
leo and i have been having an ongoing "vim macros vs. multiple cursor" tug of war, and im sorry, but when have you ever seen multiple cursors do this (context: all sprig assets (maps, sprites, songs) are stored as text, (the web editor just shows you a nice graphical editor for the text based formats) what's seen here is the text format for the songs problem: when the songs play in your web browser, they're parsed using regex on the device, we use jerryscript to run your javascript per my logging yesterday, something in jerryscript's regex implementation makes the device hang solution: to confirm that this is the case, I am rewriting the parser in C for my minimal repro of the parser, I want example song strings to test against just pasted into my C code they need to be multiline C strings, then. multiline C strings: multiline C strings are just single-line string literals with newlines between them (the preprocessor automatically concatenates strings with nothing but whitespace between them) e.g.
puts("this little spriggy"
     " goes to the"
     " market!");
// > "this little spriggy goes to the market"
this macro adds a " to the beginning of each line of a "block" of text (which in this case are discrete songs))
lol so the past few days have been a foggy haze of trying to get @Omay's hit sprig single, Sokoban+, running on the device and like it was kind of basically working the entire time (good) except kind of it would crash at the start (bad) but i can make it not do that by not doing a different other thing (the bootup screen) but WHYH!?!? why bootup screen make game crash later? and how to have both? HOW TO HAVE BOTH? HOWWWWWW
wip sprig bootup screen see #sprig for deets (wanna draw us a nicer sprite that everyone will see when they turn on the console?)
https://cloud-79ldowrxe-hack-club-bot.vercel.app/0image.png
finally made the perfect bagel
https://cloud-nu8cizs17-hack-club-bot.vercel.app/0img_1723.jpghttps://cloud-lvlh2582q-hack-club-bot.vercel.app/0img_1724.jpghttps://cloud-ed8qjonot-hack-club-bot.vercel.app/068415953707__ca9f0e62-1b62-4532-8204-16179071dca2.jpg
im thinkin @lmcelroy should pursue a career in hand modeling, what do yall think? thanks @msw for laser cutting the case design! what am i looking at? this is the latest prototype of the sprig, a handheld console for running games made with #sprig (sprig is a lil tool for making games out of tiles) also the editor is named sprig. we mightve named too many things sprig
https://cloud-aosw7pnc9-hack-club-bot.vercel.app/0img_1622.jpghttps://cloud-q37w8bvek-hack-club-bot.vercel.app/0img_1624.jpg
long neck orpheus + trying to make sprig consoles that dont explode when you put batteries in them, featuring @lmcelroy
https://cloud-1mbygtan0-hack-club-bot.vercel.app/0image_from_ios.jpghttps://cloud-6valpwqgf-hack-club-bot.vercel.app/0image_from_ios.jpg
triaging sprig issues (pray for me)
https://cloud-5nueiv05n-hack-club-bot.vercel.app/0image.png
paste.rs/mdc.js there's something really satisfying about this Sprig demo (ye dass what we're callin it now. Sprig Engine or something idk)
https://cloud-2g2xfv7yt-hack-club-bot.vercel.app/0image.pnghttps://cloud-mz86vrw28-hack-club-bot.vercel.app/0image.png
see how the pixels on the left are uh ... yeah, like not even uniform? does that scare you? send a chill down your spine? keep you awake at night? no? well, uh, it certainly made me feel that way. I woke up at 4:43 AM yesterday morning and drew myself up out of bed. I could sense that something in the world simply ... wasn't right. It turned out to be a message from the universe: Tom Preston-Werner was testing our game engine. and the renderer was broken. :tw_grimacing: I didn't even know, but in this case, ignorance was hardly bliss. rather, it was a vague sense of discomfort. a nagging at the edge of my consciousness that drew me into HQ ... after blasting Wild Nothings into the empty early morning office for ... however long it took, I came up with this PR and ... voila! github.com/hackclub/puzzlelab/pull/2 order has been returned to the universe, and our pixels are clean and tidy ... until you find a new way to break them :tw_sweat_smile:
https://cloud-pzz821fmg-hack-club-bot.vercel.app/0image.pnghttps://cloud-nv3sagone-hack-club-bot.vercel.app/0image.png
Everything is Going Fine™️
yall idk wtf im doin but im diggin it this all fits in <16kb, written in Zig, software rasterized ofc
learned enough to make me have to restart my software rasterizer
sound fx!!!
https://cloud-g345qtlcl-hack-club-bot.vercel.app/0image.png
shaking my head while looking at a software rasterized quad in zig not following a tutorial or anything, just seeing how much I can do with the vector math I already know I think calling @sin or @cos means your executable gets linked to the CRT which adds 60kb to my executable; if I can find a pure zig implementation of cos/sin, I can knock the executable size back down to ~4kb I also think the quad grows in size a little bit when it's rotated because my tangent and normal aren't actually perpendicular 😳 ideally instead of setting the entire tangent vector, I could just set the "angle" and have my quad be an axis + angle combo, but I'm not sure what the vector math looks like for that. I know if I have two perpendicular vectors I can get a third orthonormal basis using the cross product, but I'm not sure how to go from one perpendicular vector to 2 short of quaternions or rotation matrices (surely there's an easier way?)
finished writing some code to procedurally bevel an icosahedron (or really probably anything really) for ishan it was a fun way to flex my vector math skillz especially proud of how I filled in the little pentagons on the vertices, specifically how I figured out the order to have the GPU draw them so they would look correct you can read my code here. I started with the threejs.org/docs/#api/en/geometries/PolyhedronGeometry class, and then basically slowly deleted and replaced all of the code in there because they were doing subdivisions whereas I was doing bevels which are uh ... yeah p different paste.rs/OT8.html currently I generate some extra unnecessary geometry for the edges. there are plenty of clever ways not to, but meh
https://cloud-fa86vl2ix-hack-club-bot.vercel.app/0image.pnghttps://cloud-gjgrn84on-hack-club-bot.vercel.app/0image.png
procedurally rounding an icosahedron with some Hack Clubbers from #cdn on it for Ishan in #code
i am THOROUGHLY over caffeinated this morning. i may have spent entirely too long indoors away from sunlight working on this watch the OBS recording first, then then you will understand why I am so excited in the phone video lol
start of a "game select" screen
https://cloud-7jm3nuax8-hack-club-bot.vercel.app/0image_from_ios.jpg
some covid goin' round HQ, so work on the Game Lab handheld console continues from home :salute: wired up those buttons yesterday :) I'm still not clearing the screen though :tw_sweat_smile: so it's also a drawing program for making abstract art! :mask-parrot:stay well hack clubbers, and join #nemea to help us get this console in the hands of any hack clubber who builds something cool with gamelab :)
@HenryBass-U02KEJ8T6D8 hung out with us at hq yesterday and helped us test a new way of making games in gamelab wouldn't it be epic to run this game on a hand-sized device you could only get by making a cool game of your own? that's being developed in #nemea if you'd like to follow along :)
https://cloud-l5vpyp9ma-hack-club-bot.vercel.app/0image.png
normal people when they fix a bug: wow, I can't believe I just lost 6 hours of my life because a parameter was on the wrong side of a , me when I fix a bug: wow, I can't believe I got 6 hours of free entertainment because I had a parameter on the wrong side of a ,
https://cloud-12lfp6xho-hack-club-bot.vercel.app/0image.png
I had an "oh. it's the endianness." moment. excellent. a lot of that felt like beating my head against a wall, but it uses sprdraw and it works, and it's fast. we already have a C implementation of a function exposed to javascript that could be used to clear the screen between draws. Now all that's left to do is start trying to port some games to it.
ST7735 LCDs come with little colorful tabs on the sides of them. there are several different colors: red, green, blue, etc. the versions we got to use with the gamelab beaker are green. the javascript driver for this code only has the initialization sequence for the red version. the code split on the left is the source code for it. on the right, I have the source code for the python initialization code for the green version. right now, my colors are inexplicably scrambled, and the best guess I have is that I used the wrong initialization sequence.
https://cloud-d9of4d45t-hack-club-bot.vercel.app/0image.png
this is a simulation where 500 random pixels are generated, and then each of them is given an ideal proximity to each other pixel based on how similar the colors are. then, each of the pixels are placed in a simulation where they move towards or away from each pixel with an urgency dictated by how far their ideal proximity is from their actual proximity the first time it runs, dark colors are the most common, so they end up in the center. then green, etc. I wonder what it would look like if I used an actual image as the input, instead of randomly generated pixels?
imagine if you tried to run a gamelab game on a 2 core CPU -- a Raspberry Pi Pico -- using a software rasterizer written entirely in Python. the fps might be 5. yeah, the fps is 5. join #nemea to help us as we scramble to speed this up and get it in the hands of hack clubbers everywhere 😉
now im just making something really weird
https://cloud-qv9opatuh-hack-club-bot.vercel.app/0image.png
after going off of the deep end, blaming Set's hashing algorithms for the crazy art that I accidentally generated and then finally realizing it was my fault all along, I went ahead and made a visualization of why my "generate a big megahexagon out of 'lil hexes" algorithm was 1. grossly inefficent 2. produced the art that it did basically, it 1. visits hexes that it's already considered all of the neighbors of 2. does so in a consistent counter-clockwise pattern (starting at 90 degrees and going back) (on both the micro and macro level) the code for it was really cute though lol so can you really blame me? and look how much cool art I got out of it! ... talk about going off the deep end ... this also seems like one big metaphor for me being grossly inefficient at doing the things that I set out to do, but making lots of cool art along the way. also, the trajectory vaguely resembles being flushed down a toilet bowl, so there's that.
a continuation of something I originally dumped in #code (see thread) i sort-of-accidentally generated a cool looking pattern, to share with people what was going on I wanted to draw it gradually instead of showing the end product so what I did was I replaced
requestAnimationFrame(function frame(now) {
with
(async () => {
and added one line to the end of my tile rendering loop:
  for (const oh of sightGrid) {
    const { x, y } = hex.axialToOffset(v2.add(oh, ph));

    ctx.fillStyle = ['palegreen', 'green'][+(window.ohgod = !window.ohgod)];
    drawHex(x, y, vec(hex.GRID_SIZE));
    await new Promise(res => setTimeout(res, 100));
  }
and yeah now you can see it draw the cool pattern gradually so. yeah. that's a thing. > +(window.ohgod = !window.ohgod) i could have accomplished this by declaring a variable outside of my for loop but when this idea occurred to me I knew it would be useless and wanted to localize the code for this experiment onto a single line (that, and there is something horribly wrong with my brain and I think i am gradually descending into Terry Davis, please send elph)
imagine you were making a multiplayer web game at regular intervals on the server, you want to tick your simulation. setInterval(() => { your players move forward, ➡️ your enemies decide who to badger next, :threat: some of your projectiles are just barely dodged, :flug: and others smash satisfyingly into their targets :bonk: }, 1000 / 60); at each of these intervals, the server decides which of these occur, and which ... do not. the difference is quite literally life and death for the denizens of your online realm: if a player's input makes it to the server just after this update has occurred, they might just not move out of the way of the oncoming missile in time. after one of these updates when the server has just finished making these vital decisions, it blasts relevant portions of them out to everyone who's connected to your server. (there's no point in updating you about something if it's happening on the other side of the map!) meanwhile, in the player's web browser, these regular updates from the server are gradually applied, so the server's periodic contemplation is rendered as a seamless sequence of fluid movements... unless those updates aren't really so regular at all ... the contract that the server has with the client -- that the server will give the client evenly spaced out updates at regular-enough intervals so that the client can smoothly move between them -- isn't actually the same as the contract that setInterval provides. all setInterval(update, 1000) means is that there will be ABOUT one thousand milliseconds between each of your updates, usually more. so if the actual interval ends up being 1009ms one frame, the next update won't be about 991ms later so that updates happen at regular one second intervals, it will be more like 1007ms later, so that now you're a total of 16 ms away from the contract you had with the client. this is known as drift. at worst, this passes on all of the problems of using setInterval for animation onto your game. but what if you're doing something fancier than just moving between the updates you get from the server as you get them? there's always going to be a random delay between what the server sends and what you get, anyway. it might make more sense to push the updates you get from the server onto a stack, and exactly as often as the server updates, pop the next set of positions off of that stack. ... except that if you're popping using one setInterval on the client, and the server is pushing out those simulation ticks using a setInterval of its own ... and each has a different drift ... they're quickly going to fall out of sync. if the server is drifting a lot, your stack might gradually accumulate thousands of positions that you just can't keep up with ... and if the server is drifting less than you are, you might run out of positions to show the player! suffice it to say, it's super important to have a setInterval that updates without drift. I threw together an implementation of one this morning. I call it a `tick`, since it works well for those simulation ticks I was talking about before. To test it, I went ahead and also made a drift visualizer. Here's a screenshot of it! The grey lines are spaced out at 0.5s intervals, and the first row of blue marks is made by setInterval, while the other row of blue marks are made by my own tick function. as you can see, they stick to the "wall clock time" a lot better than Interval does, even when you leave it running for several minutes! here's a screenshot! I'll post the source in the thread :) fun fact: everything that moves is a CSS animation 😂 I didn't want to pollute the JS event loop, although now that I think about it, it might've been better to so that I can see how well my ticker keeps itself together in the presence of some event loop pressure.
https://cloud-7qivvrkmx-hack-club-bot.vercel.app/0image.png
finally wrote the code to tint the wing sprite appropriately so worth (also spent wayyy too long on the wing flap)
        const tM = 0.5, vM = 0.75;
        if (t < tM) t = lerp(0, vM, invLerp(0, tM, t));
        else        t = lerp(vM, 1, invLerp(tM, 1, t));
remap is such a useful idea
procedurally generated some clouds for a gamelab "front page" code in the thread
gamelab
-
gamelab
-
https://cloud-cm7oc9rw3-hack-club-bot.vercel.app/0image.png
gamelab
-
gamelab
-
miniondough: fun to play with, not to ... i mean, you can eat them if you want ig?
obedient? yes intelligent? wasn't in the job description (was no job description, our minions are spawned, not hired. comes with its own pitfalls)
https://cloud-crn9wqfzf-hack-club.vercel.app/0image.png
got back to rpgc and finally finished the inventory ui, you can drag items around as well as the entire window. now I just need to make that actually change what your player is holding, and make it so that you can pick things up off of the ground ...
https://cloud-ado9i0jq7-hack-club-bot.vercel.app/0image.png
prying some code from out of hack club's site. have you read the code for it!? it's hilarious and this section of code was written by several Hack Clubbers, including matthew, caleb, and lachlan.
https://cloud-8huatra0a-hack-club-bot.vercel.app/0image.png
https://cloud-2wnx24dey-hack-club-bot.vercel.app/0image.png
gamelab
-
gamelab
-
gamelab
-
gamelab
-
https://cloud-q4ahvboha-hack-club-bot.vercel.app/0image.png
rip my scrappy history gamelab
https://cloud-5578ncx95-hack-club-bot.vercel.app/0image.png
again gamelab
https://cloud-4jvr9typt-hack-club-bot.vercel.app/0image.png
why gamelab scrappy why
https://cloud-u8afy8887-hack-club-bot.vercel.app/0image.png
suffering gamelab suffering
https://cloud-gl6epxz3m-hack-club-bot.vercel.app/0image.png
gamelab
https://cloud-ejqnq1tu7-hack-club-bot.vercel.app/0image.png
hi again lounge
https://cloud-61lmiubrq-hack-club-bot.vercel.app/0image.png
scrappabotomy (n) making any minor change to scrappy's codebase; a portmanteau of scrappy + lobotomy
https://cloud-80c5rm0av-hack-club-bot.vercel.app/0image.png
hi lounge
https://cloud-7yd8ehq4g-hack-club-bot.vercel.app/0image.png
slightly unhinged ui its painful how much i can relate
https://cloud-8nv5re29q-hack-club-bot.vercel.app/0image.png
slightly unhinged ui its painful how much i can relate
https://cloud-20otw17bd-hack-club-bot.vercel.app/0image.png
added hp instead of instadeath, damage labels, an alternative control scheme that lets you play with one hand instead of using the mouse (it's what the red cursor that temporarily appears is for), lots of tweaks to the AI, etc. next up, for feature parity ... bow & arrow? then inventory UI and quests? wow, this is speeding along hehe shout out to @ella for making such an awesome font, Wack Club Sans, which I will definitely use in all of my projects henceforth hehe
I think the last time I posted here neither the physics nor the sword were a thing. well. they are now! I also wrote like a six paragraph summary in DMs with someone somewhere about what I'm doing differently this time 'round other than simply writing it in C. it's a neat overview of some of the things I've learned about making games in the past year+ since the Rust version. could probably turn that into a neat blog post at some point. I also got the game working on mac. still looking for someone to try it on Windows to see if DirectX has the rendering bug I think it might have. now all that's left to do for feature parity with the original version is um, I guess, physics for the sword, enemy AI, combat, then the bow and arrow, inventory ui, then quests. I want to add cool things you can interact with in the forest like pots you can break, grass you can cut, other assorted RPG tropes.
the C port is coming along nicely :) :c: 🌳 🌳 🌳 it can render the same forest, but with much better fps than the Rust version because of a handful of graphics programming tricks I've picked up since then. similarly to @AakankshaRangdal-U02F16CHZA4's post, also made mostly with circles! (okay, nonagons, but still hehe) actually, on that note, I've attached a picture of the original version I made in Rust: do you prefer its circles to the nonagons? let me know by reacting with 🟢 or :stop-green: (technically an octogon, but close enough) repo here: :githubparrot: github.com/cedric-h/rpgc if anyone has a second and would like to try to build and test the native executable on windows, shoot me a DM. I suspect I might have some depth sorting issues on DirectX but want to make sure. 🚧 :blender: I've also attached a picture of what the map looks like in Blender, as well as a tiny glimpse of the script I wrote to export it. if you've played the Rust version then maybe you can guess what each line, diamond, square and circle means 😁
https://cloud-k8bkszz7v-hack-club-bot.vercel.app/0image.pnghttps://cloud-fsqfnzqml-hack-club-bot.vercel.app/0image.pnghttps://cloud-onn7kpj09-hack-club-bot.vercel.app/0image.png
as I port a game I wrote a while ago in Rust to C to try and see how much smaller I can get the WASM bundle size, I've found that what has the biggest impact is the "culture" of the languages. for example, the maps in the game I made are laid out in blender, and then exported to JSON with a custom python script I wrote using blender's API. it's easy to add a Rust dependency to parse the JSON for you, but that bites you in the ass later; serde can inflate your compile times AND your WASM bundle size. in C, however, package management looks different; there are single header libraries that are pretty easy to include, but using libraries isn't very C-like, and unlike Rust, C has a stable ABI. that means that if I change my python script to dump a bunch of floats into the file as binary, I can fread those directly into a bunch of C structs. (I do have to handle endianness for integers, though) in Rust, even if I used #[repr(C)] to force a stable ABI for those structs, I'd still have to jump through a bunch more hoops (unsafe) or pull in a dependency like bincode (which would in turn pull in serde ...). anyway, so I quickly wrote a python metaprogram to generate a C header that can fread (or just memcpy) in all of the binary data into the fields in the game map object that the first python script pulls out of blender
https://cloud-265bwmhxm-hack-club-bot.vercel.app/0image.png
~today I uh, today I actually hacked my bank.~ wait, that sounds illegal. okay today someone you may or may not know may have hacked their bank and I am inexplicably aware of the situation. imagine, in this hypothetical scenario, someone wants to use "ced@misguided.enterprises" to receive all of their banking emails. but the bank webapp is trying, for some very stupid reason, to validate emails with a regex, and that regex is "^[A-Za-z0-9_]+[a-zA-Z0-9._%+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9]{2,3}$". notice that last part, which allows for 2 or 3 alphanumeric characters following the last .. you can imagine how that might clash with someone's email. now, you might be thinking, ced, i know it's tempting to just sidestep their clientside verification, but that's technically circumventing access protocols. that sounds really illegal! and you're totally right, which is why whoever did this probably has HORRIBLE impulse control ... the second image demonstrates someone putting a break point on the line that actually sends the request and at that point, n in the watch window should be the variable on the left, so that someone will be able to modify the new email to the unvalidated one ... whoever did this probably discovered a couple useful things about chrome devtools in the process that they weren't already aware of ...
https://cloud-f8zzf9b2k-hack-club-bot.vercel.app/0image.pnghttps://cloud-bdwmsewcs-hack-club-bot.vercel.app/0image.png
git commit -m "Abuse static typechecking to enforce consistently spelled shader inputs"
https://cloud-hs041b4vf-hack-club-bot.vercel.app/0image.png
dynamic libloading is great. if I don't post here again, assume it drove me to light myself on fire and Segmentation Fault (core dumped)
https://cloud-q852obyf7.vercel.app/0image.png
delete all of the code
https://cloud-58ha7jska.vercel.app/0image.png
playing with camera angles in the hackagotchi standalone client, which has a custom renderer written in Rust! 🎉
https://cloud-rmrq8kc9q.vercel.app/0image.png
woot I got billboarding 2d assets working in my custom 3d renderer written in Rust 🎉 I have to say, for a bit there it had me stumped 😂 excuse the grainyness, I really gotta implement mipmapping (and anisotropic filtering)
https://cloud-7lw2t0dax.vercel.app/0image.png
graphics programming, OwO written in Rust :dabbing: custom 3d renderer
https://cloud-ay61s7bvq.vercel.app/0image.png