1. For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
    Dismiss Notice
  1. Romixal

    Romixal Terrarian

    Screen is based on the real world matrix displays.
    This design is similar to [email protected]’s implementation, but instead of using regular logic gates I used faulty ones.
    With carefully planned execution order we can change state of the regular lamps on the whole row multiple times per tick,
    wherein we actually can get some corresponding results from faulty logic gates.


    These rows of “Faulty AND gates” I call “inverters”, because when they activated they change state of the pixels that they connected to.


    Look at execution order, between step 1 and step 2 (4-5; 7-8; 10-11) we can place jumpers that change state of certain inverters.
    That set of jumpers I used to call “frame block”:


    So, now we can change any pixels on this screen in one tick.
    But each next frame strictly rely on previous one, because we only can inverse state of pixels.
    For example I pick these two frames:


    Let’s say left frame is the current screen state and the right one we want to get.
    Because we dealing with inverters, easy way to figure out when we need activate/deactivate them is overlay desirable frame on current frame with XOR algorithm.
    You can do it with your graphical editor, by blending layers with “Difference” mode:


    That image shows us where inverters should be turned on (white pixels) and turned off (black pixels).
    Then we need to figure out when we toggle our inverters: we looking for thoes when horizontal line change it’s color, I highlighted those pixels with red color
    (if previous frame left some inverters turned on, we need invert state of the first pixel of the corresponding row):


    Then given pattern i apply to these cheat sheets, this mess helps me to build a frame block.
    Left cheat sheet shows input wire, and the right one shows output.



    And i end up with this frame-block at the end.

    I’m not good at explaining how I get from this cheat sheet mess to this pretty frame block… Well, you will figure it out, it will be your homework.

    Then I just repeated this process ~6571 times.
    Feel free to ask your questions, if you don't get something.
    ninjofes, inomanoms, Sergo and 24 others like this.
  2. Amazing work! Glad to see this song isn't dead yet too
  3. ekinator

    ekinator Eye of Cthulhu

    This is just amazing. I've been trying to make that display work for so long and still haven't done it. Great job on figuring out how to do it.
  4. RazorOx

    RazorOx Terrarian

    Whoa.... o_O
  5. ZeroGravitas

    ZeroGravitas The Destroyer

    Very impressive @Romixal. Quite a splash with the video! (Saw it via Reddit.)

    I'm not going to pretend to begin to understand how you've encoded the pixel change data so compactly (what is it, a 16 x 32 pixel matrix display? Only roughly counted)... Let alone what all the data buses must look like!

    I couldn't initially believe there would be space in a single world for all those frames, as your video kept playing, but from looking at the numbers here, it seems like you've just really pushed things out the to the limit! From my very rough calculations, if each of your state change data 'frame block's is about the same size as the one shown (roughly 70 x 24 = 1680 tiles, area?), and you have....
    Approximately(!) 6571 animation frames (what, did you loose count?:p). Then that's ~ 11 million tiles of storage space. Which is the majority of a large world (at 8400 x 2400 = ~20M tiles), just for data storage (a medium world wouldn't fit it).... And that's before space for interconnects.

    Did you really edit in all the state change data by hand? (Via TEdit?) I swear I would have gone blind before processing the 5th frame...:confused:

    Anyhow. Great work and video! ;)Are you going to keep the world file to yourself, or share it with your fans?
  6. thejaxster

    thejaxster Skeletron

    Fantastic video not to forget about the impressive Terraria wiring @Romixal !
  7. Bob The Peanut

    Bob The Peanut Cultist



  8. Romixal

    Romixal Terrarian

    Resolution of this screen is 30x17, that's most densest screen, that i can get...
    Yes we actually can fit 40x17 pixels on the 1920x1080 resolution, but we will end up with not pleasant pixels/gaps ratio.
    "Column" bus is 16 tiles wide, seven lines of [RBGY] and one line of [RB] with single tile gaps between the lines.
    "Row" bus however takes 18 tiles, eight lines of [RB] and one line of [R].
    I use 2 wires because i can't compress everything that goes with Row bus, because each line of this bus take through itself up to 30 pulses per frame,
    obviously logic gates cannot take it.
    "Jumpers" is just 4 tiles tall, so they are not a problem.

    With this type of screen we get some sort of RLE compression.
    On average there is 15-30 jumpers per frame, not that many.


    Theoretically worst possible frame block takes 30*17 jumps, and it will be 510 blocks width.
    But in reality most of the frames takes less then 20% of that, there are some heavy frames, but they are really rare.
    Still, this is not making it easy, whole animation takes about 6500x1900 tiles of space.

    I did ended up with some tools, that i probably will never release.
    I really did like "Smart Wire" feature, that i came up with: it's just place junction boxes automatically, when they needed.

    I would like to release it, but there is some downsides:
    I don't feel like people should see this terrible boring mess, and connecting everything in one big circuit is not a great thing in terms of performance.
    Last edited: Nov 17, 2016
    ZeroGravitas likes this.
  9. rulick15

    rulick15 Cultist

    Really nice , massive and elaborate works. Grea job, Romixal : D
    ZeroGravitas likes this.
  10. MappyGaming

    MappyGaming Plantera

    Wow... This is probably the most complex & impressive work I have ever seen. Thank you so much for sharing Romixal!
    It wouldn't be boring, quite the opposite in fact.:)
    ZeroGravitas likes this.
  11. Agastya

    Agastya The Destroyer

    Christ almighty, this is impressive.

    Seems like every time I forget about the song/video, something brings it back up front and center. I just wasn't expecting it to be Terraria of all things this time.
  12. SovereignVis

    SovereignVis Terrarian

    When I saw the title of this thread I thought of that song. Then it turns out that, yup by "Bad Apple" you were talking about that song. XD
    I was thinking about doing something like this but not a display screen kind of thing, more like a light show kind of thing. Sadly my computer is a slow piece of crap and would have a hard time running something like this that takes up the full size of a large world. :(
    Now the next step is to add color and make a display screen using wire bulbs.
  13. Moh.M@gdy

    [email protected] Terrarian

    Just... How much time did it take from you to create such a thing ?
  14. SnailsAttack

    SnailsAttack Dungeon Spirit

    what the :red:


    it took me 14 years to learn how to tie a :red:ing shoe
    azurephantom100 likes this.
  15. idkwhoiam129

    idkwhoiam129 Steampunker

    That mustve taken forever to program each and every frame! I'm impressed!
  16. W1K

    W1K Witch

    I expected this would've happened.

    Like, monitors and people coding actual pixel animations.

    Not bad apple.

    Nobody ever expects a bad apple.
    azurephantom100 and ZeroGravitas like this.
  17. ZeroGravitas

    ZeroGravitas The Destroyer

    Wow, so each encoded frame block is a custom size and design, rather than an identical template with different connections selected... Obviously that later option would have been too big for even a large world, so you had to compress them. A variable bit rate encoding, effectively. Sheesh!

    Even with some tools (that you made yourself? nice), that still leaves the process a very long way from automated then...? Think it would be very tough to make some tools to automate the wiring? (By using a fixed, maximum, frame block size, to make things easier, for example.)

    Did you pick this video mostly because of it's suitability, being 2 tone monochrome, and also the frame transistions are fairly reasonable? Or have you been wanting to do something Bad Apple related for a while? Which thought came first?

    Sorry to say this is the first time I'd come across this cool little animation. Or ZUN and his Touhou Project games - is that where it comes from? (For the benefit of us uncultured fools.;))
    Last edited: Nov 19, 2016
    Romixal likes this.
  18. MappyGaming

    MappyGaming Plantera

    You mean this?

    This song was originally from a 2D shooting game called Touhou Fantasy land - Lotus Land Story (東方幻想郷 ~Lotus Land Story), released in 1998. You can hear the original music in stage 3. A guy named Zun made this game entirely by himself. Programming, composing music, etc. He's insanely talented.

    Due to their catchy melodies and the fact that they don't have lyrics, making arranged Touhou songs became popular among Japanese Dojin music artists. (Zun himself permitted them to make arranged songs as long as they follow certain rules.) The song itself in @Romixal's video, Bad Apple!! feat. nomico (arranged by Alstroemeria Records) is one of the most famous one among them.

    This shadow art PV was made by another guy named "あにら" (pronounced as Anilla). The PV originally posted on NicoNico, a Japanese video sharing site in 2009. Thanks to this PV, the song became explosively popular all over the world. Even american CNN featured it, from what I heard. Currently the original PV video on NicoNico has 23 million views.

    That's pretty much everything I know about Bad apple! Sorry for the irrelevant post.
    By the way, welcome back @ZeroGravitas!:happy:
    ZeroGravitas likes this.
  19. Romixal

    Romixal Terrarian

    Actually, at the end i fully automated frame block generation, but getting those stuff into the game was a pain.
    Here is the piece of code that generates frameblock:
    Sorry, it looks like crap, because it never meant to be presented.

    And result of it's work look like this:
    So, it defiantly possible to automate whole process of generation. But i never get Terraria to load my generated worlds.

    This is the most obvious choice you can make if you doing something like this.
    Before 1.3.1 update was released, i worked on some project for PICO-8.
    Sure, it was cool little project, i even managed to fit it in 400kb. But i was never satisfied by this, because i didn't do nothing new and you will not surprise anyone with "Bad Apple!!" on another "device".
    So, release of 1.3.1 really decided my near future.
    ZeroGravitas and W1K like this.
  20. SovereignVis

    SovereignVis Terrarian

    I really wish they would have added in note blocks in the 1.3.1 update. Then we could make music tracks like people do in other games like Minecraft and Trove. `:happy:
    azurephantom100 likes this.