Hacker News new | past | comments | ask | show | jobs | submit login

I have a very similar history (though a lot worse games). I still have the backups of my first OpenGL programs and game code from ~16 years ago, I might put up a similar article at some point. The difference is that the author's game seem to improve visually over the years; mine actually regressed from 3D to 2D world (since the latter is easier to manage) ;).

Some random comments follow.

> Still, I loved data binding so much that I built the entire game on top of it. I broke down objects into components and bound their properties together. Things quickly got out of hand.

Boy, you have to see JavaFX. And I inherited a codebase at work written by a cow-orker who was absolutely in love with bindings at that moment...

Also the big blob of code reminded me why good macros in a language (not C-like macros) are a blessing ;).

> Separate behavior and state.

Yeah, learned that same lesson too. I prefer to think in systems operating on data as opposed to a web of objects calling each other. One of the reason is that the web of objects is very implicit; you soon have no idea who actually refers to who anymore.

> If I start typing self. in an IDE, these functions will not show up next to each other in the autocomplete menu.

That's a good and practical point, though I feel dirty about renaming functions for solely that reason. I wonder if this isn't time to experiment with some "first-class editor semantics". Here, ability to explicitly mark functions as grouped together solely for the purpose of IDE displaying them like that in autocomplete and outline view. In my evening Lisping, I'd love to have more control over indentation for macros I write.

> global variables are Bad™

Yeah, that's almost like "goto considered harmful", and about as much correct as a soundbite (i.e. not very). Unfortunately, everyone keeps writing how global variables are evil, and what I'd love to read is some treatment on how to use global variables correctly. For the situations where - like often in games - you absolutely, positively need a lot of globally accessible data.

> Group interdependent code together into cohesive systems to minimize these invisible dependencies. A good way to enforce this is to throw everything related to a system onto its own thread, and force the rest of the code to communicate with it via messaging.

That's a... very self-conscious approach. Odysseus-tied-to-a-mast style.




Agreed on globals. I learned to code making a huge Java + OpenGL game engine some years back, right when scripted web frameworks were really blowing up and people were becoming test-obsessed. Every new article said that global variables and static anything were a deadly sin, so I did some really ugly things to avoid using them. Now I think global state is significantly simpler for certain systems, better than trying to pass that state around when it'll never be instanced.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: