Please login or register.

Login with username, password and session length
Advanced search  

News:

@achewood I am in a bed with an Asleepness Hat on.

Pages: [1] 2   Go Down

Author Topic: How are they programmed?  (Read 6440 times)

0 Members and 1 Guest are viewing this topic.

Arachno-capitalist

  • Jacobean Fuckbot
  • Mom-Mom's Weepin' Eye
  • *
  • Tiny cans of Dr Pepper: 319
  • Offline Offline
  • Gender: Male
  • Posts: 3967
  • Ostriches and I have a history. So I eat them.
    • View Profile
How are they programmed?
« on: March 06, 2008, 05:09:11 am »

In my nerdier high school days I studied things like Java, various HTML derivations, C++ and whatever. But I am still in complete ignorance as to what language real programs are written in. Like such as what is Internet explorer written in? Are real programs made in GUIs? Im... dumb.
Logged
Guy at my watering hole: "Acap, why do you keep coming to Jack's?They just serve shitty burgers and happen to have beers on tap."
Acap: I was thirsty one day and I sat down. A year later, Jack's was built around me and thirst is a recurring thing.

Pedro Picasso

  • King of the Make-Outs
  • Tiny cans of Dr Pepper: 39
  • Offline Offline
  • Posts: 599
  • What the HECK, Dora?!
    • View Profile
Re: How are they programmed?
« Reply #1 on: March 06, 2008, 05:32:24 am »

Internet Explorer is almost certainly written in C++ using the Microsoft Foundation Class Library (MFC).  All of the "display a window this big"  and "use pretty graphics" code is written in C++ using their Visual C++ tools to help get it just right, compiled into the MFC library, and made available to programmers who want to make things that run very fast (unlike Java) but only run on Windows.  These programmers get a copy of Microsoft's Visual Studio (or whatever they call their development environment these days), load in the MFC library, and write programs that call its "play the enterprise theme wav file" functions.  If Microsoft were writing IE from scratch, they'd probably use their C# language, because well written C# programs run close to as fast as C++ programs on Windows, and because they want to pimp their new language as part of their .NET family of development tools and languages that no one really understands.

So 'real programs' are either written with C++ or with .NET, and they run really fast on Windows but don't run anywhere else.  Java is used to build programs with graphical user interfaces (GUIs) that are meant to run on Windows and a ton of other kinds of computers.  But Java is as slow as molasses that can't find its glasses, so people seldom do that.  This is why web development is so much more fun.  You build your web page with flashy AJAX magic, and bam, you've got a fast program available to a ton of people that can run on any computer.  That's why Google maps rocks, and Google Earth ... umm, I don't know.  Who's ever installed Google Earth?

Ruby rocks!  For serious.
Logged

Arachno-capitalist

  • Jacobean Fuckbot
  • Mom-Mom's Weepin' Eye
  • *
  • Tiny cans of Dr Pepper: 319
  • Offline Offline
  • Gender: Male
  • Posts: 3967
  • Ostriches and I have a history. So I eat them.
    • View Profile
Re: How are they programmed?
« Reply #2 on: March 06, 2008, 05:40:18 am »

Ok, but what I dont get is that when I learned C++ it was all bullshit text stuff. How do all of these graphics get built in? Such as like Quake or WOW or whatever. Are those all written in really elaborate C++ that calls up graphic interfaces? I think maybe im missing the link between what I did in high school and the GUI I see in every other program.

And yes, I have downloaded google earth and it runs like butter on my MBP
Logged
Guy at my watering hole: "Acap, why do you keep coming to Jack's?They just serve shitty burgers and happen to have beers on tap."
Acap: I was thirsty one day and I sat down. A year later, Jack's was built around me and thirst is a recurring thing.

theinevitable

  • Writer's Workshoppers
  • Dude since Knucklehead times
  • *
  • Tiny cans of Dr Pepper: 486
  • Offline Offline
  • Gender: Male
  • Posts: 12139
    • View Profile
    • tweet tweet fun fun
Re: How are they programmed?
« Reply #3 on: March 06, 2008, 06:04:58 am »

they are programmed ONLY FOR KOMMENTING
Logged
Social pressures exist
And if you think about them all of the time
You're gonna find that your head's been kicked in
You're gonna do it all for the grind

Doc

  • Growing Cucumbers of Impressive Dimensions
  • Writer's Workshoppers
  • Philippe is standing on it.
  • *
  • Tiny cans of Dr Pepper: 1408
  • Offline Offline
  • Gender: Male
  • Posts: 5017
  • an emergency backup pug
    • View Profile
