# 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:** 2

<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 20, 2018, 1:45am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/22 "2018-07-20T01:45:21Z")

</div>

> [@jellyfishmon](#):
>
> just let the dead rest in peace you monster 😭

i second this

---

<div class="post-metadata">

### Author: ![QuantumCrab](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/quantumcrab/32/12706_2.png) [@QuantumCrab](https://community.revolutionarygamesstudio.com/u/QuantumCrab)
#### Post date: [July 20, 2018, 5:27am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/23 "2018-07-20T05:27:59Z")

</div>

> [@jellyfishmon](#):
>
> just let the dead rest in peace you monster 😭

I third this  
threads die for a reason

---

<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: [July 20, 2018, 6:06am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/24 "2018-07-20T06:06:50Z")

</div>

So… When will you be joining the programming team?

> [@QuantumCrab](#):
>
> I third this  
> threads die for a reason

This was an offtopic post that didn’t add to the conversation. Whereas @DPHkraken showed how to properly post in the right thread when new things to discuss materialize.

---

<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: [July 21, 2018, 10:40am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/25 "2018-07-21T10:40:15Z")

</div>

I just had to do some really nasty code to get visual studio (thanks, microsoft) to compile Leviathan.

Previous version (that GCC, a good compiler, compiles without issues):

```auto
auto guard = (Leviathan::Locker::Object(this));

```

New version (it has a bit different approach because the previous approach just didn’t work with vs), this is also a good example how complex C++ template magic can get:

```auto
Leviathan::LockTypeResolver<std::remove_reference_t<decltype(
     Leviathan::Locker::AcessLock(this))>>::LType
     guard(Leviathan::Locker::AcessLock(this));

```

---

<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 21, 2018, 2:13pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/26 "2018-07-21T14:13:58Z")

</div>

Might as well contribute

Bad coding example: all of YandereSim

---

<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: [July 21, 2018, 8:18pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/27 "2018-07-21T20:18:21Z")

</div>

I’ve heard many people say that the dev is incompetent and thus the code is probably terrible (and part of the reason why it is taking so long). But has anyone actually seen the code in order to determine if it is actually terrible?

Philosophical question: does bad code exist if there is no one to see it?

---

<div class="post-metadata">

### Author: ![QuantumCrab](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/quantumcrab/32/12706_2.png) [@QuantumCrab](https://community.revolutionarygamesstudio.com/u/QuantumCrab)
#### Post date: [July 21, 2018, 10:06pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/28 "2018-07-21T22:06:34Z")

</div>

depends on how well the game runs. And if it runs well, does it matter?

---

<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 21, 2018, 10:47pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/29 "2018-07-21T22:47:45Z")

</div>

Multiple people have said that they or a friend of theirs has looked at the code before.

Also, the game is prone to have many bugs and gigantic framerate drops, even though the game isnt that graphically demanding.

---

<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: [August 23, 2018, 11:52pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/30 "2018-08-23T23:52:45Z")

</div>

More bad code: I don’t know how to turn a string into a number, so instead I have to turn the string into a color and take the red value. What in the even.  
`string.ToColor(args[1].." 0 0 0" ).r +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: [October 3, 2018, 9:24am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/31 "2018-10-03T09:24:00Z")

</div>

Here is an example what happens when you write bad code:

 ![](https://i.imgur.com/rISTe3f.jpg)

---

<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: [October 3, 2018, 5:36pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/32 "2018-10-03T17:36:37Z")

</div>

Must be some brutal code to put him through so much agony.

---

<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: [September 4, 2019, 10:27am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/33 "2019-09-04T10:27:50Z")

</div>

I’m shamelessly reviving this thread to show my abomination of a loop:  
I’m currently learning machine language and basic assembly to code an arduino. However, in arduino’s timers don’t exist, and each calculation takes the same amount of time. Because of this, I had to create this abomination to stall the thing:

```
;from here

ldi r17,$ff ; 
ldi r18,$00 ; 
notequal1:
dec r17 ; 

ldi r19,$ff	; load big number
ldi r18,$00	; load zero
	notequal3:
dec r19 ; decrease the big number
cp r19,r18	; check if the big number equals zero
	breq equal3 ; if the big number equals zero, go to equal3
	rjmp notequal3 ; if the number does not equal zero, go to notequal3 (go back and decrease again)
	equal3:

cp r17,r18 		
breq equal1
rjmp notequal1
equal1:
;to here: there are 2 loops, of which one is inside the other. With the middle loop, r19 is out to 255. afterwards, it gets decremented by 0. After each decrement, it checks if r19 = 0. If it isn't, go back to decrementing.
; If it is, go to the next line, ending the loop. The outer loop is the same, but after each decrement the middle loop is repeated. This means that the inner loop is repeated 255^2 times total, or 65025 times.

```

It’s a loop. Inside another loop.  
Somebody end me

---

<div class="post-metadata">

### Author: ![blackjacksike](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/blackjacksike/32/7094_2.png) [@blackjacksike](https://community.revolutionarygamesstudio.com/u/blackjacksike)
#### Post date: [September 4, 2019, 8:13pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/34 "2019-09-04T20:13:58Z")

</div>

Nearly a year necro, nice! I had a little arduino activity, though we had the code in a book, so I really don’t understand how the code works in arduino. I’m sure someone on this forum will help you.

Anyway, maybe there is something in this website, who knows.

[https://www.tutorialspoint.com/arduino/index.htm](https://www.tutorialspoint.com/arduino/index.htm)

---

<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: [September 4, 2019, 9:24pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/35 "2019-09-04T21:24:20Z")

</div>

It works. It’s just really ugly. (Though apparently it is what you’re supposed to do, so assembly is just an ugly language in general)

---

<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: [December 22, 2019, 3:39pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/36 "2019-12-22T15:39:24Z")

</div>

This is not a programming help thread, this is for showcasing bad code.

---

<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: [January 11, 2020, 6:23pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/37 "2020-01-11T18:23:23Z")

</div>

Another game that had its source code released (vvvvvvv) has really bad code:

> <https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_version/src/Game.cpp#L622>

  
Don’t do that  
(also see that nice new discourse github embed)

---

<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: [January 11, 2020, 6:29pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/38 "2020-01-11T18:29:52Z")

</div>

Holy shit that’s bad. I like how even after that massive fucking switch case, he still proceeds to make if-else chains that are over 10 layers deep.

---

<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: [April 4, 2020, 12:18am UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/39 "2020-04-04T00:18:05Z")

</div>

> [@Omicron](#):
>
> if-else chains that are over 10 layers deep.

Terraria doesn’t have its code released, but it was decompiled. Every item (of the thousands) was part of an if-else chain.  
It doesn’t help that so many items share functionalities.

---

<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: [May 22, 2020, 8:13pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/40 "2020-05-22T20:13:03Z")

</div>

[![](https://img.youtube.com/vi/UVT6_xq930I/hqdefault.jpg "Yandere Simulator Decompiled Source Code Review - Full Stream Archive 5/11/20...") ](https://www.youtube.com/watch?v=UVT6_xq930I)

Someone reviewed the decompiled Yandere Simulator source code for two and a half hours.

---

<div class="post-metadata">

### Author: ![blackjacksike](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/blackjacksike/32/7094_2.png) [@blackjacksike](https://community.revolutionarygamesstudio.com/u/blackjacksike)
#### Post date: [May 23, 2020, 10:08pm UTC](https://community.revolutionarygamesstudio.com/t/bad-code-examples/106/41 "2020-05-23T22:08:04Z")

</div>

All of that in a single script? Damn.

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

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