Writing a game from scratch is a good way to see how awful you are as a programmer, specially if you come from webdev.
Amazing how fast your code looks like shit when you're writing a game, even the simplest one.

  • 8
    I wish every coder goes through this phase of having to write (at least) one bare bones game to realize and understand how beautiful programming could be
  • 9
    I don't need a game to make my code look that way...
  • 7
    When I did some web programming I tried to follow MVC. It also works well with games and other apps. A nice way to divide up the program is pub sub where neither the source nor the destination know about each other. I did this in a python app and it made maintaining the app very easy. It also allowed for replacing the different parts easy. You just had to follow the interface.
  • 5
    Almost forgot. If you divide up your app well enough and keep all business logic in one place. Then if you need to automate your app you can do that in a business routine and it will notify your frontend/gui automagically.
  • 2
    The code in my game is a thing of beauty! Unfortunately the actual game itself is cack
  • 2
    I feel that, and I did games before going into web dev.
  • 1
    @Demolishun everything about that comment makes me cry lol.

    MVC is a terrible paradigm IMO that forces way more code bloat than necessary. Especially for games.

    Further, pub-sub is a good way to get your app in an unknown state. It's also debugging hell.
  • 2
    @junon I find MVC, MVVM, MVP to just be the bloatware of the software development industry. Look at getting the password from the password box in WPF and if you following the MVVM flow, you can either

    A) create an attached property to read

    B) create an interface that the view implements that the view model sees if it's implemented by the view

    Both solutions add roughly 4 extra files due to other needs, meanwhile saying 'Fuck it' to MVVM and pass the password box itself to the view model. It's a lot easier to maintain and for someone new to understand rather than tracing you're way through 4-6 files to do one very simple thing.
  • 1
    That's the edgiest edgecase in WPF 🤣. The design decision unique to PasswordBox is you should access the SecurePassword directly and only when you're ready to use it, and never pin it in memory.

    As terrible as WPF is, most everything else is trivial to bind as a dependency property, or using Rx to create a streaming markup extension.
  • 0
    What qualifies as a game "from scratch", anyway?

    Also, I don't know what to feel when writing PyQt, that doesn't decouple UI from heavier computations.

    Android has AsyncTask for reasons.
  • 2
    That's actually how I started. Used nothing but what was offered by Java out of the box (JDK 6 if I remember correctly) and made a 2D flappy bird-like game where you had to evade levitating boxes and see how far you could go.
  • 1
    @TestInProd423 That kind of bloat did not happen when I have used MVC. Pub sub helped immensely to reduce interfacing.
  • 0
    regarding the last sentence:
    when you're a webdev, yes.

    the second game is gonna be better.
    third one almost not bad ;)
  • 0
    @SortOfTested Technically those cases are by the wonderful MVVM purists camp, the ones who think that if the the entire app doesn't follow the architect design pattern it's not MVVM. I don't even try to reason with that line of thinking, since it would be a waste of breath.

    And yep, I definitely implemented the login with that exact mindset of only getting the password at the actual moment it's needed.
Add Comment