How to create Clean Code - CodeAlpaca

Old Game



Just moved the Animation to the center so the wires didn’t intersect as much. Typically when 2 or more behaviors are connected to a single one like this I try to put it in the middle.


image
Once again slight reordering of things. Changed the input for the Emit so there is no longer intersecting wires
Made sure they matched on the X-axis. The Y-axis is less important and I often move things so wires aren’t as hidden.


This is actually fine. A backward wire like this with plenty of space is ok because otherwise the code would be long and need to be zoomed out to view all of it, which shouldn’t be needed for such a small piece of code.
Also, only the X/Y output from the Proximity needs to be connected.


Backward wires here that should be straightened


Backward wire and intersecting wire here.

Overall it’s pretty good. The main thing I’m looking for is larger pieces of code because that’s usually where most issues happen.

New Game, in the works


Pretty good things seem decently bundled

Screenshot 2023-04-21 4.45.00 PM


Just put everything into a bundle with a small reorganization to remove intersecting wires.
(Btw, they really aren’t that big of a deal, but I’m just applying every step in the guide)
Also, I’m assuming the “C” to take 25 damage is there for testing.


This is… It’s not horrible, and it’s a good sign that you’re using expressions like A - B 0? etc.
There’s also an always there that I’m assuming is meant to be connected.

So I gave the Logic Gates a little more space because the wires felt a little clustered. I left the NAND where it was with the 2 backward wires because if I moved it forward it would block many of the wires, causing much more confusion.

Also, the main cause of Backward/Intersecting wires is from the Keyboard, so I looked into what could be done about this.
I applied what I like to call “Bottle Necking” to it, so I moved both “Flips” to the end of the code and expanded from there. Originally it was expanding from the base, but I changed it to be a little bit more of an hourglass shape.
The Bottle Necking/Hourglass (trademarked) often lowers the wire count and makes things much more readable because it follows a direct path instead of spreading wildly.


Bundled this separately because it felt like a slightly different system and because it also made things visually easier.

