Any C++ Programmers out there?

  • warning: Creating default object from empty value in /home/buckman/public_html/neo/modules/advanced_forum/advanced_forum.module on line 492.
  • warning: Creating default object from empty value in /home/buckman/public_html/neo/modules/advanced_forum/advanced_forum.module on line 492.
23 replies [Last post]
Bill Loguidice
Bill Loguidice's picture
Offline
Joined: 12/31/1969
Great point, Custard. By

Great point, Custard. By the way, the reason why we have bold below your responses are that you forgot the < / b > closing tag on your signature (it's amazing that it affects the WHOLE page after your sig - that's something I hope gets fixed in future revs). I fixed it for you in your profile. I didn't bother to fix it in the other posts. Unlike the signature systems on most sites, this uses the signature you had at the time, not your current signature.

=================================
Bill Loguidice, Managing Director
Armchair Arcade, Inc.
[ My collection ]
[ http://www.MythCore.com ]

n/a
mrCustard (not verified)
Reuse!

Even when you're developing your own engine, what harm is there to use APIs that others have created. I'm sure there are plenty perfectly fine word wrapping objects to be found, as there for other string handling issues. Similarly, why create your own tagged file format, when there are plenty of XML parsers available? Learning what to create yourself, and when to use what's already available is another important aspect of software design.

Gamertag: Custardo

Bill Loguidice
Bill Loguidice's picture
Offline
Joined: 12/31/1969
Well, here's at least one

Well, here's at least one thought for "juicing" your IF up a bit if you're going with your own engine (in other words, to take advantage of your ability to design the engine around YOUR specific requirements/desires). Do you remember "Nord and Bert Couldn't Make Head or Tail of It" from Infocom? It was basically a series of mini IF adventures loosely linked together that challenged ones ability to interact with the game in puns, cliches and other literal forms of text entry. Of course it still had a traditional parser for certain segments, but I always found it overall very refreshing to have to think differently about interfacing with the game. Emily Short's "Galatea" is another more recent example of a slightly tweaked interaction. Perhaps those ideas can inspire you to develop a unique way of interaction rather than the more traditional "Open Door" type of setup. Still, for all the "devil's advocate" and faux criticism of the approach, I wish you the best with it.

=================================
Bill Loguidice, Managing Director
Armchair Arcade, Inc.
[ My collection ]
[ http://www.MythCore.com ]

n/a
Mat Tschirgi (not verified)
Ah, programming. My

Ah, programming. My programming is frequently sloppy, but I can look at programming and understand what the code is trying to do, which I assume would make me more effecient as a Producer/Director than as a full fledged Programmer.

As for the Text Adventure, Matt, just use Inform. It will make your life a whole lot easier and isn't too hard to get the hang of. I believe Inform comes with a sample text adventure which you can print the source code for to use as reference. Any time you have well commented source code to look at, it makes learning programming a zillion times easier.

Cheers!

--------------------------
=- Mat Tschirgi =- Armchair Arcade Editor
Hear my gaming podcasts!

The Super Koopa Troopa Show

Played to Death

Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Well, one of the advantages

Well, one of the advantages of doing my own engine is that I can tailor it exactly for my needs.

I've been thinking of possible stories and such for the game. I'm kinda torn right now between a science fiction story and a post-apocalyptic Mad Max-type story I was working on as a teenager called "The Metal Monk." My friends really liked the Metal Monk, so I may bring him back and see how he works as a game. It's a pretty cliched premise, I guess, but there's just something fun to play with.

n/a
Bill Loguidice
Bill Loguidice's picture
Offline
Joined: 12/31/1969
Understood. When you

Understood. When you mentioned you wanted to make it where others could create games with it or you yourself could do future games by making the text elements modular, I was just concerned that you were considering it less of an exercise and more of a full-blown project. There's nothing wrong with competing with the established engines, it's just that the odds of doing anything remotely comparable to what's already out there in this particular case the first time out are slim. I know you have as much free time as I do - none - and was worried that you might be putting too much effort into an endeavor that might not be as fruitful as if you directed your energies to a different game type, or even a clever variation on the standard IF format. Frankly I'd love to see the latter from you. You can obviously write incredibly well, so you can make up for any "starter" programming deficiencies with a clever hook/implementation and the actual writing part, rather than the traditional "Go West" type of experience.

=================================
Bill Loguidice, Managing Director
Armchair Arcade, Inc.
[ My collection ]
[ http://www.MythCore.com ]

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Yup, Bill, you're right. I

Yup, Bill, you're right. I realize I'm reinventing the wheel here and offering something redundant to great kits like Inform (much better than TADS, or so I've heard). My basic goal here is just to learn the ropes of C++, and OOP (object-oriented programming) is easy to translate into interactive fiction or role playing games, since you're mostly dealing with objects and relationships among them.

One of my colleagues is a computer science professor who teaches programming, and every year he has his students create an interactive fiction game in C++. It's more about learning the programming concepts than trying to compete with the existing kits or even to produce a fun game.

If my main goal was to create an IF work, I definitely (and emphatically!) would use one of the kits and forget about learning C++! That'd be better on many levels, particularly in letting me focus on the game itself rather than all the details of implementation. What I'm hoping, though, is that all the stuff I'm learning about classes and such will help me when I get into more sophisticated projects, like an arcade-style game (Crystal Commander) or even a graphical adventure game.

I'm trying to decide now whether I want to go the DirectX route and make Windows games or focus on SDL/OpenGL instead. The latter would be more FOSS friendly, and easier to port to other systems, but it's a tough choice...

n/a
Bill Loguidice
Bill Loguidice's picture
Offline
Joined: 12/31/1969
(To play the devil's

(To play the devil's advocate for a moment...)

I still think this is an overly challenging endeavor, Matt. There are suitably advanced IF languages out there, so trying to recreate the wheel and also make it where nearly anyone with some light programming ability and strong writing skills could create their own adventures off of your engine seems to be rather redundant and a very uphill battle.

Are there no other game forms that would be more suitable to explore C++ with? I would think IF (Inform, HUGO, TADS, etc.) and adventure games (AGS) are pretty well covered with well documented and supported advanced engines that nearly anyone can work with. Unless of course you were able to come up with a radically different implementation that took the form in a new direction and REQUIRED a new engine to pull off (though again, what's out there is remarkable). Now THAT would be exciting and worthwhile. But that's just me, probably over analyzing it all...

=================================
Bill Loguidice, Managing Director
Armchair Arcade, Inc.
[ My collection ]
[ http://www.MythCore.com ]

n/a
phrique
Offline
Joined: 07/06/2006
Strings v. char *

Hi Matt,

Yes, strings are generally a little less confusing to work with, although I must admit I generally use char* still (force of habit).

I've done a lot of console application work actually, unfortunately the software I've developed didn't have to be worried about word wrap. That is definitely a pain. One thing you might consider doing is choosing an artificial right hand margin that's sufficiently small to eliminate any reasonable issues (like 60 characters or something, I believe the default command window is 80 characters wide) and then format all of your strings to have artificial breaks there no matter what. It can take some of the thinking out of it if you're going to be reading most of your strings out of a text file and can afford to have them preformated. It's not the most eloquent design, but it would work.

Anyway, I'll check in on this thread if you have any questions. :) It seems like you've got things pretty well worked out.

Cheers,
Jeremy

Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Thanks, guys, for your

Thanks, guys, for your responses. To answer your question, Jeremy, I'm working mostly with std::strings. I try to work with char * arrays but just end up getting confused, plus I really like the string methods.

My basic plan is to get all of the game's assets into text files and formatted like html tags (unfortunately, I can't paste it here because drupal will eat up the tags). Just imagine something like this with tag-formatting:

(ROOM ID = 1)
(NAME)Courtroom(/NAME)
(DESC)You are standing in a lovely courtroom...(/DESC)
(EXITS)N2, S3(/EXITS)(/ROOM)

My goal here is to separate (as much as possible) the coding part, so that someone else could come along and use my program to make a new adventure game without having to bother with any C++. I actually have no idea yet how I'm going to implement actions and the like, but I'll get there.

I finally got sophisticated enough so that my functions can go into the text file, recognize the tags, pull the relevant text into strings, and add them to a room object to populate the game world. Right now I'm trying to go the route of passing a pointer to an array of new room objects into a populating function (I haven't started implementing inventory items and the like yet). It's a little tricky with the pointer notation, but I haven't found a way to do the same thing by reference. What I'm trying to avoid is having to specify up front the total # of rooms to make the array. The only way I could find to do that was to use pointers and new, since C++ forces me to use a pre-defined constant if I want to make a regular array. The thing is, I can't know the total # of rooms until my program scans the text file and reports back.

The exits were very tricky, because I had to have a way to pull out the number and convert it into an int with atoi. Thank God, I finally learned about string's .c_str function. That has been making life a lot easier! I've also been having fun with the string substr function and all the find variations.

One big pain is that I can't seem to get a decent word wrap going. I'm having to manually put in line breaks on my word processor. That's a real pain. However, I did some internet research, and from what I can see, getting cout to wrap is a very advanced procedure. I'm guessing that MS provides something in its Visual C++ Express for this, but I don't know what it is. I can't even figure out how to customize the size of the console window...!

I guess the way to go would be to first get the size of the string, compare it to the size of the output window, and force a new-line. I could probably use find to look for spaces and find out if it's breaking a word or not...Hmmm...Just typing this out has helped me with my thinking!

n/a

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.