Advanced TRONology

  • Matera_the_Mad
    1st Mar 2018 Member 1 Permalink

    This is not about one particular save, but a line of research I've been pursuing.

     

    I wanted a way to stop moving TRON and make it permanent. At first I thought a script like the Temporary-account decorator would be the way to go. However, TRON stores its color info in its tmp. That looked like one big headache. Finding out that it can be "frozen" seemed to solve the problem.

     

    And then I started playing with the tmp values anyway, and came up with several forms of TRON that can be created at will.

     

    1. Normal TRON in frozen form without having to trap it: Tail tmp starts at 0, head at 16, incrementing by 2048. Life and tmp2 values can be changed to make it nearly permanent or let it fade away at a predetermined rate.

    2. EverTRON, a strange TRON that makes a long trail and never dies, but has default life and tmp2. Spawn tmp starts at 43. Tail starts at 8, head at 24. Tail and head can be used like other solid elements.


    3. Zombie TRON: High tmp number range, similar to normal TRON but has its own odd behaviors. Not useful, but fun to play with. It does Game of Life kind of things.

     

    There is a script that lets you pick up elements with altered properties and draw with them, so it really isn't too complicated to make things from solid TRON.


    I created a page about it on my website, with a downloadable tmp chart for everyone's convenience ;).

    http://firefromthesky.org/shenanigans/tronology/

     

    TRON color-tmp palettes for stamps id:2254311

    Edited once by Matera_the_Mad. Last: 1st Mar 2018
  • NF
    1st Mar 2018 Member 0 Permalink

    @Matera_the_Mad (View Post)

    Absolutely stunning! I like this.

     

  • Matera_the_Mad
    4th Mar 2018 Member 0 Permalink

    Joke of the day: "How is TRON like a quark?"

     

    Well, here's the punch line. One thing controlled by tmp is the direction in which TRON begins to travel when it goes "live." So it is possible to have some control over its movement. Any straight line of TRON, all with the same tmp value, will move together in line at first. Tmp2 affects the distance it goes before turning. ("Zombie TRON" is just a little more obsessive than normal TRON. LOL.)

     

    Please don't ask me exactly how this all works, because I am pretty much flying blind. I'm not a programmer; I'm only doing field research ;)

    Edited once by Matera_the_Mad. Last: 4th Mar 2018
  • jacob1
    5th Mar 2018 Developer 0 Permalink
    The actual code is here if you ever want to look at it: https://github.com/ThePowderToy/The-Powder-Toy/blob/master/src/simulation/elements/TRON.cpp

    This is the most relevant code (just some comments):

    /* TRON element is meant to resemble a tron bike (or worm) moving around and trying to avoid obstacles itself.
    * It has four direction each turn to choose from, 0 (left) 1 (up) 2 (right) 3 (down).
    * Each turn has a small random chance to randomly turn one way (so it doesn't do the exact same thing in a large room)
    * If the place it wants to move isn't a barrier, it will try and 'see' in front of itself to determine its safety.
    * For now the tron can only see its own body length in pixels ahead of itself (and around corners)
    * - - - - - - - - - -
    * - - - - + - - - - -
    * - - - + + + - - - -
    * - - +<--+-->+ - - -
    * - +<----+---->+ - -
    * - - - - H - - - - -
    * Where H is the head with tail length 4, it checks the + area to see if it can hit any of the edges, then it is called safe, or picks the biggest area if none safe.
    * .tmp bit values: 1st head, 2nd no tail growth, 3rd wait flag, 4th Nodie, 5th Dying, 6th & 7th is direction, 8th - 16th hue, 17th Norandom
    * .tmp2 is tail length (gets longer every few hundred frames)
    * .life is the timer that kills the end of the tail (the head uses life for how often it grows longer)
    * .ctype Contains the colour, lost on save, regenerated using hue tmp (bits 7 - 16)
    */

    #define TRON_HEAD 1
    #define TRON_NOGROW 2
    #define TRON_WAIT 4 //it was just created, so WAIT a frame
    #define TRON_NODIE 8
    #define TRON_DEATH 16 //Crashed, now dying
    #define TRON_NORANDOM 65536


    .tmp is a bit field, so each bit controls a flag. For example, you have zombie TRON as 65569. This is better represented as 0x10021 in hex. The NORANDOM flag is set, also 0x1 (head, means it actually moves) and 0x20 (a direction flag, could be any other direction instead)

    Very nice work on all this research though. I'm glad someone is finally using TRON and discovering all of its secrets. You seem to have discovered all the hidden flags (norandom being the most obscure flag)
    Edited 2 times by jacob1. Last: 5th Mar 2018
  • Matera_the_Mad
    25th Mar 2018 Member 0 Permalink

    [sigh] Everybody seems to think I haven't read the source code. I have. I just haven't done the math the way it "should" be done because I kind of don't get how to do it. Yet.

  • jacob1
    25th Mar 2018 Developer 0 Permalink
    @Matera_the_Mad (View Post)
    Do you not understand hexadecimal / bit fields? I'm just trying to help here ...

    Just find a hexadecimal converter and convert the .tmp values you use to hex, and you will be able to see exactly which flags are set.
  • BOBHAMSTER
    24th Dec 2021 Member 0 Permalink

    Me: *looks up hexadecimal*