Here is the importable for it

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Walk (CodeAlpaca)","behaviorType":"logic.NodeGroup","x":-450,"y":-128,"group":"","id":"882c05ae6267f14c","isMenuItem":false},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":810,"y":-384,"group":"a63db5c6acbdcc44","id":"882527e8f3907342"},{"inputCount":3,"outputCount":3,"name":"Push Motor","behaviorType":"logic.components.Motor","x":810,"y":-288,"group":"a63db5c6acbdcc44","id":"8c8b3ef4c9691f41"},{"inputCount":2,"outputCount":2,"name":"Router","behaviorType":"logic.logic.Router","x":630,"y":-320,"group":"a63db5c6acbdcc44","id":"8c8b63787f10cf45","loop":true,"routes":2,"mode":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":450,"y":-416,"group":"a63db5c6acbdcc44","id":"8c8bce58439c3045","startVal":2,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":270,"y":-320,"group":"a63db5c6acbdcc44","id":"8c8bced4e2f70f4f","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":2,"name":"RayCast","behaviorType":"logic.components.RayCast","x":90,"y":-320,"group":"a63db5c6acbdcc44","id":"8c8cdd5c41f1004b","targetClassId":0,"direction":90,"length":13,"earlyOut":false},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-90,"y":-320,"group":"a63db5c6acbdcc44","id":"8c8cf05bf58f7d47"},{"inputCount":0,"outputCount":1,"name":"Mailbox","behaviorType":"logic.components.Mailbox","x":-90,"y":-448,"group":"a63db5c6acbdcc44","id":"8c8e3e8a694d484a","msg":"DoubleJump"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":270,"y":-416,"group":"a63db5c6acbdcc44","id":"8c8e9ca147a7fc43","_startVal":1,"dataType":2},{"delay":1,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":90,"y":-544,"group":"a63db5c6acbdcc44","id":"8c8ea1a7e5f7b044"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":450,"y":-256,"group":"a63db5c6acbdcc44","id":"a63de02a89601144","portId":"a63db5c6acbdcc44i0","tag":"Speed","dataType":2},{"inputCount":1,"outputCount":0,"name":"Velocity/Motor","behaviorType":"logic.NodeGroup","x":-450,"y":-64,"group":"882c05ae6267f14c","id":"a63db5c6acbdcc44","isMenuItem":false},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-630,"y":-160,"group":"a63e527a0da9ce4c","id":"882372b0b5509348","keyCode":65,"repeats":true,"delay":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-128,"group":"a63e527a0da9ce4c","id":"882507ce352da643","startVal":-10,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-32,"group":"a63e527a0da9ce4c","id":"882592c11eb37846","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":64,"group":"a63e527a0da9ce4c","id":"8825aa6ee62a3544","startVal":10,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-450,"y":-128,"group":"a63e527a0da9ce4c","id":"8826323dc8411540","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-450,"y":-224,"group":"a63e527a0da9ce4c","id":"882632cbf0bc6c4c","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-270,"y":-128,"group":"a63e527a0da9ce4c","id":"88265013dd0e8045","startVal":0,"roundMode":1},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-630,"y":64,"group":"a63e527a0da9ce4c","id":"88268a5e88e3a84f","keyCode":68,"repeats":true,"delay":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-450,"y":128,"group":"a63e527a0da9ce4c","id":"88268a5e8712a343","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-450,"y":32,"group":"a63e527a0da9ce4c","id":"88268a5f16030b45","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-270,"y":64,"group":"a63e527a0da9ce4c","id":"88268a5faeca2f4b","startVal":0,"roundMode":1},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-450,"y":-32,"group":"a63e527a0da9ce4c","id":"88269d0d0f02ae4f"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":-270,"y":-32,"group":"a63e527a0da9ce4c","id":"8827507507d0174a","gateType":"NAND"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":0,"y":64,"group":"a63e527a0da9ce4c","id":"88278233a72a1d41","gateType":"AND"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":0,"y":-128,"group":"a63e527a0da9ce4c","id":"882782d1af813c47","gateType":"AND"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":0,"y":-32,"group":"a63e527a0da9ce4c","id":"882ab1b256f1c845","gateType":"XNOR"},{"inputCount":3,"outputCount":2,"name":"Animation","behaviorType":"logic.properties.Animation","x":1080,"y":96,"group":"a63e527a0da9ce4c","id":"8943d4719b370846","animationName":"RollFrames","priority":0},{"inputCount":3,"outputCount":2,"name":"RayCast","behaviorType":"logic.components.RayCast","x":900,"y":96,"group":"a63e527a0da9ce4c","id":"8944702d5d9c0b44","targetClassId":0,"direction":90,"length":13,"earlyOut":false},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":720,"y":-128,"group":"a63e527a0da9ce4c","id":"8bd90c063e568344","tag":"Player X:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":720,"y":-224,"group":"a63e527a0da9ce4c","id":"8bd90ca47d42234b","tag":"Cursor X:Number","version":2,"dataType":2},{"expression":"A-B > 0? 1: A-B < 0? 2: 3","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":900,"y":-32,"group":"a63e527a0da9ce4c","id":"8bd982702276f54e"},{"inputCount":2,"outputCount":3,"name":"Router","behaviorType":"logic.logic.Router","x":1080,"y":-32,"group":"a63e527a0da9ce4c","id":"8bdaaacc49abfe43","loop":true,"routes":3,"mode":0},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":1260,"y":-32,"group":"a63e527a0da9ce4c","id":"8bdacc76e8a8d94c"},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":360,"y":-64,"group":"a63e527a0da9ce4c","id":"a63e8b6eefbe8f4b","portId":"a63e527a0da9ce4co0","tag":"Speed","dataType":2},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":360,"y":0,"group":"a63e527a0da9ce4c","id":"a6418363162b3e4a"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":540,"y":-32,"group":"a63e527a0da9ce4c","id":"a64428524796494c","gateType":"NOR"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":720,"y":96,"group":"a63e527a0da9ce4c","id":"a6458f4ad0735e4b","_startVal":1,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Movement","behaviorType":"logic.NodeGroup","x":-630,"y":-64,"group":"882c05ae6267f14c","id":"a63e527a0da9ce4c","isMenuItem":false}],"links":[{"input_id":"882527e8f3907342i0","output_id":"8c8b63787f10cf45o0"},{"input_id":"8c8b3ef4c9691f41i0","output_id":"8c8b63787f10cf45o1"},{"input_id":"8c8b63787f10cf45i0","output_id":"8c8bce58439c3045o0"},{"input_id":"8c8b63787f10cf45i0","output_id":"8c8bced4e2f70f4fo0"},{"input_id":"8c8bced4e2f70f4fi1","output_id":"8c8cdd5c41f1004bo0"},{"input_id":"8c8e9ca147a7fc43i2","output_id":"8c8cdd5c41f1004bo1"},{"input_id":"8c8cdd5c41f1004bi2","output_id":"8c8cf05bf58f7d47o0"},{"input_id":"8c8ea1a7e5f7b044i0","output_id":"8c8e3e8a694d484ao0"},{"input_id":"8c8e9ca147a7fc43i0","output_id":"8c8e3e8a694d484ao0"},{"input_id":"8c8bced4e2f70f4fi1","output_id":"8c8e3e8a694d484ao0"},{"input_id":"8c8bce58439c3045i1","output_id":"8c8e9ca147a7fc43o0"},{"input_id":"8c8e9ca147a7fc43i1","output_id":"8c8ea1a7e5f7b044o0"},{"input_id":"8c8b63787f10cf45i1","output_id":"a63de02a89601144o0"},{"input_id":"882632cbf0bc6c4ci1","output_id":"882372b0b5509348o0"},{"input_id":"8826323dc8411540i1","output_id":"882372b0b5509348o1"},{"input_id":"a63e8b6eefbe8f4bi0","output_id":"882507ce352da643o0"},{"input_id":"a6418363162b3e4ai0","output_id":"882507ce352da643o0"},{"input_id":"a63e8b6eefbe8f4bi0","output_id":"882592c11eb37846o0"},{"input_id":"a63e8b6eefbe8f4bi0","output_id":"8825aa6ee62a3544o0"},{"input_id":"a6418363162b3e4ai1","output_id":"8825aa6ee62a3544o0"},{"input_id":"88265013dd0e8045i0","output_id":"8826323dc8411540o0"},{"input_id":"88265013dd0e8045i0","output_id":"882632cbf0bc6c4co0"},{"input_id":"882782d1af813c47i0","output_id":"88265013dd0e8045o0"},{"input_id":"8827507507d0174ai0","output_id":"88265013dd0e8045o0"},{"input_id":"882ab1b256f1c845i0","output_id":"88265013dd0e8045o0"},{"input_id":"88268a5f16030b45i1","output_id":"88268a5e88e3a84fo0"},{"input_id":"88268a5e8712a343i1","output_id":"88268a5e88e3a84fo1"},{"input_id":"88268a5faeca2f4bi0","output_id":"88268a5e8712a343o0"},{"input_id":"88268a5faeca2f4bi0","output_id":"88268a5f16030b45o0"},{"input_id":"8827507507d0174ai1","output_id":"88268a5faeca2f4bo0"},{"input_id":"882ab1b256f1c845i1","output_id":"88268a5faeca2f4bo0"},{"input_id":"88278233a72a1d41i1","output_id":"88268a5faeca2f4bo0"},{"input_id":"88265013dd0e8045i1","output_id":"88269d0d0f02ae4fo0"},{"input_id":"88268a5faeca2f4bi1","output_id":"88269d0d0f02ae4fo0"},{"input_id":"882782d1af813c47i1","output_id":"8827507507d0174ao0"},{"input_id":"88278233a72a1d41i0","output_id":"8827507507d0174ao0"},{"input_id":"8825aa6ee62a3544i1","output_id":"88278233a72a1d41o0"},{"input_id":"882507ce352da643i1","output_id":"882782d1af813c47o0"},{"input_id":"882592c11eb37846i1","output_id":"882ab1b256f1c845o0"},{"input_id":"a6458f4ad0735e4bi1","output_id":"8943d4719b370846o1"},{"input_id":"8943d4719b370846i0","output_id":"8944702d5d9c0b44o0"},{"input_id":"8bd982702276f54ei1","output_id":"8bd90c063e568344o0"},{"input_id":"8bd982702276f54ei0","output_id":"8bd90ca47d42234bo0"},{"input_id":"8bdaaacc49abfe43i0","output_id":"8bd982702276f54eo0"},{"input_id":"8bdaaacc49abfe43i1","output_id":"8bd982702276f54eo0"},{"input_id":"8bdacc76e8a8d94ci1","output_id":"8bdaaacc49abfe43o0"},{"input_id":"8bdacc76e8a8d94ci0","output_id":"8bdaaacc49abfe43o1"},{"input_id":"a64428524796494ci0","output_id":"a6418363162b3e4ao0"},{"input_id":"a6458f4ad0735e4bi2","output_id":"a6418363162b3e4ao0"},{"input_id":"a64428524796494ci1","output_id":"a6418363162b3e4ao1"},{"input_id":"a6458f4ad0735e4bi2","output_id":"a6418363162b3e4ao1"},{"input_id":"8bd90ca47d42234bi1","output_id":"a64428524796494co0"},{"input_id":"8bd90c063e568344i1","output_id":"a64428524796494co0"},{"input_id":"8bd982702276f54ei2","output_id":"a64428524796494co0"},{"input_id":"a6458f4ad0735e4bi1","output_id":"a64428524796494co0"},{"input_id":"a6458f4ad0735e4bi0","output_id":"a6458f4ad0735e4bo0"},{"input_id":"8944702d5d9c0b44i2","output_id":"a6458f4ad0735e4bo0"},{"input_id":"a63db5c6acbdcc44i0","output_id":"a63e527a0da9ce4co0"}]}}}
Somewhat newer project

