Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. Simple Optimization Trick

Simple Optimization Trick

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
70 Posts 49 Posters 38 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F [email protected]

    Those games didn't have the splash that Doom did for this sort of thing.

    https://web.archive.org/web/20010105180900/http://www.gamespy.com/legacy/articles/devweek_c.shtm

    Mainstream application programmers switched to C in the early 80's. Game developers were slower to switch, because their small teams and focus on performance kept assembly language viable till the following decade. When id Software released DOOM, they surprised much of the industry by having no reliance on assembly code--despite excellent game performance, and by successfully cross-developing the game (in NeXTstep and DOS), then successfully porting it to an astounding variety of platforms.

    E This user is from outside of this forum
    E This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #50

    Those games didn’t have the splash that Doom did for this sort of thing.

    I would say that Wolf3d would certainly count as proof of concept.

    1 Reply Last reply
    3
    • D [email protected]

      I've never written a single line of code in assembly, and I'm now curious

      M This user is from outside of this forum
      M This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #51

      A little late to this comment but there are some assembly videogames out! They are puzzles and gives you the gist of how assembly works.

      I really enjoyed TIS-100. I just never got around to beating it.

      D 1 Reply Last reply
      3
      • M [email protected]

        Since it wasn't mentioned yet: https://openrct2.io/

        L This user is from outside of this forum
        L This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #52

        Best way to play till this day

        1 Reply Last reply
        6
        • addie@feddit.ukA [email protected]

          I learned z80 assembly back when the cutting edge of technology was a ZX Spectrum, and 68k assembly when I upgraded to an Amiga. That knowledge served me quite well for my early career in industrial automation - it was hard real-time coding on eZ80's and 65c02 processors, but the knowledge transfers.

          Back in the day, when input got mapped straight into a memory location and the display output was another memory location, then assembly seems like magic. Read the byte they corresponds to the right-hand middle row of the keyboard, check if a certain bit is set in that byte, therefore a key is held down. Call your subroutine that copies a sequence of bytes into a known location. Boom, pressing a key updates the screen. Awesome.

          Modern assembly (x64 and the like) has masses of rules about pointer alignment for the stacks, which you do so often you might as well write a macro for it. Since the OS doesn't let you write system memory any more (a good thing) then you need to make system calls and call library functions to do the same thing. You do that so often that you might as well write a macro for that as well. Boom, now your assembly looks almost exactly like C. Might as well learn that instead.

          In fact, that's almost the purpose of C - a more readable, somewhat portable assembly language. Experienced C developers will know which sequence of opcodes they'd expect from any language construction. It's quite a simple mapping in that regard.

          It's handy to know a little assembly occasionally, but unless you're writing eg. crypto implementations, which must take the exact same time and power to execute regardless of the input, then it's impractical for almost any purpose nowadays.

          D This user is from outside of this forum
          D This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #53

          Very interesting. Thank you. I may start looking into C instead. I'll still watch a couple of videos on assembly, just for the hell of it.

          1 Reply Last reply
          1
          • M [email protected]

            Since it wasn't mentioned yet: https://openrct2.io/

            F This user is from outside of this forum
            F This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #54

            Holy fucking shit this is the best motherfucking news this year

            F 1 Reply Last reply
            2
            • K [email protected]

              If you're curious, I recommend this channel. It often delves deep into the code to explain stuff, as well as how the hardware works. Really fascinating!

              D This user is from outside of this forum
              D This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #55

              This is a very interesting channel. Thank you

              1 Reply Last reply
              1
              • maven@lemmy.zipM [email protected]
                This post did not contain any content.
                H This user is from outside of this forum
                H This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #56

                Have you seen the insane complexity of modern CPUs? Ain't no one hand coding that like a 6502 in 1985.

                M S 2 Replies Last reply
                13
                • M [email protected]

                  A little late to this comment but there are some assembly videogames out! They are puzzles and gives you the gist of how assembly works.

                  I really enjoyed TIS-100. I just never got around to beating it.

                  D This user is from outside of this forum
                  D This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #57

                  Oh, that's pretty cool. Thank you

                  1 Reply Last reply
                  1
                  • H [email protected]

                    Have you seen the insane complexity of modern CPUs? Ain't no one hand coding that like a 6502 in 1985.

                    M This user is from outside of this forum
                    M This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #58

                    I wonder if there's anyone alive right now who would be capable of such a task.

                    blackmist@feddit.ukB 1 Reply Last reply
                    4
                    • F [email protected]

                      Because it's true. Here's an article from Tim Sweeney from 2001:

                      https://web.archive.org/web/20010105180900/http://www.gamespy.com/legacy/articles/devweek_c.shtm

                      Mainstream application programmers switched to C in the early 80's. Game developers were slower to switch, because their small teams and focus on performance kept assembly language viable till the following decade. When id Software released DOOM, they surprised much of the industry by having no reliance on assembly code--despite excellent game performance, and by successfully cross-developing the game (in NeXTstep and DOS), then successfully porting it to an astounding variety of platforms.

                      B This user is from outside of this forum
                      B This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #59

                      having no reliance on assembly code

                      That's not true. The original Doom has assembly. They replaced it for the Linux source release. But by that time PC hardware was much faster ( remember back in the 90's performance doubled every 2 years) so it wasn't needed.

                      "Planar.asm"

                      https://doom.fandom.com/wiki/Doom_source_code_files

                      1 Reply Last reply
                      1
                      • H [email protected]

                        Have you seen the insane complexity of modern CPUs? Ain't no one hand coding that like a 6502 in 1985.

                        S This user is from outside of this forum
                        S This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #60

                        Even if one did, say using x86, it would still just be interpreted by the CPU into the CPU's native opcodes, as the legacy instruction sets are interpreted/translated.

                        B 1 Reply Last reply
                        0
                        • M [email protected]

                          I wonder if there's anyone alive right now who would be capable of such a task.

                          blackmist@feddit.ukB This user is from outside of this forum
                          blackmist@feddit.ukB This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #61

                          If the hardware was fixed, I don't see why not.

                          Might not be as fast as the optimisations compilers do these days though.

                          If you have to support thousands of types of GPU and CPU and everything else, then fuck no.

                          1 Reply Last reply
                          3
                          • S [email protected]

                            Even if one did, say using x86, it would still just be interpreted by the CPU into the CPU's native opcodes, as the legacy instruction sets are interpreted/translated.

                            B This user is from outside of this forum
                            B This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #62

                            as the legacy instruction sets are interpreted/translated.

                            Wth? That's it, I'm sticking to the AVR then

                            1 Reply Last reply
                            0
                            • F [email protected]

                              Holy fucking shit this is the best motherfucking news this year

                              F This user is from outside of this forum
                              F This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #63

                              Wait, it looks like the only way to install OpenRC2 is to have already installed RC2?

                              Installing on my Linux machine:

                              OpenRC2 needs files from the original RollerCoaster Tycoon 2 or RollerCoaster Classic in order to work. Please select the directory where you installed RollerCoaster Tycoon 2 or RollerCoaster Classic.
                              (I haven't learned anything about how to live in the Linux environment, I barely use this machine)

                              L M 2 Replies Last reply
                              0
                              • F [email protected]

                                Wait, it looks like the only way to install OpenRC2 is to have already installed RC2?

                                Installing on my Linux machine:

                                OpenRC2 needs files from the original RollerCoaster Tycoon 2 or RollerCoaster Classic in order to work. Please select the directory where you installed RollerCoaster Tycoon 2 or RollerCoaster Classic.
                                (I haven't learned anything about how to live in the Linux environment, I barely use this machine)

                                L This user is from outside of this forum
                                L This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #64

                                You just need the main game files. If you want to be legal, you can just buy RCT2 off of gog, and then just use wine to "install" the game, of which, you just copy the installed files into OpenRCT2. RCT1 is not needed, but adds more to the game.

                                F 1 Reply Last reply
                                2
                                • L [email protected]

                                  You just need the main game files. If you want to be legal, you can just buy RCT2 off of gog, and then just use wine to "install" the game, of which, you just copy the installed files into OpenRCT2. RCT1 is not needed, but adds more to the game.

                                  F This user is from outside of this forum
                                  F This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #65

                                  I guess I'll have to find a friend I can borrow from, does piratebay still have old PC games?

                                  L 1 Reply Last reply
                                  0
                                  • R [email protected]

                                    > almost

                                    B This user is from outside of this forum
                                    B This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by [email protected]
                                    #66

                                    I used those as examples but I claim that most everything was C by the early 90's. The statement that C compilers got fast which allowed it isn't true. When a new compiler came out it was always a couple of percentage points faster than the old version. Meanwhile hardware was doubling in performance every two years.

                                    C compilers didn't need much optimization because there wasn't much performance that could be optimized into code on the simple CPUs of 1992 when Doom was being written. CPU's weren't the superscalar multi core monsters they are today. A compiler couldn't take advantage of reordering instructions to use multiple adders because there was only one.

                                    1 Reply Last reply
                                    1
                                    • F [email protected]

                                      I guess I'll have to find a friend I can borrow from, does piratebay still have old PC games?

                                      L This user is from outside of this forum
                                      L This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by [email protected]
                                      #67

                                      The internet archive probably has a copy. That's the way I usually go with old PC games.

                                      I did find a site called gog-games.to , but I have never used the site, so be careful.

                                      EDIT:
                                      ripped.guide is a great website to find piratable stuff. Just make sure you use a VPN when doing this stuff (besides the Internet Archive, ofc)

                                      1 Reply Last reply
                                      1
                                      • F [email protected]

                                        Wait, it looks like the only way to install OpenRC2 is to have already installed RC2?

                                        Installing on my Linux machine:

                                        OpenRC2 needs files from the original RollerCoaster Tycoon 2 or RollerCoaster Classic in order to work. Please select the directory where you installed RollerCoaster Tycoon 2 or RollerCoaster Classic.
                                        (I haven't learned anything about how to live in the Linux environment, I barely use this machine)

                                        M This user is from outside of this forum
                                        M This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #68

                                        Yeah, it uses the original assets. Similiar to OpenRA for ... multiple games.

                                        1 Reply Last reply
                                        0
                                        • N [email protected]

                                          You couldn't pay me to write a game in C today. Our expectations of what games have to be are sky high today. You cant get away with the productivity lost writing in c, maybe c++ since its supported by a number of engines. But, im personally not aware of a single engine that uses C. I tried my hand at writing a game without an engine, and it was a hot mess. Writing low level code to make a button with text, no thanks...been there done that, in my game, you could bump into trees and get stuck...not very fun in my opinion, and thats after a few months of writing code.

                                          L This user is from outside of this forum
                                          L This user is from outside of this forum
                                          [email protected]
                                          wrote last edited by
                                          #69

                                          Well, as a curious person myself, what programming language would you use to write a game engine in, or at least a game in?

                                          N 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups