Title
#linking-together
Stefan

Stefan

01/14/2020, 9:13 AM
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
z

Zubairq

01/14/2020, 10:43 AM
Yep, that's pretty much how I write code. My own project, Yazz Pilot is pretty much held together by duct tape too!
Wouter

Wouter

01/14/2020, 3:47 PM
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:54 PM
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.
g

Garth Goldwater

01/16/2020, 12:40 AM
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
Wouter

Wouter

01/16/2020, 2:14 AM
@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

Garth Goldwater

01/16/2020, 3:24 AM
totally agree