PDA

View Full Version : PC Mod Creation & C++



Tritoch
03-13-2004, 07:49 PM
I've started learning C++ recently. I was playing around with Devastation's (http://pc.vgf.com/reviews/devastation/) level editor today, and noticed that I was actually starting to understand some of the code running behind it even though I'm far from developing anything on my own yet.

So, do any of you dabble in developing mods? If so, how useful are level editors in general for learning code and providing a good supplement to text books? I realize that this isn't a development board, but I know a lot of you are good programmers (even if it isn't in C). :D

Tritoch
03-15-2004, 09:28 PM
So no one here has any experience in developing mods and/or C++ and/or can provide me with some general info on game development? :)

Cantaloup
03-16-2004, 02:24 AM
You might want to check out the Feb. 2004 issue of ACM Queue (http://www.acmqueue.org/), which is a special issue about game development. At least some (if not all) of the articles are available on the website.

Tritoch
03-16-2004, 10:10 AM
Great, I'll be sure to check it out! (site's down right now)

GaijinPunch
03-16-2004, 08:15 PM
Scripting languages (Perl mainly) and a monkey's level of SQL is about the extent of my programming knowledge. I'm learning C++ now, and it's a bit of a monster.

I'm even debating wether I should take correspondance cources and get credited for it. Might kick my ass into gear and actually learn it, rather than write Hello World programs for months on end.

SpasticFuctard
03-16-2004, 08:30 PM
C++ is a bear. Doing your own memory management is a pain, and you better be damn good at it or you'lll be corrupting the kernel memory in no time. Can you say SegFault? how about GPF? Buffer overrun? I knew you could.

C# is way cooler, for it does memory management for you. This is a good thing.

All of that said, a relatively small mod is a good way to learn some c++, also a good IDE makes all the difference. If you can *ahem* acquire a copy of Visual Studio, it will make things easier.

SF - Java Guru & Microsoft Sycophant.

Sakara
03-16-2004, 10:37 PM
I didn't messed with it a lot, but there is a nice book on gba developing in C/C++, with all the dev tools at http://www.jharbour.com/

Tritoch
03-17-2004, 08:41 AM
@GaijinPunch: I've had a lot of programming experience before, but unfortunately it's almost all been procedural (COBOL, CL, etc.) or just "different" (HTML, SQL, etc.) aside from a little VB. I'm stuck where you are though...writing "Hello World" programs. :)

@SpasticFuctard: Actually, I can probably get a copy of Visual Studio through work. Just gotta think of a legitimate business use for it first. LOL

Is C# basically an improved version of C++ (Microsoft's take), or a similar language with a different set of rules, structure, etc.?

WiseSalesman
03-17-2004, 05:03 PM
I'm have rudimentary knowledge of C++, equivalent to about two college courses. Don't know if i can help you out, but I'm here. And, no, I don't program mods. It's something I've never had much interest in.

Tritoch
03-17-2004, 05:47 PM
Well I'm not really looking for help as in actual syntax help, just some general advice on how I should approach learning C++ from a game development perspective (although I'd probably use it at my real job in some form too).

What kind of programs have you written WiseSalesman? Since you say it's "equivalent" to college courses, I assume you picked it up on your own. How hard did you find getting into it as far as you did?

Love your sig btw...that's the primary motivation for me trying to learn C++ and maybe take up game development in the first place (gotta make it happen). :)

Balloon Fight
03-17-2004, 07:47 PM
C++ is extremely difficult to learn. I'm still playing around with Perl and HTML. Other than those I don't know anything. I'm still young though so I have plenty of time. 8-)

Tritoch
03-17-2004, 09:20 PM
C++ is extremely difficult to learn. I'm still playing around with Perl and HTML. Other than those I don't know anything. I'm still young though so I have plenty of time. 8-)

*sits in a rocking chair on his front porch and shakes fist at Balloon Fight*

Actually I'm still relatively young too (25), but at the point where I'm starting to realize that I need to get going with things. I'm past the stage of my life where I have (seemingly) all the time in the world. The last few months I've been taking a long hard look at some of the professions I've always *really* wanted to do, and one of those is game development. I've tinkered with it in the past, but never seriously dove into it. I don't expect to be the next Miyamoto or anything, but if I never give it a real chance I'll never know how it might've worked out. What I do know though is that I don't want to do what I'm doing now for the rest of my life.