I have no idea why I got Deja Vu from this lol.


I avoid wires that almost seamlessly combine with each other. Also backward and intersecting wires.


Reorganized it to remove backward intersecting wires, as well as make it more straightforward in what is happening.
I also added another custom bundle I like to call the Input Limiter.


This is the Input Limiter, it allows for up to 200 1-framed actions before it adds a delay. This is to help with lag and prevent a seemingly endless loop.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":4,"outputCount":0,"name":"Viewport OT","behaviorType":"logic.NodeGroup","x":-90,"y":-128,"group":"","id":"aa821dab8d54244a","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-832,"group":"aa821dab8d54244a","id":"aa821dacca147043","startVal":0,"tag":"Y","roundMode":1},{"expression":"(A*(32/B))-(16/B)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"Calculate Y","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":450,"y":-832,"group":"aa821dab8d54244a","id":"aa821daec6aa5c41"},{"inputCount":3,"outputCount":1,"name":"Spawn","behaviorType":"logic.components.Spawn2","x":630,"y":-832,"group":"aa821dab8d54244a","id":"aa821daea4a11548","entityClassId":15797025,"spawnX":0,"spawnY":0},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-270,"y":-768,"group":"aa821dab8d54244a","id":"aa821daf9979f84b","tag":"var res:Number","version":2,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-512,"group":"aa821dab8d54244a","id":"aa8ba9b244f5d541","portId":"aa821dab8d54244ai0","tag":"width","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-608,"group":"aa821dab8d54244a","id":"aa8ba90688d06e4b","portId":"aa821dab8d54244ai1","tag":"height","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-672,"group":"aa821dab8d54244a","id":"aa821daeaecaff43","portId":"aa821dab8d54244ai2","tag":"res","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-352,"group":"aa821dab8d54244a","id":"aa821daec50fb94c","portId":"aa821dab8d54244ai3","tag":"build","dataType":2},{"gateVal":0,"mode":"greater than or equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":-90,"y":-672,"group":"aa821dab8d54244a","id":"aa8da958d7c2b44d"},{"expression":"A*B","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-270,"y":-672,"group":"aa821dab8d54244a","id":"aa97d88f4eee6f4e"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-90,"y":-832,"group":"aa821dab8d54244a","id":"aa9b9ea1172d3f41","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-540,"y":-448,"group":"aa821dab8d54244a","id":"ab39f60030bb0c4b","tag":"Width:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-90,"y":-512,"group":"aa821dab8d54244a","id":"ab4366b8fd5ca14a","tag":"PixelsEstimated:Number","version":2,"dataType":2},{"expression":"A*B*C*C","default0":0,"default1":0,"default2":1,"default3":0,"default4":0,"default5":0,"params":3,"version":2,"tag":"","inputCount":4,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-270,"y":-544,"group":"aa821dab8d54244a","id":"ab43aee44c4def47"},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":270,"y":-672,"group":"aa821dab8d54244a","id":"a65c5888af35d347","tag":"var res:Number","version":2,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-64,"group":"a65dbf411389de47","id":"a65de2ea67cd0b4c","portId":"a65dbf411389de47i0","tag":"input","dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":540,"y":-192,"group":"a65dbf411389de47","id":"a65de6ce2fbb7241","portId":"a65dbf411389de47o0","tag":"output","dataType":2},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-64,"group":"a65dbf411389de47","id":"a65dfe3ecafb4e41","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-360,"y":-64,"group":"a65dbf411389de47","id":"a65dfef63aaaf44b","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":-64,"group":"a65dbf411389de47","id":"a65e039e18db5b42","_startVal":1,"dataType":2},{"delay":1,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":180,"y":-224,"group":"a65dbf411389de47","id":"a65e0cd70bf4394c"},{"gateVal":200,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":0,"y":-128,"group":"a65dbf411389de47","id":"a65e3f69497db64e"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-360,"y":-224,"group":"a65dbf411389de47","id":"a65ecfc7d5b53644","startVal":0,"roundMode":1},{"inputCount":1,"outputCount":1,"name":"Input Limiter","behaviorType":"logic.NodeGroup","x":90,"y":-640,"group":"aa821dab8d54244a","id":"a65dbf411389de47","isMenuItem":false}],"links":[{"input_id":"aa821daec6aa5c41i0","output_id":"aa821dacca147043o0"},{"input_id":"aa821daec6aa5c41i2","output_id":"aa821dacca147043o0"},{"input_id":"aa8da958d7c2b44di0","output_id":"aa821dacca147043o0"},{"input_id":"aa821daea4a11548i1","output_id":"aa821daec6aa5c41o0"},{"input_id":"aa821daea4a11548i2","output_id":"aa821daec6aa5c41o0"},{"input_id":"ab43aee44c4def47i1","output_id":"aa8ba9b244f5d541o0"},{"input_id":"ab39f60030bb0c4bi0","output_id":"aa8ba9b244f5d541o0"},{"input_id":"aa97d88f4eee6f4ei0","output_id":"aa8ba90688d06e4bo0"},{"input_id":"ab43aee44c4def47i0","output_id":"aa8ba90688d06e4bo0"},{"input_id":"aa821daf9979f84bi0","output_id":"aa821daeaecaff43o0"},{"input_id":"aa97d88f4eee6f4ei1","output_id":"aa821daeaecaff43o0"},{"input_id":"aa97d88f4eee6f4ei2","output_id":"aa821daeaecaff43o0"},{"input_id":"ab43aee44c4def47i2","output_id":"aa821daeaecaff43o0"},{"input_id":"ab43aee44c4def47i3","output_id":"aa821daec50fb94co0"},{"input_id":"a65dbf411389de47i0","output_id":"aa8da958d7c2b44do1"},{"input_id":"aa8da958d7c2b44di1","output_id":"aa97d88f4eee6f4eo0"},{"input_id":"aa821dacca147043i2","output_id":"aa9b9ea1172d3f41o0"},{"input_id":"a65dbf411389de47i0","output_id":"ab43aee44c4def47o0"},{"input_id":"ab4366b8fd5ca14ai0","output_id":"ab43aee44c4def47o0"},{"input_id":"aa821daec6aa5c41i1","output_id":"a65c5888af35d347o0"},{"input_id":"a65dfef63aaaf44bi1","output_id":"a65de2ea67cd0b4co0"},{"input_id":"a65e3f69497db64ei1","output_id":"a65dfe3ecafb4e41o0"},{"input_id":"a65e039e18db5b42i2","output_id":"a65dfe3ecafb4e41o0"},{"input_id":"a65dfe3ecafb4e41i2","output_id":"a65dfef63aaaf44bo0"},{"input_id":"a65de6ce2fbb7241i0","output_id":"a65e039e18db5b42o0"},{"input_id":"a65de6ce2fbb7241i0","output_id":"a65e0cd70bf4394co0"},{"input_id":"a65e039e18db5b42i1","output_id":"a65e0cd70bf4394co0"},{"input_id":"a65e0cd70bf4394ci0","output_id":"a65e3f69497db64eo0"},{"input_id":"a65ecfc7d5b53644i1","output_id":"a65e3f69497db64eo0"},{"input_id":"a65e039e18db5b42i0","output_id":"a65e3f69497db64eo0"},{"input_id":"a65dfe3ecafb4e41i0","output_id":"a65ecfc7d5b53644o0"},{"input_id":"aa9b9ea1172d3f41i1","output_id":"a65dbf411389de47o0"}]}}}



Slightly rearranged things and added the Input Limiter (set to 6)

I mean, got it to finish in 6.8 compared to 7.8 seconds. It’s only slightly faster due to more lag spawning in multiple objects. So in a real game, you would not do this, but if you only cared about speed or weren’t spawning things it would be “more effective”

1 Like

Thank god no one saw my code.

5 Likes

That’s worse than mine, how?

5 Likes

that horrifies me

7 Likes

WhA- How do you get anything done?!?!?

8 Likes

AND I THOUGHT AI WAS HARD?!!??!

7 Likes

I mean… It’s kinda organized, but the is still the most disgusting thing I have ever seen

3 Likes

I had code like that before, the worse part about it is leaving for a week and not being able to remember how any of it worked.

3 Likes

thats the worst, I have recently gotten into the habit of also naming my number blocks(cause I have so many)

1 Like

This was my first very popular game. It was revolutionary at the time because it was both the first sandbox and first open world game on flowlab. Looking back now, it’s horrifyingly unoptimized and just a terror to run on anything but a gaming pc.

3 Likes

Lol, I always cringe when I look at my old code as well

3 Likes

Fr fr :skull: just look at my code for my dragon warriors game (my first game ever on flowlab)

4 Likes

Sorry for reviving this topic.
I just wanted to share what kind of impact Bundles can have on your game. @kade @hi4250five, and anybody else who doesn’t think there’s a point.

Here is what extreme spaghetti looks like:

When your game gets to this point, many of you have already lost hope thinking: ‘The only thing I can do is believe that nothing will go wrong.’ But there’s another solution, there’s another way to sort your code it’s called


. Use the Select tool at the bottom left portion of the code editor screen and press the quarter button: Bundle. It’s that easy, it’s that simple. And suddenly, that pile of code can turn into this:

Sorted, workable, and best of all: Clean.
It only takes a matter of minutes to turn this:


Into this:

That is the use of bundles… SO USE BUNDLES ALREADY.

1 Like

That’s nothing, I have a series spaghetti mess going on in my game, Label. And I refuse to correct it because I don’t want to, lol.

2 Likes

Oh, lol. I thought that was a lot, XD. But did I secure the point of bundles?

1 Like

Seems like maybe too many bundles, typically when it’s islands of like 3 behaviors (things like alpha or presetting an animation), I just group it in a Misc bundle. Also seems like it could rather use bundles inside of bundles rather than all these separate ones, but that’s alright, just depends on what works for you.
And reviving this topic will always be fine, clean code forever :yellow_heart: :muscle:

3 Likes

I organize my code the best I can…
This is literary my code for building!
image
If it’s clean?
Not very much lol.

1 Like

You can use a Router instead of those Filters.
Also the Expression and Number can be condensed to just the Expression, just do
“Math.round(equation)”.
Also the KeyPress + the Numbers can be condensed.
Instead of several KeyPresses, you can have a single KeyPress set to “Activate on any key”, then have it go into a Text Compare of “123456”. Have the “Yes” output connected to a Text to Number, then have that as the option for the Router.
And besides that, there are some unneeded backwards wires & behaviors are aligned in the grid. Normally not being aligned on the Y axis is alright, but you want to try and keep them on the same X axis.

Also you should really name your messages better, having it as “.” Doesn’t improve anything.

1 Like

The Alpaca Method (also known as FHOBIA) for creating clean code. I might be organizing peoples code occasionally, so this document will contain my thought process and reasoning behind the decisions I am making.

3 Likes

How is my code as far as effectivness? (There are lots of backwards wires. :slight_smile: )

Nice job on the google doc by the way! I am working on reading through it now. :slight_smile:

1 Like