Jump to content

Home

PC Coding and C++


Dark Cloak

Recommended Posts

I'm assuming, after looking at the code for JK2 and Quake 3, that it's all done in C++ (which I'm currently tackling at the moment...like...literally, I'm going through a tutorial as I type this...). But...what I've learned so far, looking through the game code...it seems to be there. Like the stuff I'm learning is in the source for these games...but my only question is, in what ways do the things I'm learning in C++ pertain to the coding of the game?

i.e. The block of code that makes Kyle's model swing the lightsaber in <x> way when the left mouse button is clicked, or the block of code that makes him run when holding down the key to make him run forward. I can see all the code that I'm learning inside the source...but I can't really figure out how it works in relation to the game.

My point is, I can learn all the code that I want...but I can't see how it applies to the game itself. I can see it all there in the source before my very eyes, but I'm struggling how to figure out how to apply my knowledge.

Link to comment
Share on other sites

At first you must consider that you don't have the whole source. Many parts are hidden throug the engine ( jk2mp.exe ).

For example: You will not find any code that handles the raw user input ( pressing key's, moving the mouse ). Thats controlled by the engine. You can only get a set of some userinput the usercmd_t. Other input is handled with the command strings.

 

The next importand step is to know that there are 3 independent parts of your code. The game, cgame and ui part.

 

game is for all the server side stuff. you'll find that some files are used by all of them. Mainly the bg_ files. Those are the files where player moving is processed. On cliendside it will be the predicted possition. on server it will be the real position ( althou other parts of the server code predict how it would be on the clientside when the snapshot arives *g* )

 

If you want to learn how exactly the code works you should go to the vmMain() functions of game or cgame and look what functions could be called from the engine. Then you can work throug the code...

Link to comment
Share on other sites

Oooooh okay. :) Thanks! :) That helps a lot actually, because I wasn't really sure where to start. Thanks, because I wasn't sure what functions to really look at...

At about midnight last night, I started doing a tutorial to create a radar on the HUD in Q3...er...I finished...tried to complie it...got like 930 errors and 70 warnings, all that good stuff. ;) It was 6:20 in the morning when I was finally finished. ;) I have some learning to do.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...