Having a baby, mortgage, spouse, and uninteresting career will do that to you. :)

Cantaloup
03-17-2004, 10:57 PM
Here's an idea to start getting involved with this kind of thing. Download the source code to some open source games and check them out. If you find one that interests you, get involved with the open source community for that game. Test new versions and submit bug reports (good testing is at least as important a skill as good programming). You can even contribute your own changes, fixes or improvements.

SourceForge (http://sourceforge.net) is home to many open source projects, and is a good place to look. The Simple Directmedia Library (SDL) (http://www.libsdl.org/index.php) is a cross-platform, open source library that is often used to create games and emulators. You can find a list of games and other programs that use SDL on the web site, many of which are open source as well.

I don't know if you will find exactly what you're looking for. I would think most games are written in C, but you may be able to find some in C++. If you have any questions, please let me know.

SpasticFuctard
03-18-2004, 02:23 PM
Well C# is an interpreted language like Java, so not great for game or graphics stuff. It all lives in Microsoft's .NET UVM (universal virtual machine) and goes a long way to making life easier by insulating you from the iron. Yay iron insulation.

It really more closely resembles Java than C++, though is a hybrid of the best of both.

SF - Yar.

Tritoch
03-26-2004, 10:31 PM
I really appreciate all the great advice. I just finished the "introductory" course I was taking online, and feel pretty comfortable with the basics of C++. I'm at the point now where I understand all of the basics, but couldn't yet write a program that does much more than simple calculations and output. What I'm really confused about is how exactly this is supposed to translate into a game...all of the examples in the course dealt with monetary transactions and such. O_O Any advice on good books I could buy to take me to the next "level", particularly aimed at game development?

If nothing else, I can at least start playing around with some existing programs and take it from there. :)

Jorpho
03-26-2004, 11:13 PM
I find programming in general to be an excruciating exercise. Plowing through ten thousand lines of code in a desperate attempt to find where I left out a "{" is not my idea of fun.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." -Edsger W. Dijkstra (quoted in The Jargon Dictionary)

Cantaloup
03-27-2004, 12:10 AM
I'm at the point now where I understand all of the basics, but couldn't yet write a program that does much more than simple calculations and output. What I'm really confused about is how exactly this is supposed to translate into a game...all of the examples in the course dealt with monetary transactions and such.

In the old days you had to know the intimate details of the hardware you were programming on in order to write games. Today, game developers use libraries: sets of functions (or classes and methods if it's object-oriented) that you can use to draw graphics, play sounds, and so on. A main benefit of these libraries is that you don't need to know the details of the underlying hardware, since these days it can vary widely (different graphics cards, operating systems, I/O devices, etc.). What you need to know, however, is the library's API (application program interface). Basically this is the set of functions (or, in C++, the classes and methods) that a library provides your program. A game library, for example, would give you functions for drawing an object, coloring it, or erasing the screen.

There are many gaming libraries available for personal computers. (I presume Sony, Nintendo and Microsoft provide first party libraries with their console developer kits.) Possibly the most popular gaming library for Windows is Microsoft's DirectX (http://www.microsoft.com/windows/directx/default.aspx). A popular cross-platform 3D graphics library is OpenGL (http://opengl.org). OpenAL (http://openal.org) is an source audio library. SDL, which I mentioned above, is a 2D graphics and sound library. Many other libraries are available as well.

What you want to do is take a look at these libraries (check out their web sites), find one you like, and read through its API documentation (either on-line or in a printed book). This tells you what you can do with the library, and how you can do it. I'd suggest checking out OpenGL, since briefly glancing at the web site it seems to have a good amount of on-line documentation and examples.

Edit: On second thought, maybe SDL would be a better choice to get started with, since it handles input as well.

Tritoch
03-27-2004, 03:14 PM
^That's awesome. I'd studied the concepts you mentioned before, but that post tied a lot together for me nicely. :)

A few more questions...

1) What's the advantage of SDL handling input as well? Are you referring to input from files outside of the program, or input from object to object (which would seem necessary for any library to me)?

2) Is it possible to create a (good) game "from scratch" without using any kind of library at all? Would I have to in essence create my own library to do that? I come from a procedural background (COBOL, Control Language, etc.), so maybe I'm just a little confused on this one...

3) Do you recommend a particular software package (compiler, etc.) to use? Thus far my only experience is with Borland (via the online course), but I don't want to use it exclusively if there's something better and/or cheaper out there.

