I’m guilty of wasting time thinking too much about...
# linking-together
s
I’m guilty of wasting time thinking too much about architecture and how to write beautiful code. Always good to read an article that pulls you down back into reality: https://www.polygon.com/2020/1/13/21064100/vvvvvv-source-code-game-development-terry-cavanagh-release
👍 5
z
Yep, that's pretty much how I write code. My own project, Yazz Pilot is pretty much held together by duct tape too!
w
yes, that switch statement probably never needed to be maintainable. He just used a new number incrementally to just add an event to a level, moved on, and never returned. How could that code even be be better? use an enum? but then in the level data the number would not necessarily be an enum, so it's actually worse if he ever had to look it up.
👍 3
the "professional programmer" would have wanted to factor out all repeating behaviors, and then make each game event a list of parametrized behaviors, no doubt specified in JSON to be "data driven". And seeing or debugging what happens for one particular event would have been horrible.
👍 3
g
it feels like programming these kinds of magic switch statements are a real boundary condition for text-based programming: in something like photoshop, you don’t have to interface with a wild abstraction to eg add another layer and you usually wouldn’t want to. but having to be able to abstract over text leaves us with the sophie’s choice of boiling spaghetti and using ctrl f to edit it later or turning your code into a TPS report with sound semantics but a corrupt and inefficient bureaucracy
w
@Garth Goldwater if his level data and his code were all in the same "language", then it would be easy, since all he wants to do is associate some code with some thing in a level.. he wouldn't even need to switch to hold it.
g
totally agree