Re: How are they programmed?
« Reply #4 on: March 06, 2008, 08:39:16 am »

Ruby rocks!  For serious.

But where do you stand on Python?
Logged
Inev: 'A lot of things are ridiculous if you think about them long enough, you know?'

smick

  • -=Ray=-
  • Tiny cans of Dr Pepper: 1351
  • Offline Offline
  • Gender: Male
  • Posts: 1437
  • MasturBot 342: ONLINE
    • View Profile
Re: How are they programmed?
« Reply #5 on: March 06, 2008, 05:20:02 pm »

Ok, but what I dont get is that when I learned C++ it was all bullshit text stuff. How do all of these graphics get built in? Such as like Quake or WOW or whatever. Are those all written in really elaborate C++ that calls up graphic interfaces? I think maybe im missing the link between what I did in high school and the GUI I see in every other program.

And yes, I have downloaded google earth and it runs like butter on my MBP

Quake is built in exactly the same way, except they use the GL libraries which were prewritten to display 3D graphics.  Those 3D libraries are written in exactly the same way IE was built.

Logged

Pedro Picasso

  • King of the Make-Outs
  • Tiny cans of Dr Pepper: 39
  • Offline Offline
  • Posts: 599
  • What the HECK, Dora?!
    • View Profile
Re: How are they programmed?
« Reply #6 on: March 07, 2008, 02:05:41 pm »

Ok, but what I dont get is that when I learned C++ it was all bullshit text stuff. How do all of these graphics get built in? Such as like Quake or WOW or whatever. Are those all written in really elaborate C++ that calls up graphic interfaces? I think maybe im missing the link between what I did in high school and the GUI I see in every other program.

And yes, I have downloaded google earth and it runs like butter on my MBP

Let's say you wanted to make a window with nothing in it.  That would look like this:

#include <afxwin.h>

class MFC_Tutorial_Window :public CFrameWnd
{
public:
    MFC_Tutorial_Window()
    {
         Create(NULL,"A-CAP'S EMPTY WINDOW OF USELESS FUN");
    }
};

class MyApp :public CWinApp
{
   MFC_Tutorial_Window *wnd;
public:
   BOOL InitInstance()
   {
        wnd = new MFC_Tutorial_Window();
        m_pMainWnd = wnd;
        m_pMainWnd->ShowWindow(1);
        return 1;
     }
};

MyApp theApp;


You include the header for the afxwin library that Microsoft created to give you special commands to draw windows.  You make a class that inherits from CFrameWnd so it's ready to receive those commands, and then you type the actual commands.  Things like Create() and ShowWindow().  You hand them strings like "A-CAP'S WINDOW" to put in the title bar or on the file menu.  You hand them numbers about how big the window should be and how far from the left hand side the "Cancel" button should be.  You just import the commands found in the MFC book and call them the way we used to call our boring string functions in school.

If you know any Perl, you can use Tk to put GUIs together way easier than all this.  Tk is a library like the ones in the MFC, but it's made by different people and it's commands make a lot more sense to me.

Like the wonderful smik mentioned, OpenGL is the library Quake was written with.  It's got commands to draw things and place lights and cameras.  Here's the code to draw a trapezoid:

    //Trapezoid
    glVertex3f(-0.7f, -1.5f, -5.0f);
    glVertex3f(0.7f, -1.5f, -5.0f);
    glVertex3f(0.4f, -0.5f, -5.0f);
    glVertex3f(-0.4f, -0.5f, -5.0f);


I don't know what that means, but this set of video tutorials seems to know what it's doing.  Maybe you'll check it out some time.

Most modern games are built with something like C++ to run the graphics and sound, and set up the game world, and then they use a little cute scripting language that's easier to write in to actually say what each thing in the world does.  When you make changes to the c++ engine (like how fog distorts everything in view), you have to recompile the whole thing and make sure you didn't break anything.  When you change something (like how far a player can jump) in the scripting language, you can just run the game, and the engine reads the new scripts, and you get to play with your changes right then and there.

If you'd like to program your own games some day.  I recommend a really expensive education and then a membership in Garage Games.  Their C++ engine is really cheap.
Logged

smick

  • -=Ray=-
  • Tiny cans of Dr Pepper: 1351
  • Offline Offline
  • Gender: Male
  • Posts: 1437
  • MasturBot 342: ONLINE
    • View Profile
Re: How are they programmed?
« Reply #7 on: March 07, 2008, 10:18:57 pm »

Mmm Garage Games!

