# Bad code examples

**URL:** https://community.revolutionarygamesstudio.com/t/bad-code-examples/106
**Category:** Not Thrive
**Created:** [March 6, 2018, 8:13pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106 "2018-03-06T20:13:08Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![hhyyrylainen](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/hhyyrylainen/32/32_2.png) [@hhyyrylainen](https://community.revolutionarygamesstudio.com/u/hhyyrylainen)
#### Post date: [March 6, 2018, 8:13pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/1 "2018-03-06T20:13:08Z")

</div>

I wanted to share example of how not to write code:  
[https://github.com/NoelFB/Celeste/blob/master/Source/Player.cs](https://github.com/NoelFB/Celeste/blob/master/Source/Player.cs)

(and to get more posts on this forum)

---

<div class="post-metadata">

### Author: ![Omicron](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/omicron/32/3618_2.png) [@Omicron](https://community.revolutionarygamesstudio.com/u/Omicron)
#### Post date: [March 6, 2018, 8:15pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/2 "2018-03-06T20:15:27Z")

</div>

Looks… code-y? I really can’t see the issue. (though I’m not good at coding, so…)

---

<div class="post-metadata">

### Author: ![hhyyrylainen](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/hhyyrylainen/32/32_2.png) [@hhyyrylainen](https://community.revolutionarygamesstudio.com/u/hhyyrylainen)
#### Post date: [March 6, 2018, 8:16pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/3 "2018-03-06T20:16:46Z")

</div>

The issue is that the file is a monster at 5000 lines long and there’s so much nesting and spaghetti in it that it’s hilarious to programmers. I remember seeing something similar for terraria. So actually released games _must_ have bad code as a requirement for release.

And we are working on improving thrive’s code, so…

---

<div class="post-metadata">

### Author: ![Louix](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/louix/32/308_2.png) [@Louix](https://community.revolutionarygamesstudio.com/u/Louix)
#### Post date: [March 6, 2018, 8:24pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/4 "2018-03-06T20:24:12Z")

</div>

Wow, that’s a lot of lines Haha

---

<div class="post-metadata">

### Author: ![AgentTine](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/agenttine/32/148_2.png) [@AgentTine](https://community.revolutionarygamesstudio.com/u/AgentTine)
#### Post date: [March 6, 2018, 8:24pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/5 "2018-03-06T20:24:12Z")

</div>

Despite the fact that I have barely done any coding and/or programming (besides Paradox mods), it still looked like bad coding to me, which… probably means something about me.

---

<div class="post-metadata">

### Author: ![Omicron](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/omicron/32/3618_2.png) [@Omicron](https://community.revolutionarygamesstudio.com/u/Omicron)
#### Post date: [March 6, 2018, 8:25pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/6 "2018-03-06T20:25:47Z")

</div>

Oh wow… I did not realize that this was only a small part of the whole file…  
That does look rather confusing, and the notes don’t really help (What the Belgium is a “sweat move”)

---

<div class="post-metadata">

### Author: ![Biologicah](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/biologicah/32/1652_2.png) [@Biologicah](https://community.revolutionarygamesstudio.com/u/Biologicah)
#### Post date: [March 6, 2018, 8:29pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/7 "2018-03-06T20:29:33Z")

</div>

The code mentioned something about a sweat sprite, so I can only guess it’s the sweat sprite sweating.

_ **sweat** _

---

<div class="post-metadata">

### Author: ![BandanaSplitzzz](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/bandanasplitzzz/32/105_2.png) [@BandanaSplitzzz](https://community.revolutionarygamesstudio.com/u/BandanaSplitzzz)
#### Post date: [March 6, 2018, 11:08pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/8 "2018-03-06T23:08:51Z")

</div>

hey dont diss my man noel fb

---

<div class="post-metadata">

### Author: ![BandanaSplitzzz](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/bandanasplitzzz/32/105_2.png) [@BandanaSplitzzz](https://community.revolutionarygamesstudio.com/u/BandanaSplitzzz)
#### Post date: [March 6, 2018, 11:16pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/9 "2018-03-06T23:16:30Z")

</div>

![dumbCode](https://thrivecommunity-uploads.b-cdn.net/original/1X/b570c0b89faf3bddc50b9e493e9e0db43b72969c.JPG)  
i take it back

---

<div class="post-metadata">

### Author: ![zyad137](https://thrivecommunity-cdn.b-cdn.net/letter_avatar_proxy/v4/letter/z/8e8cbc/32.png) [@zyad137](https://community.revolutionarygamesstudio.com/u/zyad137)
#### Post date: [March 7, 2018, 12:56am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/10 "2018-03-07T00:56:38Z")

</div>

is the whole game written in one script? 😂

---

<div class="post-metadata">

### Author: ![crodnu](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/crodnu/32/124_2.png) [@crodnu](https://community.revolutionarygamesstudio.com/u/crodnu)
#### Post date: [March 8, 2018, 12:55am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/11 "2018-03-08T00:55:18Z")

</div>

You know a script is gonna be good when the first 250+ lines are just variable declarations xD  
Edit: also [this SO thread](https://stackoverflow.com/questions/434414/what-is-the-most-evil-code-you-have-ever-seen-in-a-production-enterprise-environ) is relevant.

---

<div class="post-metadata">

### Author: ![InfiniteWisdom](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/infinitewisdom/32/127_2.png) [@InfiniteWisdom](https://community.revolutionarygamesstudio.com/u/InfiniteWisdom)
#### Post date: [March 8, 2018, 3:18pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/12 "2018-03-08T15:18:48Z")

</div>

Well did a novice programmer make this first off. If so I think this is pretty good for that person not everyone has godlike programmer status. I feel like I’m going to get 50 people telling me I’m an idiot 😖  
I’m deleting the double post I accidently made, sorry.

---

<div class="post-metadata">

### Author: ![hhyyrylainen](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/hhyyrylainen/32/32_2.png) [@hhyyrylainen](https://community.revolutionarygamesstudio.com/u/hhyyrylainen)
#### Post date: [March 8, 2018, 3:40pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/14 "2018-03-08T15:40:35Z")

</div>

That code is from the game  
https://store.steampowered.com/widget/504230

Which has been hyped recently. So they managed to make a good game with terrible programming.

---

<div class="post-metadata">

### Author: ![InfiniteWisdom](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/infinitewisdom/32/127_2.png) [@InfiniteWisdom](https://community.revolutionarygamesstudio.com/u/InfiniteWisdom)
#### Post date: [March 8, 2018, 4:23pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/15 "2018-03-08T16:23:33Z")

</div>

Oh, well does the game run without lag at least. But I’m not a programmer… yet, maybe.

---

<div class="post-metadata">

### Author: ![Louix](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/louix/32/308_2.png) [@Louix](https://community.revolutionarygamesstudio.com/u/Louix)
#### Post date: [March 10, 2018, 2:09am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/16 "2018-03-10T02:09:55Z")

</div>

They got lucky !

---

<div class="post-metadata">

### Author: ![InfiniteWisdom](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/infinitewisdom/32/127_2.png) [@InfiniteWisdom](https://community.revolutionarygamesstudio.com/u/InfiniteWisdom)
#### Post date: [March 10, 2018, 6:39pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/17 "2018-03-10T18:39:45Z")

</div>

Until Next time, MWAHAHAHAHA!!!😈 (couldn’t find a devil face, this will have to do)

---

<div class="post-metadata">

### Author: ![Silverstorm](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/silverstorm/32/1786_2.png) [@Silverstorm](https://community.revolutionarygamesstudio.com/u/Silverstorm)
#### Post date: [July 7, 2018, 8:08pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/18 "2018-07-07T20:08:46Z")

</div>

{  
if brain=off  
then.execute(brain\_activate)  
}

ERROR 101: No brain found

---

<div class="post-metadata">

### Author: ![BowlDawg](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/bowldawg/32/9181_2.png) [@BowlDawg](https://community.revolutionarygamesstudio.com/u/BowlDawg)
#### Post date: [July 7, 2018, 10:29pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/19 "2018-07-07T22:29:58Z")

</div>

YOU HAD TO REVIVE THIS THREAD

(you are the necromancer of posts so…)

---

<div class="post-metadata">

### Author: ![jellyfishmon](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/jellyfishmon/32/280_2.png) [@jellyfishmon](https://community.revolutionarygamesstudio.com/u/jellyfishmon)
#### Post date: [July 7, 2018, 11:34pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/20 "2018-07-07T23:34:02Z")

</div>

just let the dead rest in peace you monster 😭

---

<div class="post-metadata">

### Author: ![DPHkraken](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/dphkraken/32/3464_2.png) [@DPHkraken](https://community.revolutionarygamesstudio.com/u/DPHkraken)
#### Post date: [July 20, 2018, 12:49am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/21 "2018-07-20T00:49:59Z")

</div>

So, I went around to making a bot for my private discord server. The first function I made for it is a random user selector.  
However, my method of retrieving users is laughable - a static reference table. The reasoning being, that the rate of new user gain is less than once a month, so I can just add new users to the table and keep it simple.  
The RNG in JavaScript is really bad, though. I might have a small sample size, but it’s been tagging the same three or four people (out of eight) with alarming frequency, and two of us (including me) haven’t even been tagged yet.

[Next page](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106.md?page=2)
