General Project Updates Topic 2

huh, thats really weird - i havent gotten any crash outside of 3.0.0 so i cant tell whats going on really. in last resort, maybe slowing down the string manipulation is unfortunately needed :(


oh thats incredibly quick hahah, great job:)

(in my drafts so no link)

yeah - iirc around 60-70 clones for the basic layout without counting the music tiles. im guessing that amount would be doubled if i didnt use trails

why that question tho lol? im guessing- you used trails for links, right?

3 Likes

Sorry for the confusion haha, I meant have you made a text renderer, using trails? The text renderer I showcased uses “trail art” letters. The blue backgrounds for the links are actually the only objects except for the buttons.

5 Likes

oh that, no lol i havent done that kind of thing. definitely interesting way to save lags and clones tho - and now i understand why you cant scroll vertically hahah

super excited to play your project!! :D

5 Likes

Here is a small game I made. I probably wont update it anymore because I don’t know what else to add. I did think of maybe a tournament mode where you try to win as much matches as you can before you lose. But If anyone has any suggestions for it, I’ll gladly add it because it’s honestly just fun to code this game.

4 Likes

@Good-Es @pomtl first working QR code generator in Hopscotch!

Here's the deep dive, copy-pasted from the first comment block in my code

There are two comprehensive guides that I followed to get this working:

  1. Creating a QR Code step by step
  2. QR Code Tutorial - Thonky.com

#1 is a bit easier to follow, and #2 has detailed information that #1 had left out.

With some notes on changes I’ve made to make it work in Hopscotch, the general process of creating a QR code goes as follows:

  1. Take the user input, and convert it all into binary. This needs to be in UTF-8, so that means emojis and other 2-byte characters actually take up 4 bytes. Converting to UTF-8 requires you to pair high and low surrogate bytes, then convert them to binary, whereas other 1-byte UTF-16 characters are easier to convert to UTF-8.
  2. Choose a version number (uses the minimum version that can support the amount of bytes needed). You must do this after converting to binary because some characters that are 1 byte in UTF-16 may be several bytes in UTF-8 (lengths are variable).
  3. Put the binary data into segments. I’ve opted to only use one segment to keep things simple, and this segment is in binary mode, so it does not have a limited character set. This allows me to put all user input into the QR code, though it has the drawback of not being perfectly optimized. (A fully optimized QR code generator would be able to store more information)
  4. The single segment should take up all space in the given QR code version, so I add padding to the data.
  5. Split the segment into blocks, whose size and count are predefined and associated with each QR code version.
  6. Create error correction codewords (ECC) for each block separately (see notes below). Since this may affect multiple blocks, I use clones to run this operation in parallel.
  7. Draw the fixed patterns (finder squares, timing patterns). Usually, you would also draw alignment and version information patterns here, but that would require a more complicated method for drawing the data and error correction bytes later.
  8. Because I did not draw alignment or version information patterns with the fixed patterns, I instead hardcoded their positions in the binary data and inserted them using the clones I’ve already created. They are inserted back to front so that the next insertion index does not change. So, alignment and timing patterns are drawn with the data bytes and ECC.
  9. I draw the data patterns with Mask #2 since it is based on columns only. Drawing occurs in a zigzag shape, so I needed to determine the start index of each column (i.e. 0, 1, 24, 25, etc.) and its size, then draw every other byte in that range (since going up or down requires two columns due to zigzag shape).

More info on generating Error Correction Codewords/bytes:

  • These typically require generating a polynomial to used to calculate the bits, depending on the number of ECC needed. The number of ECC needed per block depends on the QR code version, but since that is finite, I just ran the polynomial generation function outside of Hopscotch and pasted the results in this project. This allows me to get data from the polynomial without having to generate it.
  • I simplified the code in this repository almost entirely into operations that are possible in Hopscotch: https://github.com/louismullie/erc-js/blob/master/src/ReedSolomon.js
  • After that, I recreated the simplified script in this project.

More info on drawing the patterns:

  • In columns with a finder pattern, data is drawn forwards going up and backwards coming down. Then, finder patterns are added at the beginning and end of the string.
  • In columns without a finder pattern, data is drawn forwards for all rows. Each row has a break due to the horizontal timing module; since this is 7 modules from the top, I either break the drawing after 6 or “size - 6” bytes to draw it. Then, I draw the rest of it and flip modules that have data flowing from top to bottom.
  • The vertical timing module is a constant checkered pattern and is thus constant for every version. This is the first column that appears when you tap on Generate.
13 Likes

Awesome!

4 Likes

ack every time it just crashes :frowning:

maybe cuz I’m on safari

2 Likes

XD XD XD XD XD XD XD XD XD XD

(Oh it kept crashing for me as well, on the app)

2 Likes

yeah unfortunately that’s part of what happens when you use set text. For me, it works on my iPad once before crashing, but not on my phone (even though my phone has more RAM)

I used set text primarily because half of the blocks are drawn in reverse order and because I was coding it in the web explorer

4 Likes

Ok. What do you mean by Wi-Fi on Enter Data?

3 Likes

QR Codes let you store wifi network name and password in them – useful for if you have a guest over and want a fast way to connect everyone’s device!

4 Likes

oooo

prints a million copies /j

ugh it just keeps crashing

2 Likes

Alignment might be a bit off

I5 24gb ram

2 Likes

huh that’s unusual – looks like I didn’t test it on Windows, which is rendering it differently! Looks like the blocks don’t render at full width, how odd

2 Likes

Windows is a bit weird that way. I got a similar problem before on one of my personal projects.

1 Like

honestly you would think that a full-width character would render at full width, but I guess that’s not always the case. What were you trying to generate a QR code for, btw?

[1]


  1. a rick roll? never gonna give you up ↩︎

4 Likes

Nah just tested it with my username.

Classic windows

2 Likes

I’ll try to change the resolution later

1 Like

Nope, changing actual resolution makes no difference, neither does emulating a different device.

edit: i’m assuming this isn’t intended

application-a645945a26d70ea57fbb5caeee798582e0a9d60e378254c7ce7386e62c154e29.js:36105
 Uncaught ReferenceError: main is not defined
    at HTMLAnchorElement.playHandler (application-a645945a26d70ea57fbb5caeee798582e0a9d60e378254c7ce7386e62c154e29.js:36105:31)
playHandler @ application-a645945a26d70ea57fbb5caeee798582e0a9d60e378254c7ce7386e62c154e29.js:36105```
2 Likes

yeah that does some things but won’t change how the OS renders text


that happens if you click play before the project loads

3 Likes