3 Replies - 2437 Views - Last Post: 16 June 2012 - 05:43 AM

#1 xaq  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-May 12

Library programs to StarCraft

Posted 15 June 2012 - 03:00 PM

I just finished my second CS course and it's titled as advanced C++. I'm sure there's way more to this language since the 1000 page book we read over the two courses didn't mention anything beyond console applications. I'm just trying to get a read on how much more there is to learn. The best way I can conceptualize this is StarCraft (which I heard was written in C++) so my questions are:

1. What does the code for a game like SC look like? Is it a big collection of classes, pointers,
loops, if statements, and various containers?

2. Roughly how many lines of code would SC be? I heard Flame was like 250k so I'm guessing less?

3. Are games like SC written in just one langauage or multiple langauges if that's even possible?

I'm basically trying to make a conceptual leap between what I'm learning and what gets accomplished. By no means did I expect to be an even intermediate after two courses, but I figured I could at least see further down the road and I just can't see the jump from linked lists to seige tanks.

Pardon the absurdity, I just have to ask. Thank you :)

Is This A Good Question/Topic? 0
  • +

Replies To: Library programs to StarCraft

#2 Crockeo  Icon User is offline

  • D.I.C Head

Reputation: 44
  • View blog
  • Posts: 247
  • Joined: 21-June 11

Re: Library programs to StarCraft

Posted 15 June 2012 - 06:35 PM

1. Any program is made up of sections of code either split up into functions or classes, so yes, everything is made up of smaller sections containing ifs, thens, elses, etc.

2. Well, it really depends on the Starcraft you're talking about. Starcraft II may have more lines of code that Starcraft, but it most likely isn't as large as the Flame virus, as most of the data is resources (images, sounds, etc.)

3. I'd assume that Starcraft was written in C++, probably with Directx, as that's what developers seem to like (for some strange reason). While it is in theory to write a program with multiple languages (maybe C++ with a built in Lua interpreter), but most people don't do that.


And as for the leap from linked lists to siege tanks, even though I'm more of a Java programmer (just trying to get much better with C++), it has to do with learning how a game is structured. You can only do that by making your own game.

Try starting by researching OpenGL and DirectX, or more specifically how to use them to make custom graphics, then write simple games.

Suggestions:
- Try to make a simple box that moves around the screen
- Expand that to include gravity, collision, and jumping

Someone else will probably have some other suggestions.


EDIT: Also, Zerg > Terran. Try Mutalisks, not Siege Tanks.

This post has been edited by Crockeo: 15 June 2012 - 06:36 PM

Was This Post Helpful? 1
  • +
  • -

#3 xaq  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 27-May 12

Re: Library programs to StarCraft

Posted 15 June 2012 - 10:29 PM

I can definitley do that, sounds like a great place to start place to start. I always wondered what the heck Directx actually is and does.

Couldn't have envisioned a better answer, thank you :) You've restored my faith in the internets!



P.S. Mutas do make me cry
Was This Post Helpful? 0
  • +
  • -

#4 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 854
  • View blog
  • Posts: 2,338
  • Joined: 20-August 07

Re: Library programs to StarCraft

Posted 16 June 2012 - 05:43 AM

View Postxaq, on 15 June 2012 - 11:00 PM, said:

1. What does the code for a game like SC look like? Is it a big collection of classes, pointers,
loops, if statements, and various containers?
Those tools you mention are all core parts of the C++ language, so inevitably anything written in C++ will boil down to these things - otherwise it's not really C++

View Postxaq, on 15 June 2012 - 11:00 PM, said:

2. Roughly how many lines of code
lines of code on that kind of scale is usually quite meaningless to everyone except managers, but most likely it would be more code than any single person would ever be able to comprehend in any short space of time. you could have several different systems all with comparable complexity and numbers of features sporting very different numbers in this arena. Presumably the original developers were reasonably competent and didn't blindly copy+paste everything to produce 10 million lines of code. But any large complex system which has taken years to develop is undoubtedly going to be a few hundred thousand lines at least.

The (massive) system which I work with has an estimated 1.3 million lines of C++ code (Estimation based on knowing there are roughly 1300 source files which probably average around 1000 lines each - although some of those files have over 10000 lines and others have as few as 50). But it's a system which has grown over a period of 20+ years. If that particular system were to be rewritten from scratch in its entirety (totally redesigned but with the same end-user features), it's very possible that number would fall to less than half, since it contains a huge amount of code which would be redundant if the system made better use of newer tools, open source libraries, avoided duplication etc. But that kind of thing is fairly normal for very old code

View Postxaq, on 15 June 2012 - 11:00 PM, said:

3. Are games like SC written in just one langauage or multiple langauges if that's even possible?
Yes, possible and also fairly common for a lot of applications. The software I work with has many ancillary projects and subsystems which integrate together to make everything work. There are some front-end parts which are written using web technologies, other parts written in Delphi, some parts written in C#, etc. Also, there's no telling what some of its dependent (closed) libraries may have been written in. Mixing different technologies together is to be expected since no single language will ever do absolutely everything that you need

View Postxaq, on 15 June 2012 - 11:00 PM, said:

I'm basically trying to make a conceptual leap between what I'm learning and what gets accomplished. By no means did I expect to be an even intermediate after two courses, but I figured I could at least see further down the road and I just can't see the jump from linked lists to seige tanks.
Firstly you need to realise that the funky graphics stuff in many applications usually only accounts for a fraction of the whole, and may also be largely separate from the rest of the application. (Although for graphically intense singing-dancing-3D whizzy games it may be a little bit more)

Also, games like that are real-time applications; there are some differences between real-time applications and plain simple input/output applications; the main one being that a real time application is usually built upon the foundation of a main loop (e.g. while(true) { /*update*/ }) which repeats the same steps many times a second without ever pausing to wait for the user, whereas a GUI application or a simple toy console app using cin/cout will typically sit and wait until the user interacts with it. Your toy program to write a linked list presumably didn't have calculations constantly repeating in the background while your user stared at the screen.

I would be unsurprised if a large project like that started out with something like a very simple square moving around a blank screen while the developers implement and test the logic-behind-the-scenes (You don't need fancy graphics in order to build software involving very large and complicated processes and calculations - the graphics stuff could be developed separately to the main game logic).
Development is an incremental process, so its also likely that large amounts of code which had been written in the early stages would have later been tossed away with the delete key following redesigns/refactoring/etc.

This post has been edited by Bench: 16 June 2012 - 05:46 AM

Was This Post Helpful? 3
  • +
  • -

Page 1 of 1