I went to the first TribesCon in Seattle and some of the Devs that later spun off to Garage Games were there.   They were really the nicest people ever.  They seemed genuinely blown away that people had assembled in a college cafeteria to play this little game they put together.
Logged

Arachno-capitalist

  • Jacobean Fuckbot
  • Mom-Mom's Weepin' Eye
  • *
  • Tiny cans of Dr Pepper: 319
  • Offline Offline
  • Gender: Male
  • Posts: 3967
  • Ostriches and I have a history. So I eat them.
    • View Profile
Re: How are they programmed?
« Reply #8 on: March 07, 2008, 10:39:19 pm »

Thanks. I have a better grip on the virtual reality.
Logged
Guy at my watering hole: "Acap, why do you keep coming to Jack's?They just serve shitty burgers and happen to have beers on tap."
Acap: I was thirsty one day and I sat down. A year later, Jack's was built around me and thirst is a recurring thing.

Lister

  • Teodor
  • Tiny cans of Dr Pepper: 101
  • Offline Offline
  • Gender: Male
  • Posts: 892
  • 2, 4, 6, 8, time to transubstantiate!
    • View Profile
Re: How are they programmed?
« Reply #9 on: March 08, 2008, 06:17:44 am »

Late to the party, but I have to write something or other here...

3D objects you see in games are just a big list of points, which link together to create meshes of triangles with various bits of info tacked on to them.  The meshes are created in MAX, Maya, or some other editing program and then exported into a file that puts all those points and all the info into a format the engine can read.  The exporter can be really complicated and written in C++, or really simple and just written in whatever scripting language comes with the editor. 

The engine takes those points and projects the 3D volumes they represent onto a 2D image in memory.  This is the most complex stuff that a game does, and what it spends the vast majority of its CPU time on.  As such, engines are usually written mostly in C++ and some parts will be written in C for raw speed (This is less common than it used to be, but still happens).  There's a whole lot that goes into it, from simply determining what should be drawn in the first place (What's not on the screen, what's hidden behind other stuff), which is surprisingly complex, to what order to draw things in (farthest to closest, unless something is transparent, then it needs to be drawn last, but also making sure not to switch between different textures too often, because texture swapping is slow).  You have to basically think of everything when writing an engine, which is why so many companies are willing to pay someone else to do it.

The game mechanics (how fast you run, where the bad guys hide and what they react to) are written in files that aren't compiled in to the engine (internally, at least) and can range from comma-delimited tables from excel to a scripting language like Lua to a completely custom format.  Some PC games will leave these unprotected and let you mess with them (Civ games are good about that) and others will compress them into a binary format and/or roll them into the game itself to prevent editing altogether.

While C# is awesome (ESPECIALLY for tools), and is definitely what I'd use if I were writing a smallish game myself, you won't see AAA titles made with it due to its slowness and the fact that it's pretty danged easy to decompile.

I have no idea if this was helpful or not, because I can't remember how all this stuff looked before I knew any of it. :)
Logged
Lister.  Not that one, the other one.

Pedro Picasso

  • King of the Make-Outs
  • Tiny cans of Dr Pepper: 39
  • Offline Offline
  • Posts: 599
  • What the HECK, Dora?!
    • View Profile
Re: How are they programmed?
« Reply #10 on: March 08, 2008, 04:04:26 pm »

Late to the party, but I have to write something or other here...
<<ENSUING SPECIFICITY>>

Hurray for specificity; it's spiff-cific!

Still we left out the best part.  After all of this hojillion dollars of development goes into the game.  A tiny gnome with a three foot chest-hair beard writes some dialogue based on words he found in UrbanDictionary to explain why whitey-mc-twentysomething is even in Mexico massacreing poor villagers and why some of them are zombies.  He is paid a penny per word, and he only gets that much due to an accounting error.

C++, Java, Perl, and Ruby I'm familiar with, but I know nothing of Python or C#.  I am predisposed against C# as it has always appeared to me to be solving a marketing problem more than a technical or organizational problem.
Logged

smick

  • -=Ray=-
  • Tiny cans of Dr Pepper: 1351
  • Offline Offline
  • Gender: Male
  • Posts: 1437
  • MasturBot 342: ONLINE
    • View Profile
Re: How are they programmed?
« Reply #11 on: March 08, 2008, 08:20:04 pm »

Still we left out the best part.  After all of this hojillion dollars of development goes into the game.  A tiny gnome with a three foot chest-hair beard writes some dialogue based on words he found in UrbanDictionary to explain why whitey-mc-twentysomething is even in Mexico massacreing poor villagers and why some of them are zombies.  He is paid a penny per word, and he only gets that much due to an accounting error.

