Pointers and gaming - MARIO

This is a discussion on Pointers and gaming - MARIO within the Game Programming forums, part of the General Programming Boards category; I have always thought that without having pointers in game programing it would make it difficult to keep track on ...

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475

    Pointers and gaming - MARIO

    I have always thought that without having pointers in game programing it would make it difficult to keep track on what variable points to what location.

    But I have downloaded the entire source code for Mario brothers 1 on the NES and it is written in C! There is not a pointer in sight, but I was wondering how they kept the gameEngine up to speed without pointers in the program. Were pointers not arround in 1987 when Nintendo programed Mario?

    EDIT: DAM! It don;t work on my PC as I have XP, oh well, memorys.....

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Pointers have been part of C since the beginning of time (Early 1970's).
    So my guess is the program was written by someone who didn't know pointers well enough to trust using them and created the whole thing using a mass of global variables.

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Pointers are a luxury! I dont see why anyone would pass them up. But, sometimes pointers just get out of hand - it could leave the code cleaner just to avoid them.

    By the way, where did you get the original source of mario? -,-.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I don't see how Mario could be coded without pointers at all given all the bitmaps and graphic data in memory. However, as Salem said it is possible, however, it would be quite ugly.

    In some ways you can get away with more on a console than you can on a PC. Granted you have less memory, less resources, etc, but at least the NES console didn't have to poll for keyboard input, monitor the hard drive, do DMA accesses, etc, etc. A console used to be a much simpler beast. Now I'm sure that the XBOX 360 is more like a PC on the inside than it appears to be on the outside. The very fact that you can now use the same input API for the PC as the XBOX 360 lends crecedence to this.

    And pointers do not get messed up as long as you understand how to use them and how not to use them. As long as you ensure that they will be freed correctly and at the right time, you can pass them around when you want.

    But if you pass a device pointer to an animation class and then accidentally free the device pointer, since they point to the same area of memory as the main device, you will hose your program.

    Design is everything.

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    >>By the way, where did you get the original source of mario? -,-.

    I was wondering the same thing

  6. #6
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    I got mario from google! It was the first thing listed. It even has the name of the programmer! type this in google:

    source code for mario brothers 1

  7. #7
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Super Mario Clouds - 2005 rewrite
    Doesn't sound like the original to me...

    Also given the limitations and special structure of a NES (Modified 6502 CPU/PPU) I think it's more likely it was written directly in assembler. And even if it was written in C it's very unlikely you can compile it successfully on a PC.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    I also thought that NES games were written in assembler. As were SNES games.

  9. #9
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    afaik the genesis was the first console for which a C compiler was written - even so 98% of it's titles were written in assembly.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  10. #10
    Me pwn you.
    Join Date
    Feb 2006
    Location
    At my computer or in my bed.
    Posts
    46
    I should probably have read the rest of the thread before I got to jumpy with google.
    "source code for mario brothers 1" didn't prodice anything useful, A cloud program that scrolls from side to side wasn't the expected result...

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21