Teen Programmers Unite  
 

 

Return to forum top

making objects in games

Posted by Dev [send private reply] at August 12, 2001, 04:22:09 AM

I was wondering when programming in C++ how would you make an object like a staff or something.

Posted by Psion [send private reply] at August 12, 2001, 10:14:21 AM

It sounds like you need to read a basic book on C++.

Posted by TheTutor [send private reply] at August 12, 2001, 04:30:56 PM

If you are talking about the graphical representation of a staff -- You would not "make that" in C++

Posted by Cobbs [send private reply] at August 12, 2001, 06:55:00 PM

Well you could make an array that holds data for the graphical representation of a staff, in C++.

Posted by Dev [send private reply] at August 13, 2001, 02:23:24 AM

no I'm talking about like
configuration for a sodacan
Void CItemSoda :: Precache ( void )
{
}

LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda )

void CItemSoda::Spawn( void )
{
Precache();
pev->soled = SOLID_NOT;
pev->movetype = MOVETYPE_TOSS;

SET_MODEL ( ENT(pev), "models/cans/sodacan";
UTIL_SetSize ( pev, Vector ( 0, 0 );

SetThink (CanThink);
pev->nextthink = gpGlobals->time;
}
I can't think of what I would do for a Staff or a weapon or magic come to think of it.
Please help

Posted by AngelOD [send private reply] at August 13, 2001, 05:55:17 AM

Let me guess.. Half-Life SDK? Looks a lot like the code in it.. Could be another game, ofcourse, but it's something like it, ain't it?

Posted by CHollman82 [send private reply] at October 01, 2001, 10:13:08 PM

Posted by Sky36 [send private reply] at August 13, 2001, 07:49:56 PM

Hey you never now it might be a text based game a mud or something.

Posted by Cobbs [send private reply] at August 13, 2001, 08:54:52 PM

well... probably not by looking at that code...

Posted by Dev [send private reply] at August 14, 2001, 05:00:36 AM

I just used that code, it was halflife AngelOD but what I meant is like how do I create a variable for holding like the amount of charges the staff and how could I access that variable and stuff like that.

Posted by infryq [send private reply] at August 14, 2001, 09:51:31 AM

i think you might want to heed psion's suggestion and pick up a book or a tutorial somewhere.... class variables are fairly simple stuff, and if that's cloudy for you you're going to need a better reference than just a generic board question. you create class variables just like you create any other kind of variables, just inside your class. You access them either using objectname.propertyname or using an access class like int getCharge() { return charge; } Seriously. Get a book. It'll do you good. Halflife's not a very good example if you're just doing beginning programming.

Posted by CHollman82 [send private reply] at October 01, 2001, 10:14:32 PM

Posted by have_dinner [send private reply] at August 14, 2001, 08:36:55 PM

Can i ask... how do you get code from computer games like halflife?? do all computer games get made in C++ or something???

Posted by CHollman82 [send private reply] at October 01, 2001, 10:14:41 PM

Posted by have_dinner [send private reply] at August 14, 2001, 09:24:50 PM

how do u get the code for the games then?

Posted by sphinX [send private reply] at August 14, 2001, 09:29:51 PM

games like halflife and quake are made to be modular in design so that people can modify them and release "mods" ... you don't get all the code, only the parts that control the gameplay (generally anyway)

Posted by taubz [send private reply] at August 14, 2001, 09:45:29 PM

I tried to make a Quake mod... that is one interesting thing to try and figure out. It's quite complex and powerful. Very cool stuff. It's definitely something fun to try.

Posted by Sky36 [send private reply] at August 14, 2001, 09:56:02 PM

Oops I should have looked at the code closer its pretty obvious its not a mud or something when you actually read whats going on. Well g2g.

Posted by AngelOD [send private reply] at August 15, 2001, 01:57:44 AM

Taubz: Indeed it's powerful stuff, but not too complex. Besides the language QuakeC had some serious limitations, this is why it has been decided to use C++ for mods now. :o)

Anyway, here's a few links for anyone who might be interested:

Half-Life SDK: http://www.valvesoftware.com/hlsdk.htm
Quake1 SDK: http://www.cc.gatech.edu/classes/AY2001/cs4455_spring/planetquake/quakec.html
Quake1 Source: ftp://ftp.idsoftware.com/idstuff/source/q1source.zip
Quake2 SDK: ftp://ftp.cdrom.com/pub/idgames2/planetquake/qdevels/q2source_12_11.zip
Quake3 SDK: Not worth mentioning as the game sucks. :P

Posted by RedX [send private reply] at August 15, 2001, 04:57:07 PM

If you want soure code of Quake (the first Quake, the one that sucked IMO) Check ID's site, they released it long time ago. And Ken Silverman released his source code of Build, the 2.5D engine used in Duke Nukem 3D and many more
(http://www.advsys.net/ken/buildsrc/default.htm)

RedX

Posted by gian [send private reply] at August 15, 2001, 10:59:45 PM

Quake 1 rules if you ask me... thing like ProQuake, that introduced 3d acceleration etc. really made the game cooler. Quake 2 sucked if you ask me, and Quake 3, I haven't played enough to pass judgement.

Posted by RedX [send private reply] at August 17, 2001, 02:40:50 PM

Quake's engine was state-of-the-art. But I always feel it misses something, interactivety with the eviroment. But I know, thats more 3Drealms style and not ID's style. Also the weapons were not as great as I had expected. I liked Q2 more, the weapons feeled more real, as did the enviroment. Quake should have used medievel weapons, they would have fitted better in the levels.

RedX

Posted by taubz [send private reply] at August 17, 2001, 09:47:17 PM

I need plasma guns and BFGs!

Posted by infryq [send private reply] at August 17, 2001, 10:05:17 PM

big friendly giant? that was an awesome book....


(sorry, had to pull that...)

Posted by CHollman82 [send private reply] at October 01, 2001, 10:14:52 PM

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.