4) If you're familiar with it, what's your opinion of Torque? (http://www.garagegames.com/index.php?sec=mg&mod=home&page=news)

Cantaloup
03-27-2004, 05:41 PM
1) What's the advantage of SDL handling input as well? Are you referring to input from files outside of the program, or input from object to object (which would seem necessary for any library to me)?

I was referring to the fact that SDL will let you get input from the mouse, keyboard or joystick with its event handling functions. Otherwise, you need to go through your operating system's own API to access those devices, or use a separate library that will handle that kind of stuff.


2) Is it possible to create a (good) game "from scratch" without using any kind of library at all? Would I have to in essence create my own library to do that? I come from a procedural background (COBOL, Control Language, etc.), so maybe I'm just a little confused on this one...

It depends on the type of game. Certainly it would be possible to do something like a text adventure or Rogue/NetHack/Angband using the standard C/C++ input and output functions (printf, etc.). On today's modern operating systems, you usually can't access a computer's hardware directly in most cases for security and reliability reasons. So to talk to a 3D graphics card, you would need to go through the operating system's API calls that let you communicate with the card (basically you ask the OS to talk to the hardware on behalf of your program). On Windows this would be done with DirectX and on Mac OS X it would be OpenGL, so you would need to use these libraries anyway.

To make a long story short, it would be possible if you had lots of technical expertise and a familiarity with the hardware, but the libraries are there so you don't have to do that work. You might want to check this thread (http://www.gamedev.net/community/forums/topic.asp?topic_id=193347) over on GameDev.net (http://gamedev.net).


3) Do you recommend a particular software package (compiler, etc.) to use? Thus far my only experience is with Borland (via the online course), but I don't want to use it exclusively if there's something better and/or cheaper out there.

I use Mac OS X, so I don't know what the compiler situation is on PC. I certainly like Mac OS X, since Apple's developer tools and compilers are provided free with the operating system. If you have a PC, you might look into running a separate Linux installation to play with, since I think the standard Unix compilers are included with it (cc, gcc, etc.). I'm not sure however, so you'll have to check it out. They're not easy to use (command line interface), but they work. If you want a Windows development environment, you might look around to see if you can find an older version of Microsoft Visual Studio or another Windows-based compiler that you could pick up cheap someplace.


4) If you're familiar with it, what's your opinion of Torque? (http://www.garagegames.com/index.php?sec=mg&mod=home&page=news)

I'm not familiar with it, but it seems like you need to pay for it ($100).

Tritoch
03-28-2004, 12:07 PM
I was referring to the fact that SDL will let you get input from the mouse, keyboard or joystick with its event handling functions. Otherwise, you need to go through your operating system's own API to access those devices, or use a separate library that will handle that kind of stuff.

Ah.


It depends on the type of game. Certainly it would be possible to do something like a text adventure or Rogue/NetHack/Angband using the standard C/C++ input and output functions (printf, etc.). On today's modern operating systems, you usually can't access a computer's hardware directly in most cases for security and reliability reasons. So to talk to a 3D graphics card, you would need to go through the operating system's API calls that let you communicate with the card (basically you ask the OS to talk to the hardware on behalf of your program). On Windows this would be done with DirectX and on Mac OS X it would be OpenGL, so you would need to use these libraries anyway.

To make a long story short, it would be possible if you had lots of technical expertise and a familiarity with the hardware, but the libraries are there so you don't have to do that work. You might want to check this thread (http://www.gamedev.net/community/forums/topic.asp?topic_id=193347) over on GameDev.net (http://gamedev.net).

Very informative thread (and site!).


I use Mac OS X, so I don't know what the compiler situation is on PC. I certainly like Mac OS X, since Apple's developer tools and compilers are provided free with the operating system. If you have a PC, you might look into running a separate Linux installation to play with, since I think the standard Unix compilers are included with it (cc, gcc, etc.). I'm not sure however, so you'll have to check it out. They're not easy to use (command line interface), but they work. If you want a Windows development environment, you might look around to see if you can find an older version of Microsoft Visual Studio or another Windows-based compiler that you could pick up cheap someplace.

That's two votes for Visual Studio, so I guess I'm going to have to think of a "project" I can work on at work. LOL


I'm not familiar with it, but it seems like you need to pay for it ($100).

Yup, that's why I asked. The software package itself looks very versatile (and something a beginner like me could handle), but I am of course cheap and poor. :)