Careful going too far down this road.   

To me this is turning into a 50's industrial film like we were shown in elementary school.  The very end of this film has a Hugh Beaumont character closing the book he retrieved from the den on 3D games, taking his pipe from his mouth, turning to the camera and saying, "All that work,  all those people, and all that time went into making it possible for a drunk fraternity student on the other side of the country to call you a faggot while he pretended to hump your on screen corpse."
Logged

jaydub

  • VIP
  • Philippe is standing on it.
  • *
  • Tiny cans of Dr Pepper: 1493
  • Offline Offline
  • Gender: Male
  • Posts: 5056
  • Arrant pedantry
    • View Profile
Re: How are they programmed?
« Reply #12 on: March 08, 2008, 08:20:47 pm »

I am predisposed against C# as it has always appeared to me to be solving a marketing problem more than a technical or organizational problem.

Would that problem be that the string of +'s after the C was getting long?
Logged
If you desire peace, work for justice.

jaydub

  • VIP
  • Philippe is standing on it.
  • *
  • Tiny cans of Dr Pepper: 1493
  • Offline Offline
  • Gender: Male
  • Posts: 5056
  • Arrant pedantry
    • View Profile
Re: How are they programmed?
« Reply #13 on: March 08, 2008, 08:21:44 pm »

"All that work,  all those people, and all that time went into making it possible for a drunk fraternity student on the other side of the country to call you a faggot while he pretended to hump your on screen corpse."

Your profile star was well earned today, sir.
Logged
If you desire peace, work for justice.

Pedro Picasso

  • King of the Make-Outs
  • Tiny cans of Dr Pepper: 39
  • Offline Offline
  • Posts: 599
  • What the HECK, Dora?!
    • View Profile
Re: How are they programmed?
« Reply #14 on: March 10, 2008, 05:18:41 pm »

Careful going too far down this road.   

The caustic version: Video game writing is crap.  It's terrible.  Why do they use the spoken word at all?  Wouldn't it be better if developers just forgot they ever took creative writing as a middle school elective and stick to making pretty things that explode when you shoot them?

The long version:

The last two games I've played were Portal then Resident Evil 4.  That's a big come-down.  It's left a bad taste in my mouth.

Most writing is crap, just by volume.  But you filter.  When you filter out all the crap writing in the world you're left with a ton of books, a lot of theatre, a good bit of movies, some television, and only about a half-dozen video games.

But I love video games.  And a large part of that is that writing is not the point.  The fact that Bowser kidnapped the princess is not really there to provide motivation.  It's just there for explanation.  It's just something to drop into: you must perform this set of ridiculous tasks so that <<SOMETHING HERE>>.  But if you're going to spend a lot of time on the story itself, it should be pretty good.  If your game's mission is to rescue the "president's daughter," understand that it's glaringly obvious that the mission is crap, and don't spend a lot of time building it up.  Certainly don't mention the phrase "president's daughter" twelve times during one conversation.  The phrase isn't magical.  It's just <<SOMETHING HERE>>.  The story from the original Doom was one page printed and terrible.  But it was a great game.  Resident Evil 4 has terrible terrible dialogue that makes you wish you hadn't heard it.  It really ruins the fun for me.  When the main character said, "I have a bad feeling about this." it took away from the game as a whole.  Not because it's a cliche spoken by a paper cut-out character, but because he had already been attacked by pitch-fork wielding zombies.  "The 'bad feeling' you have 'about this' is liquid dookie dribbling down your pant-leg!"

Games excel when they realize that the developer should spend a ton of effort on the writing, but the player shouldn't.  You can play Portal with the sound off.  There's nothing in Glados' dialogue that you really need to win, and you're almost never stopped so you can hear it.  It's freaking GREAT, and you miss a lot if you don't hear it, but it never gets in your way. 

Here's an exception to that: I enjoyed the living crap out of Deus Ex.  I think it was a great game, and well written.  But it didn't make you spend too much time on dialogue trees because it knew that as much work went into the game, it still didn't have the writing caliber of ... say ... the television show Alias which isn't exactly Shakespeare either.

Look at free little games like Passage.  It packs a punch artistically, and the only symbolic language of any kind is your 'score' in the top right.  Youth, love, success, lonliness, aging, death, and sudden loss are all told in five minutes with no words. 

So I says, if your game has a story, make it unbelieva-brilliant, and then never let it get in the player's way.  Make sure they're experiencing the story, and not reading/listening to it as much as possible.
Logged
Pages: [1] 2   Go Up